コード例 #1
0
        public void Open(string filename)
        {
            XmlConfigFile         existingModel   = this.Model;
            UnitTestFileViewModel existingUTModel = this.UnitTestFile;

            try
            {
                ActiveConfig.DB.CanCache = true;
                AcmaSchemaAttribute.MissingAttributeEvent += AcmaSchemaAttribute_MissingAttributeEvent;
                UINotifyPropertyChanges.BeginIgnoreAllChanges();
                this.Model        = ActiveConfig.LoadXml(filename);
                this.unitTestFile = TestEngine.UnitTestFile.LoadXml(this.FileName);
                this.ReloadRootNodes();
                this.ResetChangeState();
            }
            catch
            {
                this.Model        = existingModel;
                this.UnitTestFile = existingUTModel;
                throw;
            }
            finally
            {
                UINotifyPropertyChanges.EndIgnoreAllChanges();
                this.RaisePropertyChanged("DisplayName");
                this.RaisePropertyChanged("ChildNodes");
                AcmaSchemaAttribute.ClearLostFoundCache();
                AcmaSchemaAttribute.MissingAttributeEvent -= AcmaSchemaAttribute_MissingAttributeEvent;
                ActiveConfig.DB.CanCache = false;
            }
        }
コード例 #2
0
        public MainWindowViewModel()
            : base()
        {
            UINotifyPropertyChanges.BeginIgnoreAllChanges();
            ViewModelBase.GlobalIconProvider = new Lithnet.Acma.Presentation.IconProvider();
            this.PopulateIgnoreViewModelChanges();
            this.AddDependentPropertyNotification("ViewModelIsDirty", "DisplayName");

            this.IgnorePropertyHasChanged.Add("DisplayName");
            this.IgnorePropertyHasChanged.Add("MRUItems");
            this.IgnorePropertyHasChanged.Add("ChildNodes");
            this.IgnorePropertyHasChanged.Add("Database");
            this.IgnorePropertyHasChanged.Add("XmlConfigFile");
            this.IgnorePropertyHasChanged.Add("ViewModelIsDirty");

            this.ConnectToDatabase(true);

            string[] commandLineArgs = Environment.GetCommandLineArgs();
            string   openFile        = null;

            if (commandLineArgs != null)
            {
                if (commandLineArgs.Length >= 2)
                {
                    openFile = commandLineArgs[1];
                }
            }

            this.XmlConfigFile = new XmlConfigFileViewModel();

            if (openFile != null)
            {
                if (System.IO.File.Exists(openFile))
                {
                    this.XmlConfigFile.Open(openFile);
                }
            }

            this.XmlConfigFile.PropertyChanged += XmlConfigFile_PropertyChanged;

            this.Commands.AddItem("New", x => this.New());
            this.Commands.AddItem("Open", x => this.Open());
            this.Commands.AddItem("Save", x => this.Save(), x => this.CanSave());
            this.Commands.AddItem("SaveAs", x => this.SaveAs(), x => this.CanSave());
            this.Commands.AddItem("ExportAsDocX", x => this.ExportConfigAsDocX(), x => this.CanExportConfigAsDocX());
            this.Commands.AddItem("ExportUnitTestAsDocX", x => this.ExportConfigAsDocX(), x => this.CanExportConfigAsDocX());
            this.Commands.AddItem("Close", x => this.Close());

            this.Database.IsExpanded                = true;
            this.XmlConfigFile.IsExpanded           = true;
            ViewModelBase.ViewModelChanged         += ViewModelBase_ViewModelChanged;
            Application.Current.MainWindow.Closing += new CancelEventHandler(MainWindow_Closing);
            UINotifyPropertyChanges.EndIgnoreAllChanges();

            //Restore TreeWidth from registry value or use default of 325
            int intTreeWidth = Convert.ToInt32(RegistrySettings.GetValue("TreeWidth", "325"));

            TreeWidth = intTreeWidth.ToString();
        }
コード例 #3
0
        public ImportTests()
        {
            UINotifyPropertyChanges.BeginIgnoreAllChanges();
            MAExtensionObject re = new MAExtensionObject();

            this.re             = re;
            this.rulesExtension = re;
        }
