internal void ConfigureSwitchCaseExpression(Tuple<ModelItem, IEnvironmentModel> payload)
{
IEnvironmentModel environment = payload.Item2;
ModelItem switchCase = payload.Item1;
string modelData = JsonConvert.SerializeObject(DataListConstants.DefaultCase);
ErrorResultTO errors = new ErrorResultTO();
Guid dataListID = GlobalConstants.NullDataListID;
if (errors.HasErrors()) //BUG 8796, Added this if to handle errors
{
// Bad things happened... Tell the user
PopupProvider.Show(errors.MakeDisplayReady(), GlobalConstants.SwitchWizardErrorHeading,
MessageBoxButton.OK, MessageBoxImage.Error);
// Stop configuring!!!
return;
}
// now invoke the wizard ;)
Uri requestUri;
if (Uri.TryCreate((environment.WebServerAddress + GlobalConstants.SwitchDragWizardLocation), UriKind.Absolute, out requestUri))
{
string uriString = Browser.FormatUrl(requestUri.AbsoluteUri, dataListID);
//var callBackHandler = new Dev2DecisionCallbackHandler();
//callBackHandler.Owner = new WebPropertyEditorWindow(callBackHandler, uriString) { Width = 580, Height = 270 };
//callBackHandler.Owner.ShowDialog();
_callBackHandler.ModelData = modelData;
WebSites.ShowWebPageDialog(uriString, _callBackHandler, 470, 285);
// Wizard finished...
// Now Fetch from DL and push the model data into the workflow
try
{
Dev2Switch ds = JsonConvert.DeserializeObject<Dev2Switch>(callBackHandler.ModelData);
if (ds != null)
{
ModelProperty keyProperty = switchCase.Properties["Key"];
if (keyProperty != null)
{
keyProperty.SetValue(ds.SwitchVariable);
}
}
}
catch
{
// Bad things happened... Tell the user
PopupProvider.Buttons = MessageBoxButton.OK;
PopupProvider.Description = GlobalConstants.SwitchWizardErrorString;
PopupProvider.Header = GlobalConstants.SwitchWizardErrorHeading;
PopupProvider.ImageType = MessageBoxImage.Error;
PopupProvider.Show();
}
}
}