Пример #1
0
        private ObservableCollection <WizardPageViewModelBase> CreatePages(WizardContext wizardContext)
        {
            var pages = new List <WizardPageViewModelBase>();

            if (_action == Enumerators.Action.Export)
            {
                pages.Add(new WizardPageExportFilesViewModel(_wizardWindow, new WizardPageExportFilesView(), wizardContext));
                pages.Add(new WizardPageExportOptionsViewModel(_wizardWindow, new WizardPageExportOptionsView(), wizardContext, _dialogService));
                pages.Add(new WizardPageExportSummaryViewModel(_wizardWindow, new WizardPageExportSummaryView(), wizardContext));
                pages.Add(new WizardPageExportPreparationViewModel(_wizardWindow, new WizardPageExportPreparationView(), wizardContext,
                                                                   _segmentBuilder, _pathInfo));
            }
            else if (_action == Enumerators.Action.Import)
            {
                pages.Add(new WizardPageImportFilesViewModel(_wizardWindow, new WizardPageImportFilesView(), wizardContext, _dialogService, _languageProvider));
                pages.Add(new WizardPageImportOptionsViewModel(_wizardWindow, new WizardPageImportOptionsView(), wizardContext));
                pages.Add(new WizardPageImportSummaryViewModel(_wizardWindow, new WizardPageImportSummaryView(), wizardContext));
                pages.Add(new WizardPageImportPreparationViewModel(_wizardWindow, new WizardPageImportPreparationView(), wizardContext,
                                                                   _segmentBuilder, _pathInfo));
            }
            else if (_action == Enumerators.Action.Convert)
            {
                pages.Add(new WizardPageConvertOptionsViewModel(_wizardWindow, new WizardPageConvertOptionsView(), wizardContext, _dialogService));
                pages.Add(new WizardPageConvertSummaryViewModel(_wizardWindow, new WizardPageConvertSummaryView(), wizardContext));
                pages.Add(new WizardPageConvertPreparationViewModel(_wizardWindow, new WizardPageConvertPreparationView(), wizardContext,
                                                                    _segmentBuilder, _pathInfo, _controllers, _projectAutomationService));
            }

            UpdatePageIndexes(pages);

            return(new ObservableCollection <WizardPageViewModelBase>(pages));
        }
Пример #2
0
        // Protected methods (BasePage)

        protected override void DoEntering(WizardContext context)
        {
            // Let's write a little summary of what the user has chosen
            var sb = new StringBuilder();

            sb.AppendLine("The wizard is finished! Here's the info that was entered:");
            sb.AppendLine();
            if (context.InfoSelection == InfoSelectionMode.Work)
            {
                sb.AppendLine(string.Format("You described your work: {0}", context.KindOfWork));
            }
            else if (context.InfoSelection == InfoSelectionMode.Family)
            {
                sb.AppendLine(string.Format("Your family consists of {0} adults and {1} children", context.AdultCount,
                                            context.ChildCount));
                if (!string.IsNullOrEmpty(context.FamilyPet))
                {
                    sb.AppendLine(string.Format("You also have: {0}", context.FamilyPet));
                }
            }

            tbSummary.Text            = sb.ToString();
            tbSummary.SelectionStart  = 0;
            tbSummary.SelectionLength = 0;
        }
Пример #3
0
        public void CreateReport(WizardContext wizardContext, string reportFile,
                                 FileBasedProject selectedProject, string targetLanguageCode)
        {
            var settings = new XmlWriterSettings
            {
                OmitXmlDeclaration = true,
                Indent             = false
            };

            var actionName = wizardContext.Action == Enumerators.Action.Export
                                ? "Export"
                                : "Import";

            var projectFiles = wizardContext.ProjectFiles.Where(a => a.Selected &&
                                                                string.Compare(a.TargetLanguage, targetLanguageCode,
                                                                               StringComparison.CurrentCultureIgnoreCase) == 0).ToList();

            using (var writer = XmlWriter.Create(reportFile, settings))
            {
                writer.WriteStartElement("task");
                writer.WriteAttributeString("name", actionName);
                writer.WriteAttributeString("created", wizardContext.DateTimeStampToString);

                WriteReportTaskInfo(writer, wizardContext, selectedProject, targetLanguageCode);

                foreach (var projectFile in projectFiles)
                {
                    WriteReportFile(writer, wizardContext, projectFile);
                }

                WriteReportTotal(writer, wizardContext, projectFiles);

                writer.WriteEndElement();                 //task
            }
        }