コード例 #4
0
        public XmlConfigFileViewModel()
            : base()
        {
            UINotifyPropertyChanges.BeginIgnoreAllChanges();
            this.Model = new XmlConfigFile();

            this.TransformCollectionViewModel      = new TransformCollectionViewModel(this.Model.Transforms);
            this.FlowRulesAliasCollectionViewModel = new FlowRuleAliasCollectionViewModel(this.Model.FlowRuleAliases);
            this.MAOperationsViewModel             = new Presentation.MAOperationsViewModel(this.Model.MAOperations);
            UINotifyPropertyChanges.EndIgnoreAllChanges();

            this.ResetChangeState();
        }
コード例 #5
0
        public void New()
        {
            UINotifyPropertyChanges.BeginIgnoreAllChanges();
            this.Model = new XmlConfigFile();
            this.TransformCollectionViewModel      = new Transforms.Presentation.TransformCollectionViewModel(this.Model.Transforms);
            this.FlowRulesAliasCollectionViewModel = new FlowRuleAliasCollectionViewModel(this.Model.FlowRuleAliases);
            this.MAOperationsViewModel             = new Presentation.MAOperationsViewModel(this.Model.MAOperations);
            UINotifyPropertyChanges.EndIgnoreAllChanges();

            this.RaisePropertyChanged("DisplayName");
            this.RaisePropertyChanged("ChildNodes");
            this.IsExpanded = true;
            this.ResetChangeState();
        }
コード例 #6
0
        public void New()
        {
            ActiveConfig.DB.CanCache = true;
            UINotifyPropertyChanges.BeginIgnoreAllChanges();
            UniqueIDCache.ClearIdCache();
            this.Model             = new XmlConfigFile();
            this.unitTestFile      = new TestEngine.UnitTestFile();
            ActiveConfig.XmlConfig = this.Model;
            UINotifyPropertyChanges.EndIgnoreAllChanges();
            this.ReloadRootNodes();

            this.RaisePropertyChanged("DisplayName");
            this.RaisePropertyChanged("ChildNodes");
            this.ResetChangeState();
            ActiveConfig.DB.CanCache = false;
        }
コード例 #7
0
ファイル: MainWindowViewModel.cs プロジェクト: sean-m/umare
        public MainWindowViewModel()
        {
            UINotifyPropertyChanges.BeginIgnoreAllChanges();
            ViewModelBase.GlobalIconProvider = new IconProvider();
            this.AddDependentPropertyNotification("ViewModelIsDirty", "DisplayName");

            this.IgnorePropertyHasChanged.Add("DisplayName");
            this.IgnorePropertyHasChanged.Add("MRUItems");
            this.IgnorePropertyHasChanged.Add("ChildNodes");
            this.IgnorePropertyHasChanged.Add("Database");
            this.IgnorePropertyHasChanged.Add("XmlConfigFile");
            this.IgnorePropertyHasChanged.Add("ViewModelIsDirty");

            string[] commandLineArgs = Environment.GetCommandLineArgs();
            string   openFile        = null;

            if (commandLineArgs != null)
            {
                if (commandLineArgs.Length >= 2)
                {
                    openFile = commandLineArgs[1];
                }
            }

            this.XmlConfigFile = new XmlConfigFileViewModel();

            if (openFile != null)
            {
                if (System.IO.File.Exists(openFile))
                {
                    this.XmlConfigFile.Open(openFile);
                }
            }

            this.XmlConfigFile.PropertyChanged += XmlConfigFile_PropertyChanged;

            this.Commands.AddItem("New", x => this.New());
            this.Commands.AddItem("Open", x => this.Open());
            this.Commands.AddItem("Save", x => this.Save(), x => this.CanSave());
            this.Commands.AddItem("SaveAs", x => this.SaveAs(), x => this.CanSave());
            this.Commands.AddItem("Close", x => this.Close());

            this.XmlConfigFile.IsExpanded           = true;
            ViewModelBase.ViewModelChanged         += ViewModelBase_ViewModelChanged;
            Application.Current.MainWindow.Closing += new CancelEventHandler(MainWindow_Closing);
            UINotifyPropertyChanges.EndIgnoreAllChanges();
        }