Example #1
0
 public static void Add(VisualCue config)
 {
     lock (AllConfigs)
     {
         AllConfigs.Add(config);
     }
 }
Example #2
0
        void RemoveSetting()
        {
            var result = MessageBox.Show("Вы уверенны что хотите удалить настройку " + CurrentConfig.DisplayName + " ?",
                                         "Удаление настройки",
                                         MessageBoxButton.YesNo);

            if (result == MessageBoxResult.Yes)
            {
                AllConfigs.Remove(CurrentConfig);
                _serviceSA1C.config.basesConfig.Remove(CurrentConfig.baseConfig);
                _serviceSA1C.SaveSettings();
            }
        }
Example #3
0
        //public static void Remove(string uniqueID)
        //    => Remove(AllConfigs.FindIndex(x => x.UniqueID.Equals(uniqueID)));

        public static void Remove(int index)
        {
            lock (AllConfigs)
            {
                var count = AllConfigs.Count;
                if (count > 0 && index > 0 && count < index)
                {
                    AllConfigs.RemoveAt(index);
                }
            }
            var exMsg = $"Index {index} out of range for {nameof(AllConfigs)} with {AllConfigs.Count} items.";

            throw new IndexOutOfRangeException(exMsg);
        }
Example #4
0
        public void readConfigFile(string configFilePath)
        {
            ConfigFileDao configDao = new ConfigFileDao(configFilePath);

            try
            {
                AllConfigs = configDao.getAllValues();
            }
            catch (System.IO.FileNotFoundException)
            {
                return;
            }

            if (!AllConfigs.ContainsKey(ConfigFileConstants.PRIMARY_CONFIG_SECTION))
            {
                throw new MdoException("Invalid configuration file! Unable to continue...");
            }

            if (AllConfigs.ContainsKey(ConfigFileConstants.SQL_CONFIG_SECTION))
            {
                AbstractSqlConfiguration primarySqlConfig = new MsSqlConfiguration(AllConfigs[ConfigFileConstants.SQL_CONFIG_SECTION]);
                SqlConnectionString = primarySqlConfig.buildConnectionString();
                SqlConfiguration    = primarySqlConfig;
            }

            if (AllConfigs.ContainsKey(ConfigFileConstants.BSE_CONFIG_SECTION))
            {
                AbstractSqlConfiguration bseSqlConfig = new MsSqlConfiguration(AllConfigs[ConfigFileConstants.BSE_CONFIG_SECTION]);
                BseValidatorConnectionString = bseSqlConfig.buildConnectionString();
            }
            else
            {
                BseValidatorConnectionString = SqlConnectionString; // use SQL connection string if separate BSE string isn't found
            }

            if (AllConfigs.ContainsKey(ConfigFileConstants.ADR_CONFIG_SECTION))
            {
                if (AllConfigs[ConfigFileConstants.ADR_CONFIG_SECTION].ContainsKey(ConfigFileConstants.CONNECTION_STRING))
                {
                    AbstractSqlConfiguration config = new OracleConfiguration
                                                          (AllConfigs[ConfigFileConstants.ADR_CONFIG_SECTION][ConfigFileConstants.CONNECTION_STRING]);
                    AdrConnectionString = config.ConnectionString;
                }
            }

            if (AllConfigs.ContainsKey(ConfigFileConstants.MHV_CONFIG_SECTION))
            {
                if (AllConfigs[ConfigFileConstants.MHV_CONFIG_SECTION].ContainsKey(ConfigFileConstants.CONNECTION_STRING))
                {
                    AbstractSqlConfiguration config = new OracleConfiguration
                                                          (AllConfigs[ConfigFileConstants.MHV_CONFIG_SECTION][ConfigFileConstants.CONNECTION_STRING]);
                    MhvConnectionString = config.ConnectionString;
                }
            }

            if (AllConfigs.ContainsKey(ConfigFileConstants.VADIR_CONFIG_SECTION))
            {
                if (AllConfigs[ConfigFileConstants.VADIR_CONFIG_SECTION].ContainsKey(ConfigFileConstants.CONNECTION_STRING))
                {
                    AbstractSqlConfiguration config = new OracleConfiguration
                                                          (AllConfigs[ConfigFileConstants.VADIR_CONFIG_SECTION][ConfigFileConstants.CONNECTION_STRING]);
                    VadirConnectionString = config.ConnectionString;
                }
            }

            if (AllConfigs.ContainsKey(ConfigFileConstants.VBA_CORP_CONFIG_SECTION))
            {
                if (AllConfigs[ConfigFileConstants.VBA_CORP_CONFIG_SECTION].ContainsKey(ConfigFileConstants.CONNECTION_STRING))
                {
                    AbstractSqlConfiguration config = new OracleConfiguration
                                                          (AllConfigs[ConfigFileConstants.VBA_CORP_CONFIG_SECTION][ConfigFileConstants.CONNECTION_STRING]);
                    VbaCorpConnectionString = config.ConnectionString;
                }
            }

            if (AllConfigs.ContainsKey(ConfigFileConstants.NPT_CONFIG_SECTION))
            {
                if (AllConfigs[ConfigFileConstants.NPT_CONFIG_SECTION].ContainsKey(ConfigFileConstants.CONNECTION_STRING))
                {
                    AbstractSqlConfiguration config = new MsSqlConfiguration
                                                          (AllConfigs[ConfigFileConstants.NPT_CONFIG_SECTION][ConfigFileConstants.CONNECTION_STRING]);
                    NptConnectionString = config.ConnectionString;
                }
            }

            if (AllConfigs.ContainsKey(ConfigFileConstants.CDW_CONFIG_SECTION))
            {
                if (AllConfigs[ConfigFileConstants.CDW_CONFIG_SECTION].ContainsKey(ConfigFileConstants.CONNECTION_STRING))
                {
                    AbstractSqlConfiguration config = new MsSqlConfiguration
                                                          (AllConfigs[ConfigFileConstants.CDW_CONFIG_SECTION][ConfigFileConstants.CONNECTION_STRING]);
                    CdwConnectionString = config.ConnectionString;
                }
            }

            if (AllConfigs.ContainsKey(ConfigFileConstants.MOS_CONFIG_SECTION))
            {
                if (AllConfigs[ConfigFileConstants.MOS_CONFIG_SECTION].ContainsKey(ConfigFileConstants.CONNECTION_STRING))
                {
                    AbstractSqlConfiguration config = new OracleConfiguration
                                                          (AllConfigs[ConfigFileConstants.MOS_CONFIG_SECTION][ConfigFileConstants.CONNECTION_STRING]);
                    MosConnectionString = config.ConnectionString;
                }
            }
        }
Example #5
0
 void OnAddConfig(object sender, AddConfigEventArgs e)
 {
     AllConfigs.Add(new BaseConfigViewModel(this, e.baseConfig, _serviceSA1C));
 }