コード例 #1
0
        private static Dev2DecisionCallbackHandler ShowDecisionDialogWindow(ModelItem mi, DecisionDesignerViewModel dataContext)
        {
            var large = new Large {
                DataContext = dataContext
            };
            var window = new ActivityDefaultWindow();

            if (Application.Current != null)
            {
                window.Style = Application.Current.TryFindResource("DecisionWindowStyle") as Style;
            }
            var contentPresenter = window.FindChild <ContentPresenter>();

            if (contentPresenter != null)
            {
                contentPresenter.Content = large;
            }

            window.SetEnableDoneButtonState(true);
            DesignerView parentContentPane = FindDependencyParent.FindParent <DesignerView>(mi?.Parent?.View);
            var          dataContext1      = parentContentPane?.DataContext;

            if (dataContext1 != null)
            {
                if (dataContext1.GetType().Name == "ServiceTestViewModel")
                {
                    window.SetEnableDoneButtonState(false);
                }
            }

            var showDialog = window.ShowDialog();

            window.SetEnableDoneButtonState(true);
            if (showDialog.HasValue && showDialog.Value)
            {
                var dev2DecisionCallbackHandler = new Dev2DecisionCallbackHandler();
                dataContext.GetExpressionText();
                dev2DecisionCallbackHandler.ModelData = dataContext.ExpressionText;
                return(dev2DecisionCallbackHandler);
            }
            return(null);
        }
コード例 #2
0
        private static Dev2DecisionCallbackHandler ShowSwitchDialogWindow(ModelItem modelItem, SwitchDesignerViewModel dataContext)
        {
            var large = new ConfigureSwitch {
                DataContext = dataContext
            };
            var window = new ActivityDefaultWindow();

            if (Application.Current != null)
            {
                window.Style = Application.Current.TryFindResource("SwitchMainWindowStyle") as Style;
            }
            var contentPresenter = window.FindChild <ContentPresenter>();

            if (contentPresenter != null)
            {
                contentPresenter.Content = large;
            }
            DesignerView parentContentPane = FindDependencyParent.FindParent <DesignerView>(modelItem?.Parent?.View);
            var          dataContext1      = parentContentPane?.DataContext;

            if (dataContext1 != null)
            {
                if (dataContext1.GetType().Name == "ServiceTestViewModel")
                {
                    window.SetEnableDoneButtonState(false);
                }
            }

            var showDialog = window.ShowDialog();

            window.SetEnableDoneButtonState(true);
            if (showDialog.HasValue && showDialog.Value)
            {
                var callBack = new Dev2DecisionCallbackHandler {
                    ModelData = JsonConvert.SerializeObject(dataContext.Switch)
                };
                return(callBack);
            }
            return(null);
        }