Exemple #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;
            }
        }
Exemple #2
0
        private void LoadConfiguration()
        {
            if (this.ConfigFile == null)
            {
                throw new ConfigurationErrorsException("No configuration file was specified in the service config file");
            }

            if (!System.IO.File.Exists(this.ConfigFile))
            {
                throw new FileNotFoundException(string.Format("The configuration file '{0}' could not be found. Ensure the file is accessible by the service and the path specified in the app.config file is correct", this.ConfigFile));
            }

            ActiveConfig.LoadXml(this.ConfigFile);
            this.configUpdateQueued = false;
            Logger.WriteLine("Loaded configuration from {0}", this.ConfigFile);
        }
        protected void Connect(string database, string server, string configFile, bool manualConnection)
        {
            ActiveConfig.OpenDatabase(server, database);

            if (configFile != null)
            {
                ActiveConfig.LoadXml(configFile);
            }
            else
            {
                ActiveConfig.XmlConfig = new XmlConfigFile();
            }

            Global.Connected = true;

            ActiveConfig.DB.CanCache = true;

            if (manualConnection)
            {
                AcmaCmdletConnected.isManuallyConnected = true;
                AcmaCmdletConnected.isAutoConnected     = false;
            }
        }