예제 #1
0
        private void frmMain_Loaded(object sender, RoutedEventArgs e)
        {
            // Upgrade settings
            if (Settings.Default.UpdateSettings)
            {
                Settings.Default.Upgrade();
                Settings.Default.UpdateSettings = false;
                Settings.Default.Save();
            }

            // Load the schedule
            if (!IsValidJson(Settings.Default.Schedule))
            {
                mashSchedule              = new MashSchedule();
                mashSchedule.Updated      = DateTimeOffset.Now;
                mashSchedule.Apps         = new List <MashApp>();
                Settings.Default.Schedule = mashSchedule.ToJson();
                Settings.Default.Enabled  = false;
                Settings.Default.Save();
            }
            ReloadSchedule();

            // Populate the version information
            string[] versionParts = Assembly.GetExecutingAssembly().GetName().Version.ToString().Split('.');
            labVersion.Content = string.Format("{0}.{1}.{2}", versionParts[0], versionParts[1], versionParts[2]);

            Stream       stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("MaSH.Resources.BuildDate.txt");
            StreamReader sr     = new StreamReader(stream);

            labBuildDate.Content = Convert.ToDateTime(sr.ReadToEnd()).ToLongDateString();

            radYes.IsChecked = Settings.Default.Enabled;
            radNo.IsChecked  = !Settings.Default.Enabled;
            StartupWithWindows();
        }
예제 #2
0
 private void SaveAndReloadSchedule()
 {
     mashSchedule.Updated      = DateTimeOffset.Now;
     Settings.Default.Schedule = mashSchedule.ToJson();
     Settings.Default.Save();
     ReloadSchedule();
 }