public void RunStarted(object automationObject, Dictionary <string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
        {
            dte = automationObject as DTE;
            installationPath = replacementsDictionary["$destinationdirectory$"];

            InitTemplateUI(customParams);

            if (((Form)inputForm).DialogResult == DialogResult.OK)
            {
                inputForm.ParseForm();
                model = inputForm.WizardModel;

                replacementsDictionary = inputForm.ProcessModel(replacementsDictionary);
            }
            else if (((Form)inputForm).DialogResult == DialogResult.Cancel)
            {
                CancelTemplate(replacementsDictionary);
                return;
            }
            else if (((Form)inputForm).DialogResult == DialogResult.Retry)
            {
                CancelTemplate(replacementsDictionary);
                return;
            }
        }
        protected virtual ActionResult Resume(string submitButton, Guid workflowKey, [DeserializeAttribute] IWizardModel Wizard, IStepViewModel stepModel)
        {
            this.InitializeWorkflowType(Wizard.WorkflowType);
            WorkflowService = new WorkflowService((System.Activities.Activity)GetNewWorfklowActivityIntance());
            if (ModelState.IsValid || submitButton != "Next" || stepModel.DontValidateNextButton)
            {
                //Persist Models
                Wizard.Steps[Wizard.CurrentStepIndex] = stepModel;
                Wizard.Command = submitButton;
                //Wizard.Save();

                Wizard.SetUrlHelper(System.Web.HttpContext.Current.Request.RequestContext);
                //Resume Workflow
                WorkflowService.ResumeWorkflow(Wizard);

                WorkflowService.RunWorkflow(Wizard, string.Empty);

                WorkflowService.Unload();

                Providers.WizardModelStoreProviderManager.Provider.SaveByKey(Wizard.Id.ToString(), Wizard);
                //Wizard.Save();
                ModelState.Clear();

                if (WorkflowService.IsCompleted || !string.IsNullOrEmpty(Wizard.ReturnUrl))
                {
                    return(Redirect(Wizard.ReturnUrl));
                }
                else
                {
                    return(View("Index", Wizard));
                }
            }

            return(View("Index", Wizard));
        }
Example #3
0
        public PackageDetailsViewModel(IWizardModel wizardModel, IPackageService packageService,
                                       IDialogService folderService, IStudioService studioService, string projectsXmlFilePath, IEventAggregatorService eventAggregator, object view) : base(view)
        {
            _wizardModel      = wizardModel;
            CurrentPageNumber = 1;
            _displayName      = PluginResources.Wizard_PackageDetails_DisplayName;
            _tooltip          = PluginResources.Wizard_PackageDetails_Tooltip;
            IsPreviousEnabled = false;
            IsNextEnabled     = true;
            CanCancel         = true;
            _isValid          = false;
            _dialogService    = folderService;
            _studioService    = studioService;
            PackageModel      = new AsyncTaskWatcherService <PackageModel>(
                packageService.OpenPackage(_wizardModel.TransitFilePathLocation, _wizardModel.PathToTempFolder));
            Customers               = new AsyncTaskWatcherService <List <Customer> >(_studioService.GetCustomers(projectsXmlFilePath));
            ProjectTemplates        = new ObservableCollection <ProjectTemplateInfo>(_studioService.GetProjectTemplates());
            SelectedProjectTemplate = ProjectTemplates[0];
            DueDate           = null;
            _displayStartDate = DateTime.Now;
            _errorMessage     = string.Empty;
            PropertyChanged  += PackageDetailsViewModelChanged;

            _errorMessageEvent = eventAggregator.Subscribe <Error>(OnErrorOccured);
        }
        protected virtual ActionResult Resume(Guid workflowKey, System.Web.HttpContext Context)
        {
            //Load Store from Provider
            IWizardModel item = (IWizardModel)Providers.WizardModelStoreProviderManager.Provider.LoadFromKey(workflowKey.ToString());

            this.InitializeWorkflowType(item.WorkflowType);
            WorkflowService = new WorkflowService((System.Activities.Activity)GetNewWorfklowActivityIntance());


            item.UserPrincipal = Context.User;
            item.SetUrlHelper(Context.Request.RequestContext);

            // Determine which workflow step wizard is at, this would be were persisted data would be loaded from model
            String step = WorkflowService.ResumeWorkflow(item);

            WorkflowService.Unload();

            if (WorkflowService.IsCompleted || !string.IsNullOrEmpty(item.ReturnUrl))
            {
                return(Redirect(item.ReturnUrl));
            }
            else
            {
                return(View("Index", item));
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="WizardPageBase" /> class.
 /// </summary>
 /// <param name="title"> The title of the current wizard page. </param>
 /// <param name="description"> The description of the current wizard page. </param>
 /// <param name="wizard">
 /// The <see cref="Wizard" /> instance which contains the current wizard page.
 /// </param>
 /// <param name="model"> The data model of the current wizard page. </param>
 /// <param name="type"> The type of the current wizard page. </param>
 protected WizardPageBase(string title, string description, Wizard wizard, IWizardModel model, WizardPageType type)
     : this()
 {
     this.title       = title;
     this.description = description;
     this.wizard      = wizard;
     this.model       = model;
     this.Type        = type;
 }
Example #6
0
 public string RunWorkflow(IWizardModel model, string Bookmark)
 {
     if (string.IsNullOrEmpty(Bookmark))
     {
         return(_wizardHostHelper.RunWorkflow(model));
     }
     else
     {
         return(GoTo(Bookmark, model));
     }
 }
Example #7
0
 public TmsViewModel(IWizardModel wizardModel, IDialogService dialogService, object view) : base(view)
 {
     _currentPageNumber = 2;
     _displayName       = PluginResources.Wizard_TM_DisplayName;
     _tooltip           = PluginResources.Wizard_Tms_Tooltip;
     _wizardModel       = wizardModel;
     IsPreviousEnabled  = true;
     IsNextEnabled      = true;
     CanCancel          = true;
     _dialogService     = dialogService;
     _isValid           = true;
     PropertyChanged   += TmsViewModelChanged;
 }
        public string ResumeWizard(IWizardModel model)
        {
            _workflowApplication.Load(model.Id);

            string bookmarkName = "final";

            System.Collections.ObjectModel.ReadOnlyCollection <System.Activities.Hosting.BookmarkInfo> bookmarks = _workflowApplication.GetBookmarks();
            if (bookmarks != null && bookmarks.Count > 0)
            {
                bookmarkName = bookmarks[0].BookmarkName;
            }

            return(bookmarkName);
        }
Example #9
0
        public String ResumeWorkflow(IWizardModel model)
        {
            String bookmarkName = "Final";

            try
            {
                bookmarkName = _wizardHostHelper.ResumeWizard(model);
            }
            catch (Exception ex)
            {
                // TODO get complete exception
            }
            return(bookmarkName);
        }
        public void Continue(NativeActivityContext context, Bookmark bookmark, object obj)
        {
            IWizardModel model = (IWizardModel)obj;

            //if (model.Steps[model.CurrentStepIndex].HideProgress == true)
            //{
            //    model.Steps.Remove(model.Steps[model.CurrentStepIndex]);
            //    model.CurrentStepIndex-=1;
            //}

            context.SetValue(WFContext, model);
            Input.Set(context, model.Command);
            Result.Set(context, model.Steps[model.CurrentStepIndex]);
        }
        public string RunWorkflowWithBookmark(string Bookmark, IWizardModel model)
        {
            _workflowApplication.ResumeBookmark(Bookmark, model);
            _instanceUnloaded.WaitOne();

            if (!_isCompleted)
            {
                Bookmark = _workflowApplication.GetBookmarks()[0].BookmarkName;
                return(Bookmark);
            }
            else
            {
                return("final");
            }
        }
        public string RunWorkflow(IWizardModel model)
        {
            string bookmarkName = string.IsNullOrEmpty(model.Steps[model.CurrentStepIndex].BookMark) ? "final" : model.Steps[model.CurrentStepIndex].BookMark;

            //string bookmarkName = _workflowApplication.GetBookmarks()[0].BookmarkName;
            _workflowApplication.ResumeBookmark(bookmarkName, model);
            _instanceUnloaded.WaitOne();
            if (!_isCompleted)
            {
                bookmarkName = _workflowApplication.GetBookmarks()[0].BookmarkName;
                return(bookmarkName);
            }
            else
            {
                return("final");
            }
        }
Example #13
0
        private ObservableCollection <IProgressHeaderItem> CreatePages(IWizardModel wizardModel)
        {
            var packageService = new PackageService(_eventAggregatorService);
            var studioService  = new StudioService(_projectsController);
            var dialogService  = new DialogService();
            var projectService = new ProjectService(_eventAggregatorService);

            var shortStudioVersion = _studioVersionService.GetStudioVersion()?.ShortVersion;
            var projectsPath       = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
                                                  $@"Studio {shortStudioVersion}\Projects\projects.xml");

            return(new ObservableCollection <IProgressHeaderItem>
            {
                new PackageDetailsViewModel(wizardModel, packageService, dialogService, studioService, projectsPath, _eventAggregatorService, new PackageDetails()),
                new TmsViewModel(wizardModel, dialogService, new Tms()),
                new CreateProjectViewModel(wizardModel, projectService, _eventAggregatorService, new CreateProject())
            });
        }
Example #14
0
 public CreateProjectViewModel(IWizardModel wizardModel, IProjectService projectService, IEventAggregatorService eventAggregatorService, object view) : base(view)
 {
     _currentPageNumber            = 3;
     _wizardModel                  = wizardModel;
     _displayName                  = PluginResources.Wizard_CreateProj_DisplayName;
     _tooltip                      = PluginResources.Wizard_PackageDetails_Tooltip;
     _isPreviousEnabled            = true;
     _isNextEnabled                = false;
     _projectService               = projectService;
     _eventAggregatorService       = eventAggregatorService;
     _fileProgressEvent            = _eventAggregatorService?.Subscribe <TmFilesProgress>(OnTmFileProgressChanged);
     _xliffCreationProgressEvent   = _eventAggregatorService?.Subscribe <XliffCreationProgress>(OnXliffCreationProgressChanged);
     _projectCreationProgressEvent = _eventAggregatorService?.Subscribe <ProjectCreationProgress>(OnStudioProjectProgressChanged);
     _createProjectEvent           = _eventAggregatorService?.Subscribe <CreateStudioProject>(CreateTradosProject);
     TmSummaryOptions              = new ObservableCollection <TmSummaryOptions>();
     TmImportProgress              = new ObservableCollection <TmSummaryOptions>();
     PropertyChanged              += CreateProjectViewModelChanged;
     CanCancel                     = true;
 }
Example #15
0
        public int Registor(IWizardModel page)
        {
            int targetIdx = -1;

            if (noUsedIndex.Count == 0)
            {
                targetIdx = _indexCount;
                _indexCount++;
            }
            else
            {
                targetIdx = noUsedIndex[0];
                noUsedIndex.RemoveAt(0);
            }

            ((WizardModelBase)page).LabelFlag = targetIdx;

            Pages.Add(targetIdx, page);

            return(targetIdx);
        }
Example #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WizardPage" /> class. 
 /// </summary>
 /// <param name="title"> The title of the current wizard page. </param>
 /// <param name="description"> The description of the current wizard page. </param>
 /// <param name="wizard">
 /// The <see cref="Wizard" /> instance which contains the current wizard page.
 /// </param>
 /// <param name="model"> The data model of the current wizard page. </param>
 protected WizardPage(string title, string description, Wizard wizard, IWizardModel model = null)
     : this(title, description, wizard, model, WizardPageType.Standard)
 {
 }
Example #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WizardPage" /> class. 
 /// </summary>
 /// <param name="title"> The title of the current wizard page. </param>
 /// <param name="description"> The description of the current wizard page. </param>
 /// <param name="wizard">
 /// The <see cref="Wizard" /> instance which contains the current wizard page.
 /// </param>
 /// <param name="model"> The data model of the current wizard page. </param>
 /// <param name="type"> The type of the current wizard page. </param>
 protected WizardPage(string title, string description, Wizard wizard, IWizardModel model, WizardPageType type)
     : base(title, description, wizard, model, type)
 {
 }
Example #18
0
        //public string Back()
        //{
        //    return _wizardHostHelper.RunWorkflow("Back");
        //}

        public string GoTo(string BookMark, IWizardModel model)
        {
            return(_wizardHostHelper.RunWorkflowWithBookmark(BookMark, model));
        }
Example #19
0
 public bool IsContains(IWizardModel page)
 {
     return(Pages.ContainsValue(page));
 }
 public abstract void SaveByKey(string key, IWizardModel item);
Example #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WizardPage" /> class.
 /// </summary>
 /// <param name="title"> The title of the current wizard page. </param>
 /// <param name="description"> The description of the current wizard page. </param>
 /// <param name="wizard">
 /// The <see cref="Wizard" /> instance which contains the current wizard page.
 /// </param>
 /// <param name="model"> The data model of the current wizard page. </param>
 /// <param name="type"> The type of the current wizard page. </param>
 protected WizardPage(string title, string description, Wizard wizard, IWizardModel model, WizardPageType type)
     : base(title, description, wizard, model, type)
 {
 }
Example #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WizardPage" /> class.
 /// </summary>
 /// <param name="title"> The title of the current wizard page. </param>
 /// <param name="description"> The description of the current wizard page. </param>
 /// <param name="wizard">
 /// The <see cref="Wizard" /> instance which contains the current wizard page.
 /// </param>
 /// <param name="model"> The data model of the current wizard page. </param>
 protected WizardPage(string title, string description, Wizard wizard, IWizardModel model = null)
     : this(title, description, wizard, model, WizardPageType.Standard)
 {
 }