Пример #4
0
        private void ConsentBrowser_Navigating(object sender, NavigatingCancelEventArgs e)
        {
            NameValueCollection queryParameters = System.Web.HttpUtility.ParseQueryString(e.Uri.Query);

            string adminConsent = queryParameters["admin_consent"];

            if (adminConsent != null)
            {
                if (string.Compare(adminConsent, "true", true) != 0)
                {
                    Dispatcher.BeginInvoke(new Action(() =>
                    {
                        MessageBox.Show("The installer will fail if admin consent is not granted for the application permissions being requested. As consent was not give this installer will now exit.", "Admin Consent Required", MessageBoxButton.OK, MessageBoxImage.Error);
                        Application.Current.MainWindow.Close();
                    }));
                }
                else
                {
                    WizardContext.NextPage();
                }
            }

            string error = queryParameters["error"];

            if (error != null)
            {
                Dispatcher.BeginInvoke(new Action(() =>
                {
                    MessageBox.Show("The installer will fail if admin consent is not granted for the application permissions being requested. As consent was not given this installer will now exit.", "Admin Consent Required", MessageBoxButton.OK, MessageBoxImage.Error);
                    Application.Current.MainWindow.Close();
                }));
            }
        }
Пример #5
0
        public UpdateUniqueRowValidator(WizardContext context, SheetHelper sheet)
        {
            //在 Insert 模式不進行此類型驗證。
            _skip_validate = (context.CurrentMode != ImportMode.Update);

            if (_skip_validate)
            {
                return;
            }

            _sheet             = sheet;
            _primary_condition = context.IdentifyField;
            _check_conditions  = new List <ImportCondition>();

            List <ImportCondition> conditions = new List <ImportCondition>();

            foreach (ImportCondition each in context.UpdateConditions)
            {
                if (each.ContainsAllField(context.SelectedFields.ToArray()))
                {
                    conditions.Add(each);
                }
            }

            _check_conditions = conditions;

            if (!conditions.Contains(context.IdentifyField))
            {
                conditions.Add(context.IdentifyField); //連同 Primary Condition 一起加入。
            }
            XmlElement recordData = context.DataSource.GetUniqueFieldData();

            _key_sets = new ConditionKeySetCollection(conditions, recordData, "Record");
        }
Пример #6
0
        public ClassImportWizard()
        {
            InitializeComponent();

            #region 設定Wizard會跟著Style跑
            (GlobalManager.Renderer as Office2007Renderer).ColorTableChanged += new EventHandler(ClassImportWizard_ColorTableChanged);
            //this.ImportWizard.FooterStyle.ApplyStyle(( GlobalManager.Renderer as Office2007Renderer ).ColorTable.GetClass(ElementStyleClassKeys.RibbonFileMenuBottomContainerKey));
            this.ImportWizard.HeaderStyle.ApplyStyle((GlobalManager.Renderer as Office2007Renderer).ColorTable.GetClass(ElementStyleClassKeys.RibbonFileMenuBottomContainerKey));
            this.ImportWizard.FooterStyle.BackColorGradientAngle = -90;
            this.ImportWizard.FooterStyle.BackColorGradientType  = eGradientType.Linear;
            this.ImportWizard.FooterStyle.BackColor  = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.Default.TopBackground.Start;
            this.ImportWizard.FooterStyle.BackColor2 = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.Default.TopBackground.End;
            this.ImportWizard.BackColor       = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.Default.TopBackground.Start;
            this.ImportWizard.BackgroundImage = null;
            for (int i = 0; i < 5; i++)
            {
                (this.ImportWizard.Controls[1].Controls[i] as ButtonX).ColorTable = eButtonColor.OrangeWithBackground;
            }
            (this.ImportWizard.Controls[0].Controls[1] as System.Windows.Forms.Label).ForeColor = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.MouseOver.TitleText;
            (this.ImportWizard.Controls[0].Controls[2] as System.Windows.Forms.Label).ForeColor = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.Default.TitleText;
            #endregion

            //SmartSchool.Common.SkillSchool.SetConnection("smartschool@dev", "admin", "1234");
            _context            = new WizardContext();
            _data_source        = new ImportDataAccess();
            _context.DataSource = _data_source;
        }
 protected WizardPageViewModelBase(Window owner, object view, WizardContext wizardContext)
 {
     Owner         = owner;
     View          = view;
     WizardContext = wizardContext;
     IsProcessing  = false;
 }
