public WindowMain() { InitializeComponent(); ui = (WindowMainModel)base.DataContext; var appName = ((AssemblyTitleAttribute)Attribute.GetCustomAttribute( Assembly.GetExecutingAssembly(), typeof(AssemblyTitleAttribute), false)) .Title; Title = appName; contextMenuStrip.Items.AddRange(new Forms.ToolStripItem[] { new Forms.ToolStripMenuItem(appName, null, new EventHandler(OnMenuOpen), null), new Forms.ToolStripSeparator(), new Forms.ToolStripMenuItem(Properties.Resources.Start, null, new EventHandler(OnMenuStart), null), new Forms.ToolStripMenuItem(Properties.Resources.Stop, null, new EventHandler(OnMenuStop), null), new Forms.ToolStripSeparator(), new Forms.ToolStripMenuItem(Properties.Resources.Exit, null, new EventHandler(OnMenuExit), null) }); var font = new Font(contextMenuStrip.Items[0].Font, System.Drawing.FontStyle.Bold); contextMenuStrip.Items[0].Font = font; MenuState(true); notifyIcon = new System.Windows.Forms.NotifyIcon(); notifyIcon.Icon = System.Drawing.Icon.ExtractAssociatedIcon( Assembly.GetEntryAssembly().ManifestModule.Name); notifyIcon.Visible = true; notifyIcon.BalloonTipTitle = appName; notifyIcon.ContextMenuStrip = contextMenuStrip; notifyIcon.DoubleClick += new EventHandler(OnMenuOpen); notifyIcon.BalloonTipClicked += new EventHandler(OnMenuOpen); ServerStart(); if (Properties.Settings.Default.StartupGps) { GpsStart(); } if (Properties.Settings.Default.StartupMinimised) { MinimiseToTray(); } }
public WindowMain() { InitializeComponent(); ui = (WindowMainModel)base.DataContext; var appName = ((AssemblyTitleAttribute)Attribute.GetCustomAttribute( Assembly.GetExecutingAssembly(), typeof(AssemblyTitleAttribute), false)) .Title; Title = appName; contextMenuStrip.Items.AddRange(new Forms.ToolStripItem[] { new Forms.ToolStripMenuItem(appName, null, new EventHandler(OnMenuOpen), null), new Forms.ToolStripSeparator(), new Forms.ToolStripMenuItem(Properties.Resources.Start, null, new EventHandler(OnMenuStart), null), new Forms.ToolStripMenuItem(Properties.Resources.Stop, null, new EventHandler(OnMenuStop), null), new Forms.ToolStripSeparator(), new Forms.ToolStripMenuItem(Properties.Resources.Exit, null, new EventHandler(OnMenuExit), null) }); var font = new Font(contextMenuStrip.Items[0].Font, System.Drawing.FontStyle.Bold); contextMenuStrip.Items[0].Font = font; MenuState(true); notifyIcon = new System.Windows.Forms.NotifyIcon(); notifyIcon.Icon = System.Drawing.Icon.ExtractAssociatedIcon( Assembly.GetEntryAssembly().ManifestModule.Name); notifyIcon.Visible = true; notifyIcon.BalloonTipTitle = appName; notifyIcon.ContextMenuStrip = contextMenuStrip; notifyIcon.DoubleClick += new EventHandler(OnMenuOpen); notifyIcon.BalloonTipClicked += new EventHandler(OnMenuOpen); ServerStart(); if (Properties.Settings.Default.StartupGps) GpsStart(); if (Properties.Settings.Default.StartupMinimised) MinimiseToTray(); }