private void OpenWorkflow()
        {
            OpenFileDialog fileDialog = WorkflowFileDialogFactory.CreateOpenFileDialog();

            if (fileDialog.ShowDialog() == true)
            {
                WorkflowViewModel workspaceViewModel = new WorkflowViewModel(this.disableDebugViewOutput);
                workspaceViewModel.FullFilePath = fileDialog.FileName;
                WorkflowDocumentContent content = new WorkflowDocumentContent(workspaceViewModel);

                ModelService modelService = workspaceViewModel.Designer.Context.Services.GetService <ModelService>();
                if (modelService != null)
                {
                    List <Type> referencedActivities = this.GetReferencedActivities(modelService);
                    this.AddActivitiesToToolbox(referencedActivities);
                }

                content.Title = workspaceViewModel.DisplayNameWithModifiedIndicator;
                content.Show(this.dockingManager);
                this.dockingManager.ActiveDocument = content;
                content.Closing += new EventHandler <CancelEventArgs>(workspaceViewModel.Closing);
            }

            this.ViewPropertyInspector();
            if (this.HasValidationErrors)
            {
                this.ViewErrors();
                this.SetSelectedTab(ContentTypes.Errors);
            }
        }
        private void Abort()
        {
            WorkflowViewModel model = this.ActiveWorkflowViewModel;

            if (model != null)
            {
                model.Abort();
            }
        }
        private void SaveAsWorkflow()
        {
            WorkflowViewModel model = this.ActiveWorkflowViewModel;

            if (model != null)
            {
                model.SaveAsWorkflow();
            }
        }
예제 #4
0
 private void Model_PropertyChanged(object sender, PropertyChangedEventArgs args)
 {
     if (args.PropertyName == "DisplayNameWithModifiedIndicator" || args.PropertyName == "DisplayName")
     {
         WorkflowViewModel model = this.DataContext as WorkflowViewModel;
         if (model != null)
         {
             this.Title = model.DisplayNameWithModifiedIndicator;
         }
     }
 }
 private void CloseAllWorkflows()
 {
     if (!this.CancelCloseAllWorkflows())
     {
         foreach (DocumentContent documentContent in new List <DocumentContent>(this.dockingManager.Documents))
         {
             WorkflowViewModel vm = documentContent.DataContext as WorkflowViewModel;
             documentContent.Closing -= vm.Closing;
             documentContent.Close();
         }
     }
 }
        private void NewWorkflow(WorkflowTypes workflowType)
        {
            WorkflowViewModel       workspaceViewModel = new WorkflowViewModel(this.disableDebugViewOutput);
            WorkflowDocumentContent content            = new WorkflowDocumentContent(workspaceViewModel, workflowType);

            content.Title = workspaceViewModel.DisplayNameWithModifiedIndicator;
            content.Show(this.dockingManager);
            this.dockingManager.ActiveDocument = content;
            content.Closing += new EventHandler <CancelEventArgs>(workspaceViewModel.Closing);
            this.ViewPropertyInspector();
            this.ViewErrors();
            this.SetSelectedTab(ContentTypes.Errors);
        }
        private void Exit()
        {
            if (!this.CancelCloseAllWorkflows())
            {
                foreach (DocumentContent documentContent in new List <DocumentContent>(this.dockingManager.Documents))
                {
                    WorkflowViewModel vm = documentContent.DataContext as WorkflowViewModel;
                    documentContent.Closing -= vm.Closing;
                    documentContent.Close();
                }

                Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose;
                Application.Current.Shutdown();
            }
        }
예제 #8
0
        public WorkflowDocumentContent(WorkflowViewModel model, WorkflowTypes workflowType)
            : base()
        {
            this.DataContext = model;

            string defaultWorkflowValue = ConfigurationManager.AppSettings["DefaultWorkflow"];

            if (!string.IsNullOrEmpty(defaultWorkflowValue))
            {
                this.defaultWorkflow = defaultWorkflowValue;
            }

            string defaultWorkflowServiceValue = ConfigurationManager.AppSettings["DefaultWorkflowService"];

            if (!string.IsNullOrEmpty(defaultWorkflowServiceValue))
            {
                this.defaultWorkflowService = defaultWorkflowServiceValue;
            }

            WorkflowDesigner designer = model.Designer;

            try
            {
                if (string.IsNullOrEmpty(model.FullFilePath))
                {
                    if (workflowType == WorkflowTypes.Activity)
                    {
                        designer.Load(Path.GetFullPath(this.defaultWorkflow));
                    }
                    else
                    {
                        designer.Load(Path.GetFullPath(this.defaultWorkflowService));
                    }
                }
                else
                {
                    designer.Load(model.FullFilePath);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(string.Format(Properties.Resources.ErrorLoadingDialogMessage, ExceptionHelper.FormatStackTrace(e)), Properties.Resources.ErrorLoadingDialogTitle, MessageBoxButton.OK, MessageBoxImage.Error);
            }

            this.Content = model.Designer.View;

            model.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(this.Model_PropertyChanged);
        }
        private void StartWithoutDebugging()
        {
            WorkflowViewModel model = this.ActiveWorkflowViewModel;

            if (model != null)
            {
                this.ViewOutput();
                this.SetSelectedTab(ContentTypes.Output);
                if (this.HasValidationErrors)
                {
                    this.ViewErrors();
                    this.SetSelectedTab(ContentTypes.Errors);
                }

                model.RunWorkflow();
            }
        }
        private IList <WorkflowViewModel> GetModifiedWorkflows()
        {
            List <WorkflowViewModel> modifiedWorkflows = new List <WorkflowViewModel>();

            foreach (DocumentContent document in this.dockingManager.Documents)
            {
                if (document is WorkflowDocumentContent)
                {
                    WorkflowViewModel model = document.DataContext as WorkflowViewModel;
                    if (model.IsModified)
                    {
                        modifiedWorkflows.Add(model);
                    }
                }
            }

            return(modifiedWorkflows);
        }
        private void StartWithDebugging()
        {
            WorkflowViewModel model = this.ActiveWorkflowViewModel;

            if (model != null)
            {
                this.ViewOutput();
                this.ViewDebug();
                this.SetSelectedTab(ContentTypes.Debug);
                if (this.HasValidationErrors)
                {
                    this.ViewErrors();
                    this.SetSelectedTab(ContentTypes.Errors);
                }

                model.DebugWorkflow();
                this.OnPropertyChanged("DebugView");
            }
        }
예제 #12
0
 public WorkflowDocumentContent(WorkflowViewModel model)
     : this(model, WorkflowTypes.Activity)
 {
 }