Пример #8
0
        public WizardPageImportSummaryViewModel(Window owner, object view, WizardContext wizardContext) : base(owner, view, wizardContext)
        {
            IsValid = true;

            LoadPage  += OnLoadPage;
            LeavePage += OnLeavePage;
        }
Пример #9
0
        public ShiftCheckRowValidator(WizardContext context)
        {
            //未指定 CheckField 時不進行驗證。
            _skip_validate = (context.ShiftCheckField == null);

            if (_skip_validate)
            {
                return;
            }

            _check_field = context.ShiftCheckField;

            List <string> requireFields = new List <string>();

            requireFields.AddRange(context.IdentifyField.Fields.ToInternalNames());
            requireFields.Add(context.ShiftCheckField.InternalName);

            XmlElement recordData = context.DataSource.GetShiftCheckList(requireFields.ToArray());

            List <ImportCondition> cond = new List <ImportCondition>();

            cond.Add(context.IdentifyField);

            _key_sets = new ConditionKeySetCollection(cond, recordData, "Record");
        }
 protected override void DoExiting(WizardContext context)
 {
     if (comboPets.SelectedIndex == 0)
         context.FamilyPet = "";
     else
         context.FamilyPet = comboPets.Text;
 }
        // Protected methods (BasePage)

        protected override void DoEntering(WizardContext context)
        {
            if (string.IsNullOrEmpty(context.FamilyPet))
                comboPets.SelectedIndex = 0;
            else
                comboPets.SelectedIndex = comboPets.Items.IndexOf(context.FamilyPet);
        }
Пример #12
0
        private void UpdateProjectReports(WizardContext wizardContext, FileBasedProject project, AutomaticTask automaticTask)
        {
            if (project == null)
            {
                return;
            }

            try
            {
                _supressProjectControllerEvents = true;

                _projectsController.Close(project);
                _projectSettingsService.UpdateAnalysisTaskReportInfo(project, automaticTask);
                _projectsController.Add(project.FilePath);

                switch (wizardContext.Owner)
                {
                case Enumerators.Controller.Files:
                    _filesController.Activate();
                    break;

                case Enumerators.Controller.Projects:
                    _projectsController.Activate();
                    break;
                }
            }
            finally
            {
                _supressProjectControllerEvents = false;
            }
        }
Пример #13
0
        public DataLayerPage(WizardContext context)
        {
            _context = context;
            InitializeComponent();

            chbCreateNewLayer.Checked = true;
        }
Пример #14
0
 public MeasureHandsPaddingStep(WizardContext context)
 {
     _context          = context;
     _head             = context.containingAtom.rigidbodies.First(fc => fc.name == "head");
     _leftHandControl  = context.containingAtom.freeControllers.First(fc => fc.name == "lHandControl");
     _rightHandControl = context.containingAtom.freeControllers.First(fc => fc.name == "rHandControl");
 }
Пример #15
0
 private void SequentialRunner_OnComplete(object sender, EventArgs e)
 {
     Dispatcher.BeginInvoke(new Action(() =>
     {
         WizardContext.NextPage();
     }));
 }
Пример #16
0
        /// <summary>
        /// Create new instance of <see cref="FormatOptionsPage"/>
        /// </summary>
        /// <param name="context">Context</param>
        public FormatOptionsPage(WizardContext context)
        {
            _settings = (CsvImportSettings)context.Settings;
            _importer = context.Importer;

            InitializeComponent();
        }
Пример #17
0
 public TeacherDuplicateRowValidator(WizardContext context)
 {
     _import_mode     = context.CurrentMode;
     _data_source     = context.DataSource as ImportDataAccess;
     _course_teachers = new ConditionKeySet(context.IdentifyField);
     _selected_fields = context.SelectedFields;
 }
