public ApplicationContext() { if (Properties.Settings.Default.CallUpgrade) { Properties.Settings.Default.Upgrade(); Properties.Settings.Default.CallUpgrade = false; Properties.Settings.Default.Save(); } _components = new System.ComponentModel.Container(); _notifyIcon = new NotifyIcon(_components) { ContextMenuStrip = new ContextMenuStrip(), Visible = true }; _notifyIcon.ContextMenuStrip.Items.Add(new ToolStripMenuItem("Settings", null, new EventHandler(MenuSettingsItem_Click))); _notifyIcon.ContextMenuStrip.Items.Add(new ToolStripMenuItem("Exit", null, new EventHandler(MenuExitItem_Click))); _buddies = new Buddies(); _housekeepingTimer = new System.Windows.Forms.Timer(); _housekeepingTimer.Interval = 5000; _housekeepingTimer.Tick += HousekeepingTimer_Tick; HousekeepingTimer_Tick(null, null); // tick anyway enables timer when finished _trackerStatus = TrackerStatus.OK; if (trackersConfigured()) { _trackerStatus = TrackerStatus.UNKNOWN; UpdateTrackerSetting(); } _viewModel = new ViewModel(_buddies); }
//[DllImport("user32.dll", SetLastError = true)] //public static extern bool SetWindowText(IntPtr hwnd, String lpString); public ApplicationContext() { if (Properties.Settings.Default.CallUpgrade) { Properties.Settings.Default.Upgrade(); Properties.Settings.Default.CallUpgrade = false; Properties.Settings.Default.Save(); } _components = new System.ComponentModel.Container(); _notifyIcon = new NotifyIcon(_components) { ContextMenuStrip = new ContextMenuStrip(), Visible = true }; _notifyIcon.ContextMenuStrip.Items.Add(new ToolStripMenuItem("Settings", null, new EventHandler(MenuSettingsItem_Click))); _notifyIcon.ContextMenuStrip.Items.Add(new ToolStripMenuItem("Exit", null, new EventHandler(MenuExitItem_Click))); //FieldInfo fieldInfo = _notifyIcon.GetType().GetField("window", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance); //NativeWindow nativeWindow = (NativeWindow)fieldInfo.GetValue(_notifyIcon); //if (nativeWindow.Handle != IntPtr.Zero) // SetWindowText(nativeWindow.Handle, "Amazing!"); _buddies = new Buddies(); HousekeepingTimer = new System.Timers.Timer(); HousekeepingTimer.Interval = 3000; HousekeepingTimer.Elapsed += new System.Timers.ElapsedEventHandler(HousekeepingTimer_Elapsed); HousekeepingTimer.Start(); HousekeepingTimer_Elapsed(null, null); }
public ApplicationContext() { if (Properties.Settings.Default.CallUpgrade) { Properties.Settings.Default.Upgrade(); Properties.Settings.Default.CallUpgrade = false; Properties.Settings.Default.Save(); } _components = new System.ComponentModel.Container(); _notifyIcon = new NotifyIcon(_components) { ContextMenuStrip = new ContextMenuStrip(), Visible = true }; _notifyIcon.ContextMenuStrip.Items.Add(new ToolStripMenuItem("Settings", null, new EventHandler(MenuSettingsItem_Click))); _notifyIcon.ContextMenuStrip.Items.Add(new ToolStripMenuItem("Exit", null, new EventHandler(MenuExitItem_Click))); _buddies = new Buddies(); _housekeepingTimer = new System.Windows.Forms.Timer(); _housekeepingTimer.Interval = 5000; _housekeepingTimer.Tick += HousekeepingTimer_Tick; HousekeepingTimer_Tick(null, null); // tick anyway enables timer when finished }
public ViewModel(Buddies buddies) { _buddies = buddies; }