Пример #1
0
 private void SetMainWindowSettingsValues(XElement root)
 {
     try
     {
         var node = root.Element("MainWindowSettings");
         MainWindowSettings.SetValues(node);
     }
     catch
     {
         MainWindowSettings = new MainWindowSettings();
     }
 }
Пример #2
0
        public void Shutdown()
        {
            if (!Directory.Exists(settingsPath))
            {
                Directory.CreateDirectory(settingsPath);
            }

            var xml = new XElement("root");

            xml.Add(AppSettings.GetXML());
            xml.Add(LogsViewSettings.GetXML());
            xml.Add(ScreenshotsViewSettings.GetXML());
            xml.Add(DaysViewSettings.GetXML());
            xml.Add(MainWindowSettings.GetXML());

            xml.Save(Path.Combine(settingsPath, SETTINGS_FILE_NAME), SaveOptions.None);
        }
Пример #3
0
        public void Initialize()
        {
            LimitsSettings          = new LimitsSettings();
            AppSettings             = new AppSettings();
            LogsViewSettings        = new LogsViewSettings();
            ScreenshotsViewSettings = new ScreenshotsViewSettings();
            DaysViewSettings        = new DaysViewSettings();
            MainWindowSettings      = new MainWindowSettings();

            if (!File.Exists(Path.Combine(settingsPath, SETTINGS_FILE_NAME)))
            {
                return;
            }

            var xml  = XDocument.Load(Path.Combine(settingsPath, SETTINGS_FILE_NAME));
            var root = xml.Element("root");

            SetAppSettingsValues(root);
            SetLogsViewSettingsValues(root);
            SetScreenshotViewSettingsValues(root);
            SetDaysViewSettingsValues(root);
            SetMainWindowSettingsValues(root);
        }