// Initialize the application public MainWindow() { // Initialize app InitializeComponent(); new ShortcutHelper(APP_ID).InitShortcut(); toaster = new Toaster(APP_ID); reader = new Reader(); /* Load settings */ // Interval intervalSlider.Value = Properties.Settings.Default.Interval; intervalLabel.Content = String.Format("Every {0} minute(s)", (int)intervalSlider.Value); // Stats totalShown.Content = String.Format("Total items shown: {0}", Properties.Settings.Default.StatsTotalShown); totalUptime.Content = String.Format("Total uptime: {0}", String.Format("{0:hh\\:mm\\:ss}", TimeSpan.FromSeconds(Properties.Settings.Default.StatsUptime))); // Files loadLocalFiles.SetCurrentValue( System.Windows.Controls.CheckBox.IsCheckedProperty, Properties.Settings.Default.LoadLocalFiles); if (Properties.Settings.Default.LoadLocalFiles) { reader.LoadPath(); } // Load files if (Properties.Settings.Default.Files != null) { foreach (String file in Properties.Settings.Default.Files) { // Load items reader.LoadFile(file); // Update file list ListBoxItem item = new ListBoxItem(); item.Content = file; fileList.Items.Add(item); } } else { Properties.Settings.Default.Files = new System.Collections.Specialized.StringCollection(); Properties.Settings.Default.Save(); } // Hotkeys HotkeyManager.Current.AddOrReplace("Increment", Keys.Control | Keys.Alt | Keys.S, ShowToast); // Windows settings WindowState = WindowState.Minimized; ShowInTaskbar = false; // Show tray icon System.Windows.Forms.NotifyIcon ni = new System.Windows.Forms.NotifyIcon(); ni.Icon = new System.Drawing.Icon(Path.GetFullPath("Resources/Schedule.ico")); ni.Visible = true; ni.DoubleClick += delegate (object sender, EventArgs args) { this.Show(); this.WindowState = WindowState.Normal; }; // Initialize timer timer = new DispatcherTimer(); timer.Tick += ShowToast; timer.Interval = new TimeSpan( 0, // hours Properties.Settings.Default.Interval, // minutes 0); // seconds timer.Start(); }
// Initialize the application public MainWindow() { // Initialize app InitializeComponent(); new ShortcutHelper(APP_ID).InitShortcut(); toaster = new Toaster(APP_ID); reader = new Reader(); /* Load settings */ // Interval intervalSlider.Value = Properties.Settings.Default.Interval; intervalLabel.Content = String.Format("Every {0} minute(s)", (int)intervalSlider.Value); // Stats totalShown.Content = String.Format("Total items shown: {0}", Properties.Settings.Default.StatsTotalShown); totalUptime.Content = String.Format("Total uptime: {0}", String.Format("{0:hh\\:mm\\:ss}", TimeSpan.FromSeconds(Properties.Settings.Default.StatsUptime))); // Files loadLocalFiles.SetCurrentValue( System.Windows.Controls.CheckBox.IsCheckedProperty, Properties.Settings.Default.LoadLocalFiles); if (Properties.Settings.Default.LoadLocalFiles) { reader.LoadPath(); } // Load files if (Properties.Settings.Default.Files != null) { foreach (String file in Properties.Settings.Default.Files) { // Load items reader.LoadFile(file); // Update file list ListBoxItem item = new ListBoxItem(); item.Content = file; fileList.Items.Add(item); } } else { Properties.Settings.Default.Files = new System.Collections.Specialized.StringCollection(); Properties.Settings.Default.Save(); } // Hotkeys HotkeyManager.Current.AddOrReplace("Increment", Keys.Control | Keys.Alt | Keys.S, ShowToast); // Windows settings WindowState = WindowState.Minimized; ShowInTaskbar = false; // Show tray icon System.Windows.Forms.NotifyIcon ni = new System.Windows.Forms.NotifyIcon(); ni.Icon = new System.Drawing.Icon(Path.GetFullPath("Resources/Schedule.ico")); ni.Visible = true; ni.DoubleClick += delegate(object sender, EventArgs args) { this.Show(); this.WindowState = WindowState.Normal; }; // Initialize timer timer = new DispatcherTimer(); timer.Tick += ShowToast; timer.Interval = new TimeSpan( 0, // hours Properties.Settings.Default.Interval, // minutes 0); // seconds timer.Start(); }