private void Window1_Loaded(object sender, RoutedEventArgs e) { AeroGlassHelper.ExtendGlass(this, (int)windowContent.Margin.Left, (int)windowContent.Margin.Right, (int)windowContent.Margin.Top, (int)windowContent.Margin.Bottom); txtSSID.Text = Settings.Default.SSID; txtPassword.Text = Settings.Default.Password; // This line is for testing purposes //panelConnections.Children.Add(new PeerDevice(new ConnectedPeer() { MacAddress = "AA-22-33-EE-EE-FF" })); var args = System.Environment.GetCommandLineArgs(); var minarg = (from a in args where a.ToLowerInvariant().Contains("/min") select a).FirstOrDefault(); if (!string.IsNullOrEmpty(minarg)) { this.WindowState = WindowState.Minimized; this.ShowInTaskbar = false; } this.AddSystemMenuItems(); this.threadUpdateUI = new Thread(new ThreadStart(this.UpdateUIThread)); this.threadUpdateUI.Start(); this.Closed += new EventHandler(Window1_Closed); // Show System Tray Icon var stream = Application.GetResourceStream(new Uri("icons/virtualrouterdisabled.ico", UriKind.Relative)).Stream; var icon = new System.Drawing.Icon(stream); this.trayIcon = new WpfNotifyIcon(); this.trayIcon.Icon = icon; this.trayIcon.Show(); //this.trayIcon.Text = "Virtual Router (Disabled)"; this.trayIcon.Text = VirtualRouterClient.Properties.Resources.VDisabled; this.trayIcon.DoubleClick += new EventHandler(trayIcon_DoubleClick); var trayMenu = new System.Windows.Forms.ContextMenuStrip(); //trayMenu.Items.Add("&Manage Virtual Router...", null, new EventHandler(this.TrayIcon_Menu_Manage)); trayMenu.Items.Add(VirtualRouterClient.Properties.Resources.Manage, null, new EventHandler(this.TrayIcon_Menu_Manage)); trayMenu.Items.Add(new System.Windows.Forms.ToolStripSeparator()); //trayMenu.Items.Add("Check for &Updates...", null, new EventHandler(this.TrayIcon_Menu_Update)); trayMenu.Items.Add(VirtualRouterClient.Properties.Resources.Updates, null, new EventHandler(this.TrayIcon_Menu_Update)); //trayMenu.Items.Add("&About...", null, new EventHandler(this.TrayIcon_Menu_About)); trayMenu.Items.Add(VirtualRouterClient.Properties.Resources.About, null, new EventHandler(this.TrayIcon_Menu_About)); this.trayIcon.ContextMenuStrip = trayMenu; this.StateChanged += new EventHandler(WindowMain_StateChanged); UpdateDisplay(); }
private void Window1_Loaded(object sender, RoutedEventArgs e) { AeroGlassHelper.ExtendGlass(this, (int)windowContent.Margin.Left, (int)windowContent.Margin.Right, (int)windowContent.Margin.Top, (int)windowContent.Margin.Bottom); txtSSID.Text = Settings.Default.SSID; txtPassword.Text = Settings.Default.Password; // This line is for testing purposes //panelConnections.Children.Add(new PeerDevice(new ConnectedPeer() { MacAddress = "AA-22-33-EE-EE-FF" })); var args = System.Environment.GetCommandLineArgs(); var minarg = (from a in args where a.ToLowerInvariant().Contains("/min") select a).FirstOrDefault(); if (!string.IsNullOrEmpty(minarg)) { this.WindowState = WindowState.Minimized; this.ShowInTaskbar = false; } this.AddSystemMenuItems(); this.threadUpdateUI = new Thread(new ThreadStart(this.UpdateUIThread)); this.threadUpdateUI.Start(); this.Closed += new EventHandler(Window1_Closed); // Show System Tray Icon var stream = Application.GetResourceStream(new Uri("icons/virtualrouterdisabled.ico", UriKind.Relative)).Stream; var icon = new System.Drawing.Icon(stream); this.trayIcon = new WpfNotifyIcon(); this.trayIcon.Icon = icon; this.trayIcon.Show(); //this.trayIcon.Text = "Virtual Router (Disabled)"; this.trayIcon.Text = VirtualRouterClient.Properties.Resources.VDisabled; this.trayIcon.DoubleClick += new EventHandler(trayIcon_DoubleClick); var trayMenu = new System.Windows.Forms.ContextMenuStrip(); //trayMenu.Items.Add("&Manage Virtual Router...", null, new EventHandler(this.TrayIcon_Menu_Manage)); trayMenu.Items.Add(VirtualRouterClient.Properties.Resources.Manage, null, new EventHandler(this.TrayIcon_Menu_Manage)); trayMenu.Items.Add(new System.Windows.Forms.ToolStripSeparator()); //trayMenu.Items.Add("Check for &Updates...", null, new EventHandler(this.TrayIcon_Menu_Update)); trayMenu.Items.Add(VirtualRouterClient.Properties.Resources.Updates, null, new EventHandler(this.TrayIcon_Menu_Update)); //trayMenu.Items.Add("&About...", null, new EventHandler(this.TrayIcon_Menu_About)); trayMenu.Items.Add(VirtualRouterClient.Properties.Resources.About, null, new EventHandler(this.TrayIcon_Menu_About)); this.trayIcon.ContextMenuStrip = trayMenu; this.StateChanged += new EventHandler(WindowMain_StateChanged); UpdateDisplay(); }