public SettingsWindowViewModel(Settings settings)
 {
     WorkingSettings = settings;
     AuxiliaryApplications = new ObservableCollection<AuxiliaryApplicationViewModel>();
     WorkingSettings.AuxiliaryApplications.ForEach(x => AuxiliaryApplications.Add(new AuxiliaryApplicationViewModel(x)));
     if (AuxiliaryApplications.Count > 0)
     {
         AuxiliaryApplications[0].IsExpanded = true;
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Save the settings file
        /// </summary>
        internal static void Save(Settings settings)
        {
            string filePath = GetSettingsFile();

            if (!Directory.Exists(Path.GetDirectoryName(filePath)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(filePath));
            }
            using (StreamWriter sw = new StreamWriter(filePath, false))
            {
                string rawSettings = settings.Serialize();
                sw.Write(rawSettings);
            }
        }
Exemplo n.º 3
0
 public SettingsWindowViewModel(Settings settings)
 {
     WorkingSettings = settings;
     AuxiliaryApplications = new ObservableCollection<AuxiliaryApplicationViewModel>();
     WorkingSettings.AuxiliaryApplications.ForEach(x =>
     {
         var auxApp = new AuxiliaryApplicationViewModel(x, this);
         auxApp.StartRequest += OnAuxAppStartRequest;
         auxApp.StopRequest += OnAuxAppStopRequest;
         auxApp.CheckRunningRequest += OnAuxAppCheckRunRequest;
         AuxiliaryApplications.Add(auxApp);
     });
     if (AuxiliaryApplications.Count > 0)
     {
         AuxiliaryApplications[0].IsExpanded = true;
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Load the settings from disk
 /// </summary>
 /// <returns></returns>
 public static Settings Load()
 {
     string filePath = GetSettingsFile();
     Settings settings = null;
     if (File.Exists(filePath))
     {
         using (StreamReader sr = new StreamReader(filePath))
         {
             string rawSettings = sr.ReadToEnd();
             settings = Settings.Deserialize(rawSettings);
         }
     }
     else
     {
         settings = new Settings();
         Save(settings);
     }
     return settings;
 }