Example #1
0
        private static string dictWriteTimeStr; // время записи в файлы словарей

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Конструктор
        /// </summary>
        static AppData()
        {
            dictWriteTimeStr = "";
            Inited = false;
            Log = new Log(Log.Formats.Full);
            LogFileName = DefLogFileName;
            MainData = new MainData();
            WebSettings = new WebSettings();
        }
Example #2
0
        /// <summary>
        /// Конструктор
        /// </summary>
        public FrmMain()
        {
            InitializeComponent();

            exeDir = "";
            configDir = "";
            webAppDir = "";
            commSettings = new CommSettings();
            webSettings = new WebSettings();
            viewSettings = new ViewSettings();
            regKey = "";

            loadedCommSettings = null;
            loadedWebSettings = null;
            loadedViewSettings = null;
            loadedRegKey = "";

            commSettingsChanged = false;
            webSettingsChanged = false;
            viewSettingsChanged = false;
            regKeyChanged = false;
            showing = false;

            selViewSet = null;
            selViewInfo = null;
        }
Example #3
0
        /// <summary>
        /// Загрузить настройки из файлов
        /// </summary>
        private void LoadSettings()
        {
            StringBuilder sbErr = new StringBuilder();
            string errMsg;

            SetSettingsUnchanged();

            // загрузка настроек соединения
            if (!commSettings.LoadFromFile(configDir + CommSettings.DefFileName, out errMsg))
                sbErr.AppendLine(errMsg);

            // загрузка настроек отображения
            if (!webSettings.LoadFromFile(configDir + WebSettings.DefFileName, out errMsg))
                sbErr.AppendLine(errMsg);

            // загрузка настроек представлений
            if (!viewSettings.LoadFromFile(configDir + ViewSettings.DefFileName, out errMsg))
                sbErr.AppendLine(errMsg);

            // отображение настроек
            SettingsToControls();

            if (sbErr.Length > 0)
                ScadaUtils.ShowError(sbErr.ToString().TrimEnd());

            loadedCommSettings = commSettings.Clone();
            loadedWebSettings = webSettings.Clone();
            loadedViewSettings = viewSettings.Clone();
            loadedRegKey = regKey;
        }
Example #4
0
        /// <summary>
        /// Сохранить настройки в файлах
        /// </summary>
        private void SaveSettings()
        {
            StringBuilder sbErr = new StringBuilder();
            string errMsg;

            // сохранение настроек доступа к данным
            if (commSettingsChanged && !commSettings.SaveToFile(configDir + CommSettings.DefFileName, out errMsg))
                sbErr.AppendLine(errMsg);

            // сохранение настроек отображения
            if (webSettingsChanged && !webSettings.SaveToFile(configDir + WebSettings.DefFileName, out errMsg))
                sbErr.AppendLine(errMsg);

            // сохранение настроек представлений
            if (viewSettingsChanged && !viewSettings.SaveToFile(configDir + ViewSettings.DefFileName, out errMsg))
                sbErr.AppendLine(errMsg);

            if (sbErr.Length > 0)
            {
                ScadaUtils.ShowError(sbErr.ToString().TrimEnd());
            }
            else
            {
                SetSettingsUnchanged();
                loadedCommSettings = commSettings.Clone();
                loadedWebSettings = webSettings.Clone();
                loadedViewSettings = viewSettings.Clone();
                loadedRegKey = regKey;
            }
        }
Example #5
0
 /// <summary>
 /// Создать копию настроек веб-приложения
 /// </summary>
 public WebSettings Clone()
 {
     WebSettings webSettings = new WebSettings();
     webSettings.SrezRefrFreq = SrezRefrFreq;
     webSettings.EventCnt = EventCnt;
     webSettings.EventRefrFreq = EventRefrFreq;
     webSettings.EventFltr = EventFltr;
     webSettings.DiagBreak = DiagBreak;
     webSettings.CmdEnabled = CmdEnabled;
     return webSettings;
 }