Пример #18
0
        public OptionsPage(WizardContext context)
        {
            _settings = (WaterMLImportSettings)context.Settings;

            InitializeComponent();

            cbTheme.TextChanged += cbTheme_TextChanged;
        }
 public MeasureAnchorWidthStep(WizardContext context, string part, ControllerAnchorPoint anchor)
 {
     _context          = context;
     _part             = part;
     _anchor           = anchor;
     _leftHandControl  = context.containingAtom.freeControllers.First(fc => fc.name == "lHandControl");
     _rightHandControl = context.containingAtom.freeControllers.First(fc => fc.name == "rHandControl");
 }
Пример #20
0
        // Protected methods

        protected override void DoEntering(WizardContext context)
        {
            // Select the correct item in the combobox
            var index = comboKindOfWork.Items.IndexOf(context.KindOfWork ?? "");
            if (index < 0)
                index = 0;

            comboKindOfWork.SelectedIndex = index;
        }
Пример #21
0
        /// <summary>
        /// Create new instance of <see cref="FormatOptionsPage"/>
        /// </summary>
        /// <param name="context">Context</param>
        public FormatOptionsPage(WizardContext context)
        {
            _settings = (ExcelImportSettings)context.Settings;
            _importer = context.Importer;

            InitializeComponent();

            cmbExcelSheet.SelectedValueChanged += CmbFileTypeOnSelectedValueChanged;
        }
Пример #22
0
 public ICollection <WizardPage> GetWizardPages(WizardContext context)
 {
     return(new Collection <WizardPage>
     {
         new OptionsPage(context),
         new ProgressPage(context),
         new CompletePage(),
     });
 }
 protected override void DoExiting(WizardContext context)
 {
     // Save the selected choice to context since it will be used in the state machine guard
     // clauses when selecting the next page
     if (radioFamily.Checked)
         context.InfoSelection = InfoSelectionMode.Family;
     else
         context.InfoSelection = InfoSelectionMode.Work;
 }
Пример #24
0
 private static void WriteReportCustomer(XmlWriter writer, WizardContext wizardContext)
 {
     if (!string.IsNullOrEmpty(wizardContext.Project.Customer?.Name))
     {
         writer.WriteStartElement("customer");
         writer.WriteAttributeString("name", wizardContext.Project.Customer.Name);
         writer.WriteAttributeString("email", wizardContext.Project.Customer.Email);
         writer.WriteEndElement();                 //customer
     }
 }
        public WizardPageExportFilesViewModel(Window owner, object view, WizardContext wizardContext)
            : base(owner, view, wizardContext)
        {
            ProjectFiles = wizardContext.ProjectFiles;

            VerifyProjectFiles();

            LoadPage  += OnLoadPage;
            LeavePage += OnLeavePage;
        }
Пример #26
0
 public WizardViewModel(Window window, ObservableCollection <WizardPageViewModelBase> pages,
                        WizardContext wizardContext, Enumerators.Action action)
 {
     SetWindow(window);
     Pages         = pages;
     Action        = action;
     WizardContext = wizardContext;
     UpdateWizardHeader(_window.ActualWidth);
     SetCurrentPage(Pages[0]);
 }
Пример #27
0
        public WizardPageConvertOptionsViewModel(Window owner, object view, WizardContext wizardContext, IDialogService dialogService)
            : base(owner, view, wizardContext)
        {
            _dialogService             = dialogService;
            OutputFolder               = WizardContext.TransactionFolder;
            MaxAlternativeTranslations = wizardContext.ConvertOptions.MaxAlternativeTranslations;
            CloseProjectOnComplete     = wizardContext.ConvertOptions.CloseProjectOnComplete;

            LoadPage  += OnLoadPage;
            LeavePage += OnLeavePage;
        }
Пример #28
0
 public ICollection <WizardPage> GetWizardPages(WizardContext context)
 {
     return(new Collection <WizardPage>
     {
         new FormatOptionsPage(context),
         new FieldPropertiesPage(context),
         new DataLayerPage(context),
         new ProgressPage(context),
         new CompletePage(),
     });
 }
Пример #29
0
 protected override void DoExiting(WizardContext context)
 {
     if (comboPets.SelectedIndex == 0)
     {
         context.FamilyPet = "";
     }
     else
     {
         context.FamilyPet = comboPets.Text;
     }
 }
