public static void Init() { if (nIcon != null) { throw new Exception("systray can only init once"); } viewModel = new SystrayViewModel(); InitIcon(); CreateContextMenu(); UpdateContextMenuChecks(); UpdateAvailablePorts(); nIcon.Visible = true; RemoteSerialListener.AvailableComPortsChanged += UpdateAvailablePorts; }
private async void ComPort_Click(object sender, RoutedEventArgs e) { string selectedString = (sender as System.Windows.Controls.MenuItem)?.DataContext as string; bool result = await SystrayViewModel.SelectPort(selectedString); if (!result) { notifyIcon.ShowBalloonTip("Meh", $"{selectedString} is not an IR receiver", Hardcodet.Wpf.TaskbarNotification.BalloonIcon.None); } else { notifyIcon.ShowBalloonTip("Yay", $"{selectedString} connected succesfully", Hardcodet.Wpf.TaskbarNotification.BalloonIcon.None); } }
private void Autodetect_Click(object sender, RoutedEventArgs e) { SystrayViewModel.SetAutoDetect(this.AutoDetectMenuItem.IsChecked); }
private void WindowsStartup_Click(object sender, RoutedEventArgs e) { SystrayViewModel.SetAutoLaunch(this.AutoLaunchMenuItem.IsChecked); }