Exemple #1
0
        public void ConfigureSwitchCaseExpression(ConfigureCaseExpressionMessage args)
        {
            IEnvironmentModel environment = args.EnvironmentModel;
            ModelItem         switchCase  = args.ModelItem;

            string modelData =
                JsonConvert.SerializeObject(new Dev2Switch
            {
                SwitchVariable   = "",
                SwitchExpression = args.ExpressionText
            });

            // now invoke the wizard ;)
            _callBackHandler = RootWebSite.ShowSwitchDragDialog(environment, modelData);

            // Wizard finished...
            // Now Fetch from DL and push the model data into the workflow
            try
            {
                var ds = JsonConvert.DeserializeObject <Dev2Switch>(_callBackHandler.ModelData);
                ActivityHelper.SetSwitchKeyProperty(ds, switchCase);
            }
            catch
            {
                _popupController.Show(GlobalConstants.SwitchWizardErrorString,
                                      GlobalConstants.SwitchWizardErrorHeading, MessageBoxButton.OK,
                                      MessageBoxImage.Error, null);
            }
        }
Exemple #2
0
        // 28.01.2013 - Travis.Frisinger : Added for Case Edits
        public void EditSwitchCaseExpression(EditCaseExpressionMessage args)
        {
            IEnvironmentModel environment     = args.EnvironmentModel;
            ModelProperty     switchCaseValue = args.ModelItem.Properties["Case"];

            string modelData = JsonConvert.SerializeObject(DataListConstants.DefaultCase);

            // Extract existing value ;)
            if (switchCaseValue != null)
            {
                string val = switchCaseValue.ComputedValue.ToString();
                modelData = JsonConvert.SerializeObject(new Dev2Switch {
                    SwitchVariable = val
                });
            }

            // now invoke the wizard ;)
            _callBackHandler = RootWebSite.ShowSwitchDragDialog(environment, modelData);

            // Wizard finished...
            // Now Fetch from DL and push the model data into the workflow
            try
            {
                var ds = JsonConvert.DeserializeObject <Dev2Switch>(_callBackHandler.ModelData);

                if (ds != null)
                {
                    if (switchCaseValue != null)
                    {
                        switchCaseValue.SetValue(ds.SwitchVariable);
                    }
                }
            }
            catch
            {
                _popupController.Show(GlobalConstants.SwitchWizardErrorString,
                                      GlobalConstants.SwitchWizardErrorHeading, MessageBoxButton.OK,
                                      MessageBoxImage.Error, null);
            }
        }
        internal ConnectControlViewModel(IMainViewModel mainViewModel,
                                         IEnvironmentRepository environmentRepository,
                                         Action <IEnvironmentModel> callbackHandler,
                                         IConnectControlSingleton connectControlSingleton,
                                         string labelText,
                                         bool bindToActiveEnvironment, Action <IEnvironmentModel, ResourceType, string, string, string, string, string> openWizard = null)
        {
            VerifyArgument.IsNotNull("callbackHandler", callbackHandler);
            VerifyArgument.IsNotNull("connectControlSingleton", connectControlSingleton);
            VerifyArgument.IsNotNull("labelText", labelText);
            VerifyArgument.IsNotNull("environmentRepository", environmentRepository);

            if (Application.Current != null)
            {
                _dispatcher = Application.Current.Dispatcher;
            }

            IsEnabled                = true;
            IsDropDownEnabled        = true;
            LabelText                = labelText;
            _mainViewModel           = mainViewModel;
            _environmentRepository   = environmentRepository;
            _callbackHandler         = callbackHandler;
            _connectControlSingleton = connectControlSingleton;
            _bindToActiveEnvironment = bindToActiveEnvironment;
            _connectControlSingleton.ConnectedStatusChanged += ConnectedStatusChanged;
            _connectControlSingleton.ConnectedServerChanged += ConnectedServerChanged;

            if (openWizard == null)
            {
                _openWizard = (environmentModel, resourceType, resourcePath, category, resourceId, sourceId, resourceName) => RootWebSite.ShowDialog(environmentModel, resourceType, resourcePath, category, resourceId, sourceId, resourceName);
            }
            else
            {
                _openWizard = openWizard;
            }

            SetSelectedEnvironment();
        }
 public void ShowSaveDialog(IContextualResourceModel resourceModel, bool addToTabManager)
 {
     RootWebSite.ShowNewWorkflowSaveDialog(resourceModel, null, addToTabManager);
 }
 public WorkSurfaceContextViewModel(WorkSurfaceKey workSurfaceKey, IWorkSurfaceViewModel workSurfaceViewModel)
     : this(EventPublishers.Aggregator, workSurfaceKey, workSurfaceViewModel, new PopupController(), (a, b) => RootWebSite.ShowNewWorkflowSaveDialog(a, null, b))
 {
 }
Exemple #6
0
 protected virtual Dev2DecisionCallbackHandler StartSwitchDropWizard(IEnvironmentModel environmentModel, string val)
 {
     return(RootWebSite.ShowSwitchDropDialog(environmentModel, val));
 }