Пример #30
0
        private void WriteReportFile(XmlWriter writer, WizardContext wizardContext, ProjectFile projectFile)
        {
            writer.WriteStartElement("file");
            writer.WriteAttributeString("name", Path.Combine(projectFile.Path, projectFile.Name));
            writer.WriteAttributeString("guid", projectFile.FileId);

            WriteAnalysisXml(writer, projectFile.TranslationOriginStatistics?.WordCounts, wizardContext.AnalysisBands, wizardContext.Action);
            WriteConfirmationXml(writer, projectFile.ConfirmationStatistics?.WordCounts, wizardContext.Action);

            writer.WriteEndElement();             //file
        }
Пример #31
0
        // Protected methods (BasePage)

        protected override void DoEntering(WizardContext context)
        {
            if (string.IsNullOrEmpty(context.FamilyPet))
            {
                comboPets.SelectedIndex = 0;
            }
            else
            {
                comboPets.SelectedIndex = comboPets.Items.IndexOf(context.FamilyPet);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="WelcomeInstallationControl"/> class.
        /// </summary>
        /// <param name="model">The view model to bind to this control.</param>
        /// <param name="context">The wizard context instance.</param>
        public WelcomeInstallationControl(
            InstallerModel model,
            InstallerWizard context)
            : base(model, context)
        {
            InitializeComponent();

            DataModel.NextEnabled     = true;
            DataModel.InstallerAction = InstallerActionType.New;

            WizardContext.LoadPagesCheckpoint();
        }
Пример #33
0
        public WizardPageImportPreparationViewModel(Window owner, object view, WizardContext wizardContext,
                                                    SegmentBuilder segmentBuilder, PathInfo pathInfo) : base(owner, view, wizardContext)
        {
            _segmentBuilder = segmentBuilder;
            _pathInfo       = pathInfo;

            IsValid = true;
            InitializeJobProcessList();

            LoadPage  += OnLoadPage;
            LeavePage += OnLeavePage;
        }
Пример #34
0
        // Protected methods

        protected override void DoEntering(WizardContext context)
        {
            // Select the correct item in the combobox
            var index = comboKindOfWork.Items.IndexOf(context.KindOfWork ?? "");

            if (index < 0)
            {
                index = 0;
            }

            comboKindOfWork.SelectedIndex = index;
        }
Пример #35
0
        // Protected methods (BasePage)

        protected override void DoEntering(WizardContext context)
        {
            // Let's write a little summary of what the user has chosen
            var sb = new StringBuilder();

            sb.AppendLine("The wizard is finished! Here's the info that was entered:");
            sb.AppendLine();
            if (context.InfoSelection == InfoSelectionMode.Work)
                sb.AppendLine(string.Format("You described your work: {0}", context.KindOfWork));
            else if (context.InfoSelection == InfoSelectionMode.Family)
            {
                sb.AppendLine(string.Format("Your family consists of {0} adults and {1} children", context.AdultCount,
                                            context.ChildCount));
                if (!string.IsNullOrEmpty(context.FamilyPet))
                    sb.AppendLine(string.Format("You also have: {0}", context.FamilyPet));
            }

            tbSummary.Text = sb.ToString();
            tbSummary.SelectionStart = 0;
            tbSummary.SelectionLength = 0;
        }
Пример #36
0
 protected override void DoExiting(WizardContext context)
 {
     // Save the selected value
     context.KindOfWork = comboKindOfWork.Text;
 }
        // Methods (BasePage)

        protected override void DoEntering(WizardContext context)
        {
            // Read from context which radio button should be selected
            radioFamily.Checked = context.InfoSelection == InfoSelectionMode.Family;
            radioWork.Checked = context.InfoSelection == InfoSelectionMode.Work;
        }
Пример #38
0
 protected virtual void DoExiting(WizardContext context)
 {
     // No code here
 }
        // Protected methods (BasePage)

        protected override void DoEntering(WizardContext context)
        {
            comboAdults.SelectedIndex = comboAdults.Items.IndexOf(context.AdultCount.ToString());
            comboChildren.SelectedIndex = comboChildren.Items.IndexOf(context.ChildCount.ToString());
        }
 protected override void DoExiting(WizardContext context)
 {
     context.AdultCount = Convert.ToInt32(comboAdults.Text);
     context.ChildCount = Convert.ToInt32(comboChildren.Text);
 }