public WinFormsFileSorter() { cpu = new Label(); //cpu.Text = "Sort by length"; cpu.Width = 120; ram = new Label(); //ram.Text = "Sort alphabrticly"; ram.Location = new Point(0, 30); ram.Width = 120; timer = new Timer(); timer.Interval = 1000; timer.Enabled = true; timer.Tick += (_,__)=> UpdateInfo(); notifIcon = new NotifyIcon(new System.ComponentModel.Container()); notifIcon.Icon = new Icon("m.ico"); notifIcon.Text = "RM"; notifIcon.Visible = true; notifIcon.MouseDoubleClick += notifIconDblClick; Controls.Add(cpu); Controls.Add(ram); this.Resize += resize; }
private Virtualtray() { _virtualbox = (IVirtualBox) new VirtualBox.VirtualBox(); /* the generated VirtualBox.dll COM library doesn't work with the C# event * system, so we handle events by registering callbacks */ _virtualbox.RegisterCallback(this); _icon = GetIcon("icon/icon-16.ico"); _idleIcon = GetIcon("icon/icon-gray-16.ico"); _notifyIcon = new NotifyIcon(); _notifyIcon.Icon = _idleIcon; _notifyIcon.Text = "Virtualtray"; _notifyIcon.Visible = true; _vms = new Hashtable(); ContextMenu menu = new ContextMenu(); foreach (IMachine machine in _virtualbox.Machines) { MachineMenu mm = new MachineMenu(machine, menu); mm.StateChange += new EventHandler(MachineStateChangeEventHandler); _vms.Add(machine.Id, mm); } menu.MenuItems.Add(new MenuItem("-") {Name = "-"}); menu.MenuItems.Add(new MenuItem("Open VirtualBox...", new EventHandler( MenuLaunchVirtualBoxEventHandler))); menu.MenuItems.Add(new MenuItem("Exit", new EventHandler(MenuExitEventHandler))); _notifyIcon.ContextMenu = menu; ToggleIcon(); _notifyIcon.MouseClick += new MouseEventHandler(IconClickEventHandler); Application.ApplicationExit += new EventHandler(ApplicationExitEventHandler); }
public MainForm () { // // _contextMenu // _contextMenu = new ContextMenu (); // // _notifyIcon // _notifyIcon = new NotifyIcon (); _notifyIcon.ContextMenu = _contextMenu; _notifyIcon.Click += new EventHandler (NotifyIcon_Click); // // _bringToFrontMenuItem // _bringToFrontMenuItem = new MenuItem (); _bringToFrontMenuItem.Text = "Bring to front..."; _bringToFrontMenuItem.Click += new EventHandler (BringToFrontMenuItem_Click); _contextMenu.MenuItems.Add (_bringToFrontMenuItem); // // _activateMenuItem // _activateMenuItem = new MenuItem (); _activateMenuItem.Text = "Activate..."; _activateMenuItem.Click += new EventHandler (ActivateMenuItem_Click); _contextMenu.MenuItems.Add (_activateMenuItem); // // _tabControl // _tabControl = new TabControl (); _tabControl.Dock = DockStyle.Fill; Controls.Add (_tabControl); // // _bugDescriptionText1 // _bugDescriptionText1 = new TextBox (); _bugDescriptionText1.Dock = DockStyle.Fill; _bugDescriptionText1.Multiline = true; _bugDescriptionText1.Text = string.Format (CultureInfo.InvariantCulture, "Steps to execute:{0}{0}" + "1. Right-click the notify icon.{0}{0}" + "2. Click any of the menu items in the context menu.{0}{0}" + "Expected result:{0}{0}" + "1. The form is closed after the menu item is clicked.", Environment.NewLine); // // _tabPage1 // _tabPage1 = new TabPage (); _tabPage1.Text = "#1"; _tabPage1.Controls.Add (_bugDescriptionText1); _tabControl.Controls.Add (_tabPage1); // // MainForm // ClientSize = new Size (300, 170); StartPosition = FormStartPosition.CenterScreen; Text = "bug #82162"; Load += new EventHandler (MainForm_Load); }
// Stuff that used to be in the constructor, but the catch clause fails // since MessageBox.Show is not allowed there (MissingMethodException) // call from Load event instead and use its catch clause. private void Initialize2() { notifyIcon = new NotifyIcon(); notifyIcon.Click += new EventHandler(notifyIcon_Click); properties = Utilities.GetProperties(); savedRegion = properties["region"]; //Kill the old instance if (properties["processid"] != "") { logger.Info("Detected old instance. Kill PID " + properties["processid"]); try { int oldProcessId = Convert.ToInt32(properties["processid"]); Process oldProcess = Process.GetProcessById(oldProcessId); oldProcess.Kill(); } catch //If the old instance not running,it throws ArgumentException { //do nothing } } //Add the process id to config file Process currentPprocess = Process.GetCurrentProcess(); properties["processid"] = currentPprocess.Id.ToString(); Utilities.SaveConfigurations(properties); }
public TestForm() { notify_icon = new NotifyIcon(); notify_icon.Icon = Icon; notify_icon.Text = "NotifyIcon Text"; notify_icon.BalloonTipTitle = "Balloon Tip Title"; notify_icon.BalloonTipText = "Mono has both an optimizing just-in-time (JIT) runtime and a interpreter runtime. The interpreter runtime is far less complex and is primarly used in the early stages before a JIT version for that architecture is constructed. The interpreter is not supported on architectures where the JIT has been ported."; notify_icon.BalloonTipIcon = ToolTipIcon.None; notify_icon.Visible = true; notify_icon.BalloonTipClicked += new EventHandler (TestForm_BalloonTipClicked); notify_icon.BalloonTipClosed += new EventHandler (TestForm_BalloonTipClosed); notify_icon.BalloonTipShown += new EventHandler (TestForm_BalloonTipShown); Button btnicon = new Button (); btnicon.Text = "Show/Hide Icon"; btnicon.Top = 30; btnicon.Width = 120; btnicon.Left = (Width - btnicon.Width) / 2; btnicon.Click += new EventHandler (btnicon_Click); Controls.Add (btnicon); Button btnballoon = new Button (); btnballoon.Text = "Show Balloon"; btnballoon.Top = 60; btnballoon.Left = btnicon.Left; btnballoon.Width = btnicon.Width; btnballoon.Click += new EventHandler (btnballoon_Click); Controls.Add (btnballoon); Text = "NotifyIcon Balloon Sample"; StartPosition = FormStartPosition.CenterScreen; }
void thetar() { NotifyIcon mycon = new NotifyIcon(); Stream mstream = File.Open("Flash2/apps/appslogo.ico",FileMode.Open); mycon.Icon = new System.Drawing.Icon(mstream); mycon.Visible = true; mycon.DoubleClick+=new EventHandler(mycon_DoubleClick); Application2.Run(); }
//========================================================================== public static void Main(string[] astrArg) { ContextMenu cm; MenuItem miCurr; int iIndex = 0; string status = "running"; // Kontextmenü erzeugen cm = new ContextMenu(); // Kontextmenüeinträge erzeugen miCurr = new MenuItem(); miCurr.Index = iIndex++; miCurr.Text = "&Aktion 1"; // Eigenen Text einsetzen miCurr.Click += new System.EventHandler(Action1Click); cm.MenuItems.Add(miCurr); // Kontextmenüeinträge erzeugen miCurr = new MenuItem(); miCurr.Index = iIndex++; miCurr.Text = "&Beenden"; miCurr.Click += new System.EventHandler(ExitClick); cm.MenuItems.Add(miCurr); // NotifyIcon selbst erzeugen notico = new NotifyIcon(); notico.Icon = new Icon("git.ico"); // Eigenes Icon einsetzen notico.Text = "OVEye-Server | "+ status; // Eigenen Text einsetzen notico.Visible = true; notico.ContextMenu = cm; Console.WriteLine("Erstelle Server"); Server x = new Server(); database y = new database(); //Erstellt Thread prüfen = new Thread(delegate() { y.renewActiveConnections(x.clientList); }); // Ohne Appplication.Run geht es nicht Application.Run(); }
public MainForm () { // // _notifyIcon // _notifyIcon = new NotifyIcon (); _notifyIcon.Icon = Icon; _notifyIcon.Visible = true; // // _tabControl // _tabControl = new TabControl (); _tabControl.Dock = DockStyle.Fill; Controls.Add (_tabControl); // // _bugDescriptionText1 // _bugDescriptionText1 = new TextBox (); _bugDescriptionText1.Multiline = true; _bugDescriptionText1.Dock = DockStyle.Fill; _bugDescriptionText1.Text = string.Format (CultureInfo.InvariantCulture, "Steps to execute:{0}{0}" + "1. Move the mouse pointer over the notify icon in " + "the task bar.{0}{0}" + "Expected result:{0}{0}" + "1. A tooltip containing the following text is displayed:{0}{0}" + " Rank: 10{0}" + " Downs: 55{0}" + " Pages: 994{0}" + " Tracker: 4{0}" + " Msgs: 7988{0}{0}" + "2. All text is left aligned and fully visible.", Environment.NewLine); // // _tabPage1 // _tabPage1 = new TabPage (); _tabPage1.Text = "#1"; _tabPage1.Controls.Add (_bugDescriptionText1); _tabControl.Controls.Add (_tabPage1); // // MainForm // ClientSize = new Size (300, 250); StartPosition = FormStartPosition.CenterScreen; Text = "bug #81550"; Load += new EventHandler (MainForm_Load); }
public MainForm () { // // _notifyIcon // _notifyIcon = new NotifyIcon (); // // _timer // _timer = new Timer (); _timer.Interval = 1000 * 5; // update every 5 seconds _timer.Tick += new EventHandler (Timer_Tick); _timer.Start (); // // _tabControl // _tabControl = new TabControl (); _tabControl.Dock = DockStyle.Fill; Controls.Add (_tabControl); // // _bugDescriptionText1 // _bugDescriptionText1 = new TextBox (); _bugDescriptionText1.Multiline = true; _bugDescriptionText1.Dock = DockStyle.Fill; _bugDescriptionText1.Text = string.Format (CultureInfo.InvariantCulture, "Expected result:{0}{0}" + "1. A notify icon is displayed in the taskbar.{0}{0}" + "2. The icon is a number which increments every 5 seconds.{0}{0}" + "3. The color of the text alternates between black and green.", Environment.NewLine); // // _tabPage1 // _tabPage1 = new TabPage (); _tabPage1.Text = "#1"; _tabPage1.Controls.Add (_bugDescriptionText1); _tabControl.Controls.Add (_tabPage1); // // MainForm // ClientSize = new Size (300, 150); StartPosition = FormStartPosition.CenterScreen; Text = "bug #81559"; Load += new EventHandler (MainForm_Load); }
public SysTrayApp() { // Create a simple tray menu with only one item. trayMenu = new ContextMenu(); trayMenu.MenuItems.Add("Configure", OnConfigure); trayMenu.MenuItems.Add("Exit", OnExit); // Create a tray icon. In this example we use a // standard system icon for simplicity, but you // can of course use your own custom icon too. trayIcon = new NotifyIcon(); trayIcon.Text = "MyTrayApp"; trayIcon.Icon = new Icon(SystemIcons.Application, 40, 40); // Add menu to tray icon and show it. trayIcon.ContextMenu = trayMenu; trayIcon.Visible = true; }
public ReadTags(NotifyIcon notifyIcon) { try { InitializeComponent(); dgTagResult.DataSource = tagdb.TagList; //Set the column width of datagrid AddGridStyles(); properties = Utilities.GetProperties(); playBeep.SoundLocation = properties["decodewavefile"]; playBeep.LoadAsync(); playStopAudio.SoundLocation = properties["endscanwavefile"]; playStopAudio.LoadAsync(); playStartAudio.SoundLocation = properties["startscanwavefile"]; playStartAudio.LoadAsync(); setStatus(Status.READY); pvtNotifyIcon = notifyIcon; //For battery level status = new CoreDLL.SYSTEM_POWER_STATUS_EX(); tmrBackLightControl = new System.Windows.Forms.Timer(); tmrBackLightControl.Interval = 1000 * 30;// Timer will tick every 30 seconds tmrBackLightControl.Tick += new EventHandler(tmrBackLightControl_Tick); //Pistol grip read handler pistolTriggerEvent = new SystemState(SystemProperty.HeadsetPresent); pistolTriggerEvent.Changed += new ChangeEventHandler(pistolTriggerEvent_Changed); pistolTriggerEvent.DisableApplicationLauncher(); } catch (Exception ex) { logger.Error("In ReadTags: " + ex.ToString()); MessageBox.Show(ex.Message); } }
public MainForm () { // // _notifyIcon // _notifyIcon = new NotifyIcon (); _notifyIcon.Visible = true; _notifyIcon.Icon = Icon; // // _tabControl // _tabControl = new TabControl (); _tabControl.Dock = DockStyle.Fill; Controls.Add (_tabControl); // // _bugDescriptionText1 // _bugDescriptionText1 = new TextBox (); _bugDescriptionText1.Multiline = true; _bugDescriptionText1.Dock = DockStyle.Fill; _bugDescriptionText1.Text = string.Format (CultureInfo.InvariantCulture, "Expected result:{0}{0}" + "1. A notify (form) icon is displayed in the taskbar.", Environment.NewLine); // // _tabPage1 // _tabPage1 = new TabPage (); _tabPage1.Text = "#1"; _tabPage1.Controls.Add (_bugDescriptionText1); _tabControl.Controls.Add (_tabPage1); // // MainForm // ClientSize = new Size (300, 90); StartPosition = FormStartPosition.CenterScreen; Text = "bug #81668"; }
public NotificationService() { _icon = new NotifyIcon(); _icon.Icon = Assets.Cloud; }
private void UpdateServersFromSubscribeLinksToolStripMenuItem_Click(object sender, EventArgs e) { if (Global.Settings.UseProxyToUpdateSubscription) { // 当前 ServerComboBox 中至少有一项 if (ServerComboBox.SelectedIndex == -1) { MessageBox.Show(Utils.i18N.Translate("Please select a server first"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } MenuStrip.Enabled = ConfigurationGroupBox.Enabled = ControlButton.Enabled = SettingsButton.Enabled = false; ControlButton.Text = "..."; } if (Global.Settings.SubscribeLink.Count > 0) { DeletePictureBox.Enabled = false; UpdateServersFromSubscribeLinksToolStripMenuItem.Enabled = false; Task.Run(() => { if (Global.Settings.UseProxyToUpdateSubscription) { var mode = new Models.Mode { Remark = "ProxyUpdate", Type = 5 }; MainController = new MainController(); MainController.Start(ServerComboBox.SelectedItem as Models.Server, mode); } foreach (var item in Global.Settings.SubscribeLink) { using var client = new Override.WebClient(); try { if (!string.IsNullOrEmpty(item.UserAgent)) { client.Headers.Add("User-Agent", item.UserAgent); } else { client.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36"); } if (Global.Settings.UseProxyToUpdateSubscription) { client.Proxy = new System.Net.WebProxy($"http://127.0.0.1:{Global.Settings.HTTPLocalPort}"); } var response = client.DownloadString(item.Link); try { response = Utils.ShareLink.URLSafeBase64Decode(response); } catch (Exception) { // 跳过 } Global.Settings.Server = Global.Settings.Server.Where(server => server.Group != item.Remark).ToList(); var result = Utils.ShareLink.Parse(response); if (result != null) { foreach (var x in result) { x.Group = item.Remark; } Global.Settings.Server.AddRange(result); NotifyIcon.ShowBalloonTip(5, UpdateChecker.Name, string.Format(Utils.i18N.Translate("Update {1} server(s) from {0}"), item.Remark, result.Count), ToolTipIcon.Info); } else { NotifyIcon.ShowBalloonTip(5, UpdateChecker.Name, string.Format(Utils.i18N.Translate("Update servers error from {0}"), item.Remark), ToolTipIcon.Error); } } catch (Exception) { } } InitServer(); DeletePictureBox.Enabled = true; if (Global.Settings.UseProxyToUpdateSubscription) { MenuStrip.Enabled = ConfigurationGroupBox.Enabled = ControlButton.Enabled = SettingsButton.Enabled = true; ControlButton.Text = Utils.i18N.Translate("Start"); MainController.Stop(); } Utils.Configuration.Save(); }).ContinueWith(task => { BeginInvoke(new Action(() => { UpdateServersFromSubscribeLinksToolStripMenuItem.Enabled = true; })); }); NotifyIcon.ShowBalloonTip(5, UpdateChecker.Name, Utils.i18N.Translate("Updating in the background"), ToolTipIcon.Info); } else { MessageBox.Show(Utils.i18N.Translate("No subscription link"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void CreateNotifyicon() { components = new System.ComponentModel.Container(); contextMenu = new ContextMenu(); contextMenu.MenuItems.Add(currentPlaying = new MenuItem { Text = "MovieDesktop", Enabled = false }); contextMenu.MenuItems.Add(shuffleNext = new MenuItem { Text = "Next random in directory", Visible = false }); shuffleNext.Click += new EventHandler((s, e) => { Open(Properties.Settings.Default.LastDirectory); }); contextMenu.MenuItems.Add("-"); menuOpen = new MenuItem { Index = 0, Text = "&Open" }; // Open file var openFile = new MenuItem { Index = 0, Text = "File..." }; openFile.Click += new EventHandler((s, e) => { string newFile = SelectFile(); if (!String.IsNullOrWhiteSpace(newFile)) { Open(newFile); } }); menuOpen.MenuItems.Add(openFile); // Open folder var openFolder = new MenuItem { Index = 1, Text = "Folder..." }; openFolder.Click += new EventHandler((s, e) => { string newFile = SelectFolder(); if (!String.IsNullOrWhiteSpace(newFile)) { Open(newFile); } }); menuOpen.MenuItems.Add(openFolder); // Open URL var openUrl = new MenuItem { Index = 2, Text = "URL..." }; openUrl.Click += new EventHandler((s, e) => { string newFile = SelectURL(); if (!String.IsNullOrWhiteSpace(newFile)) { Open(newFile); } }); menuOpen.MenuItems.Add(openUrl); contextMenu.MenuItems.Add(menuOpen); // If multiple screens, add screen selector var screens = Screen.AllScreens.Count(); if (screens > 1) { menuScreen = new MenuItem { Index = 1, Text = "Select screen" }; for (int i = 0; i < screens; i++) { var screen = Screen.AllScreens[i]; var setScreen = new MenuItem { Index = i, Text = (i + 1).ToString() + " - " + screen.Bounds.Width + " x " + screen.Bounds.Height + (screen.Primary ? " (primary)" : "") }; setScreen.Click += new EventHandler((s, e) => { SetDesktop(((MenuItem)s).Index); }); menuScreen.MenuItems.Add(setScreen); } contextMenu.MenuItems.Add(menuScreen); } // Add exit button menuExit = new MenuItem { Index = 2, Text = "E&xit" }; menuExit.Click += new EventHandler((s, e) => { // Close the form, which closes the application. Application.Exit(); }); contextMenu.MenuItems.Add("-"); contextMenu.MenuItems.Add(menuExit); // Create the NotifyIcon. notifyIcon = new NotifyIcon(components) { // The Icon property sets the icon that will appear // in the systray for this application. Icon = Properties.Resources.app_white, // The ContextMenu property sets the menu that will // appear when the systray icon is right clicked. ContextMenu = contextMenu, // The Text property sets the text that will be displayed, // in a tooltip, when the mouse hovers over the systray icon. Text = "MovieDesktop", Visible = true }; notifyIcon.MouseDown += new MouseEventHandler((s, e) => { if (e.Button == MouseButtons.Left) { MethodInfo mi = typeof(NotifyIcon).GetMethod("ShowContextMenu", BindingFlags.Instance | BindingFlags.NonPublic); mi.Invoke(notifyIcon, null); } }); }
public MegaMuteWindow() { NotifyIcon = new NotifyIcon(); NotifyIcon.Visible = true; }
private void ShowToolTrayTooltipActive(string portName) { NotifyIcon.Icon = Resources.FailIcon; NotifyIcon.ShowBalloonTip(10000, "Порт активен", "Порт " + portName + " активен.", ToolTipIcon.Warning); System.Media.SystemSounds.Asterisk.Play(); }
/// <summary> /// Initializes a new instance of the <see cref="ShellView"/> class. /// </summary> public ShellView() { this.InitializeComponent(); IUserSettingService userSettingService = IoC.Get <IUserSettingService>(); bool minimiseToTray = userSettingService.GetUserSetting <bool>(UserSettingConstants.MainWindowMinimize); if (minimiseToTray) { INotifyIconService notifyIconService = IoC.Get <INotifyIconService>(); this.notifyIcon = new NotifyIcon(); notifyIconService.RegisterNotifyIcon(this.notifyIcon); StreamResourceInfo streamResourceInfo = Application.GetResourceStream(new Uri("pack://application:,,,/handbrakepineapple.ico")); if (streamResourceInfo != null) { Stream iconStream = streamResourceInfo.Stream; this.notifyIcon.Icon = new Icon(iconStream); } this.notifyIcon.Click += this.NotifyIconClick; this.StateChanged += this.ShellViewStateChanged; } this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.E, ModifierKeys.Control)), new KeyGesture(Key.E, ModifierKeys.Control))); // Start Encode this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.K, ModifierKeys.Control)), new KeyGesture(Key.K, ModifierKeys.Control))); // Stop Encode this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.L, ModifierKeys.Control)), new KeyGesture(Key.L, ModifierKeys.Control))); // Open Log Window this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.Q, ModifierKeys.Control)), new KeyGesture(Key.Q, ModifierKeys.Control))); // Open Queue Window this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.A, ModifierKeys.Control)), new KeyGesture(Key.A, ModifierKeys.Control))); // Add to Queue this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.A, ModifierKeys.Alt)), new KeyGesture(Key.A, ModifierKeys.Alt))); // Add all to Queue this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.A, ModifierKeys.Control | ModifierKeys.Shift)), new KeyGesture(Key.A, ModifierKeys.Control | ModifierKeys.Shift))); // Add selection to Queue this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.O, ModifierKeys.Control)), new KeyGesture(Key.O, ModifierKeys.Control))); // File Scan this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.O, ModifierKeys.Alt)), new KeyGesture(Key.O, ModifierKeys.Alt))); // Scan Window this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.O, ModifierKeys.Control | ModifierKeys.Shift)), new KeyGesture(Key.O, ModifierKeys.Control | ModifierKeys.Shift))); // Scan a Folder this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.G, ModifierKeys.Control | ModifierKeys.Shift)), new KeyGesture(Key.G, ModifierKeys.Control | ModifierKeys.Shift))); // Garbage Collection this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.F1, ModifierKeys.None)), new KeyGesture(Key.F1, ModifierKeys.None))); // Help this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.S, ModifierKeys.Control)), new KeyGesture(Key.S, ModifierKeys.Control))); // Browse Destination // Tabs Switching this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D1, ModifierKeys.Control)), new KeyGesture(Key.D1, ModifierKeys.Control))); this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D2, ModifierKeys.Control)), new KeyGesture(Key.D2, ModifierKeys.Control))); this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D3, ModifierKeys.Control)), new KeyGesture(Key.D3, ModifierKeys.Control))); this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D4, ModifierKeys.Control)), new KeyGesture(Key.D4, ModifierKeys.Control))); this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D5, ModifierKeys.Control)), new KeyGesture(Key.D5, ModifierKeys.Control))); this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D6, ModifierKeys.Control)), new KeyGesture(Key.D6, ModifierKeys.Control))); this.InputBindings.Add(new InputBinding(new ProcessShortcutCommand(new KeyGesture(Key.D7, ModifierKeys.Control)), new KeyGesture(Key.D7, ModifierKeys.Control))); // Enable Windows 7 Taskbar progress indication. if (this.TaskbarItemInfo == null) { this.TaskbarItemInfo = Win7.WindowsTaskbar; } // Setup the UI Language string culture = userSettingService.GetUserSetting <string>(UserSettingConstants.UiLanguage); if (!string.IsNullOrEmpty(culture)) { InterfaceLanguage language = InterfaceLanguageUtilities.FindInterfaceLanguage(culture); if (language != null) { if (language.RightToLeft) { if (Application.Current.MainWindow != null) { Application.Current.MainWindow.FlowDirection = FlowDirection.RightToLeft; } } } } }
public iPhoneDiskApplication() { #region GUI preparation Text = "jPhone"; MaximizeBox = false; Size = new Size(nDefaultWidth, nHeightWithoutDebugLog); FormBorderStyle = FormBorderStyle.FixedSingle; ShowIcon = true; iApplication = new Icon(GetType(), "jphone.icons.icon.ico"); Icon = iApplication; FormClosing += new FormClosingEventHandler(iPhoneDiskApplication_FormClosing); SizeChanged += new EventHandler(iPhoneDiskApplication_SizeChanged); Show(); niTrayIcon = new NotifyIcon(); niTrayIcon.Text = "jPhone"; niTrayIcon.Icon = Icon; niTrayIcon.Click += new EventHandler(niTrayIcon_Click); lbText = new Label(); lbText.AutoSize = true; lbText.Location = new Point(10, 10); lbText.Text = "Select the iPhone, iPod Touch or iPad to mount:"; cbDeviceList = new ComboBox(); cbDeviceList.Location = new Point(lbText.Left + 5, lbText.Bottom); cbDeviceList.Width = 320; cbDeviceList.DropDownStyle = ComboBoxStyle.DropDownList; buMount = new Button(); buMount.Location = new Point(cbDeviceList.Right + 15, cbDeviceList.Top - 3); buMount.Size = new Size(80, 25); buMount.Click += new EventHandler(buMount_Click); buMount.Enabled = false; cmOptions = new ContextMenuStrip(); cmOptions.RenderMode = ToolStripRenderMode.System; cmOptions.ShowImageMargin = false; cmOptions.ShowCheckMargin = true; tsmiAutomount = new ToolStripMenuItem("Automount", null, (s, e) => { tsmiAutomount.Checked = !tsmiAutomount.Checked; }); tsmiMinimizeToTray = new ToolStripMenuItem("Minimize to tray", null, (s, e) => { tsmiMinimizeToTray.Checked = !tsmiMinimizeToTray.Checked; }); tsmiShowDebugLog = new ToolStripMenuItem("Show debug log", null, (s, e) => { tsmiShowDebugLog.Checked = !tsmiShowDebugLog.Checked; if (bShowDebugLog) Height = nHeightWithDebugLog; else Height = nHeightWithoutDebugLog; }); tsmiReapplyLibUSBFilters = new ToolStripMenuItem("Re-apply libusb filters", null, ReapplyLibUSBFilters_Click); cmOptions.Items.Add(tsmiAutomount); cmOptions.Items.Add(tsmiShowDebugLog); cmOptions.Items.Add(tsmiMinimizeToTray); cmOptions.Items.Add("-"); cmOptions.Items.Add(tsmiReapplyLibUSBFilters); buOptions = new Button(); buOptions.Location = new Point(buMount.Right + 5, buMount.Top); buOptions.Size = new Size(80, 25); buOptions.Text = "Options"; buOptions.Click += (s, e) => { cmOptions.Show(PointToScreen(new Point(buOptions.Left, buOptions.Bottom))); }; bool[] bOptions = GetRegistryOptions(); tsmiAutomount.Checked = bOptions[0]; tsmiShowDebugLog.Checked = bOptions[1]; tsmiMinimizeToTray.Checked = bOptions[2]; if (bShowDebugLog) Height = nHeightWithDebugLog; tbDebugLog = new TextBox(); tbDebugLog.ReadOnly = true; tbDebugLog.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right; tbDebugLog.Location = new Point(10, 75); tbDebugLog.Size = new Size(ClientSize.Width - 20, nHeightWithDebugLog - 145); tbDebugLog.Multiline = true; tbDebugLog.BorderStyle = BorderStyle.FixedSingle; tbDebugLog.ScrollBars = ScrollBars.Vertical; sbStatus = new StatusBar(); sbStatus.Dock = DockStyle.Bottom; sbStatus.SizingGrip = false; sbStatus.ShowPanels = true; sbpDeviceCount = new StatusBarPanel(); sbpDeviceCount.Width = 150; sbpDeviceCount.Alignment = HorizontalAlignment.Center; sbpMountStatus = new StatusBarPanel(); sbpMountStatus.AutoSize = StatusBarPanelAutoSize.Spring; sbpMountStatus.Alignment = HorizontalAlignment.Center; sbStatus.Panels.Add(sbpDeviceCount); sbStatus.Panels.Add(sbpMountStatus); Controls.AddRange(new Control[] { lbText, cbDeviceList, buMount, buOptions, sbStatus, tbDebugLog }); cbDeviceList.Select(); #endregion Global.LogUpdated += new Global.LogEventHandler(Global_LogUpdated); USBNotifier.OnDeviceNotify += new EventHandler<DeviceNotifyEventArgs>(USBNotifier_OnDeviceNotify); Global.Log("jPhone 1.0: iPhone mounting utility. Copyright 2010 Jonathan Bergknoff.\n"); Global.Log("Shift-click the mount button to mount a jailbroken device as root.\n"); Global.Log("http://www.getjpod.com/jphone\n"); // Initialize everything to an unmounted state. UnmountDevice(); PopulateDeviceList(); TryAutomount(); }
public TrayApplicationContext() { _components = new System.ComponentModel.Container(); // Clean old files if they exist if (File.Exists("settings.dat")) { File.Delete("settings.dat"); MessageBox.Show("All stored preferences were cleared during the update.\nPlease set your preferences again by right-clicking the tray icon and selecting settings."); } if (File.Exists("devices.dat")) File.Delete("devices.dat"); // Load settings Boolean first_time = false; if (File.Exists("settings.json")) { try { _settings = JsonConvert.DeserializeObject<Settings>(File.ReadAllText("settings.json")); } catch (Exception e) { MessageBox.Show("Could not load settings. Default values will be used."); _settings = new Settings(); File.WriteAllText("settings.json", JsonConvert.SerializeObject(_settings)); } } else { _settings = new Settings(); _settings.Save(); first_time = true; } // Create history directory if needed if (!Directory.Exists("History")) { Directory.CreateDirectory("History"); } // Load devices _deviceManager = new DeviceManager(_settings); _deviceManager.SaveData(); // Prepare notification system _notificationManager = new NotificationManager(_settings.ComputerName); // Create the icon _notifyIcon = new NotifyIcon(this._components); _notifyIcon.Icon = Resources.icon_app; _notifyIcon.Text = "Icy Monitor Server"; _notifyIcon.DoubleClick += mSettings_Click; _notifyIcon.Visible = true; // Prepare context menu PrepareContextMenu(); // Create computer object for data _computer = new Computer(); _visitor = new UpdateVisitor(); _computer.CPUEnabled = true; _computer.FanControllerEnabled = true; _computer.GPUEnabled = true; _computer.MainboardEnabled = true; _computer.HDDEnabled = true; _computer.Open(); _computer.Accept(_visitor); // Collect sensors (for history and notifications) CollectSensors(); // Create notifications timer StartNotificationsTimer(); // Create history timer if (_settings.History) StartHistoryTimer(); // Create server CreateServer(); // Create the multicast timer if (_settings.Multicast) { try { StartMulticasting(); } catch (SocketException e) { MessageBox.Show("Could not open socket for multicasting. Autodetection will be disabled.\n(Is another copy of Icy Monitor running?)"); } } if (first_time) { DialogResult dialogResult = MessageBox.Show("It is essential that you open a port for the server to use, would you want to open the preferences window?\n\nYou can do this at any moment by double-clicking the tray icon.", "Icy Monitor Server", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { mSettings_Click(null, null); } } // Start the server if (_server.Start() == false) { if (_multicastSocket != null) _multicastSocket.Close(); base.ExitThreadCore(); } }
private void ControlFun() { if (State == State.Waiting || State == State.Stopped) { // 服务器、模式 需选择 if (ServerComboBox.SelectedIndex == -1) { MessageBoxX.Show(i18N.Translate("Please select a server first")); return; } if (ModeComboBox.SelectedIndex == -1) { MessageBoxX.Show(i18N.Translate("Please select a mode first")); return; } State = State.Starting; // 清除模式搜索框文本选择 ModeComboBox.Select(0, 0); Task.Run(() => { Task.Run(Firewall.AddNetchFwRules); var server = ServerComboBox.SelectedItem as Models.Server; var mode = ModeComboBox.SelectedItem as Models.Mode; if (_mainController.Start(server, mode)) { Task.Run(() => { State = State.Started; StatusTextAppend(LocalPortText(server.Type, mode.Type)); Bandwidth.NetTraffic(server, mode, _mainController); }); // 如果勾选启动后最小化 if (Global.Settings.MinimizeWhenStarted) { WindowState = FormWindowState.Minimized; if (_isFirstCloseWindow) { // 显示提示语 NotifyIcon.ShowBalloonTip(5, UpdateChecker.Name, i18N.Translate( "Netch is now minimized to the notification bar, double click this icon to restore."), ToolTipIcon.Info); _isFirstCloseWindow = false; } Hide(); } if (Global.Settings.StartedTcping) { // 自动检测延迟 Task.Run(() => { while (true) { if (State == State.Started) { server.Test(); // 重载服务器列表 InitServer(); Thread.Sleep(Global.Settings.StartedTcping_Interval * 1000); } else { break; } } }); } } else { State = State.Stopped; StatusText(i18N.Translate("Start failed")); } }); } else { Task.Run(() => { // 停止 State = State.Stopping; _mainController.Stop(); State = State.Stopped; }); Task.Run(TestServer); } }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(main)); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.exitButton = new System.Windows.Forms.Button(); this.cameraButton = new SkimptControls.GlassButton(); this.hightlightButton = new SkimptControls.GlassButton(); this.updateMessageLink = new System.Windows.Forms.LinkLabel(); this.updateMessageLabel = new System.Windows.Forms.Label(); this.unhookButton = new System.Windows.Forms.Button(); this.mainProgramMessage = new System.Windows.Forms.TextBox(); this.tabPage2 = new System.Windows.Forms.TabPage(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.browseButton = new System.Windows.Forms.Button(); this.fileLocationTextBox = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.radioButton2 = new System.Windows.Forms.RadioButton(); this.radioButton1 = new System.Windows.Forms.RadioButton(); this.saveFileSettingButton = new SkimptControls.GlassButton(); this.tabPage3 = new System.Windows.Forms.TabPage(); this.saveFtpSettingButton = new SkimptControls.GlassButton(); this.ftpTestConnButton = new SkimptControls.GlassButton(); this.ftpDirTxtBox = new System.Windows.Forms.TextBox(); this.ftpPortTxtBox = new System.Windows.Forms.TextBox(); this.ftpPassTxtBox = new System.Windows.Forms.TextBox(); this.ftpUserTxtBox = new System.Windows.Forms.TextBox(); this.ftpHostTxtBox = new System.Windows.Forms.TextBox(); this.label6 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.tabPage4 = new System.Windows.Forms.TabPage(); this.savePSDasFileCheckbox = new System.Windows.Forms.CheckBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.removeContextMenuButton = new SkimptControls.GlassButton(); this.attachContextMenuButton = new SkimptControls.GlassButton(); this.ShowMessagesCheckbox = new System.Windows.Forms.CheckBox(); this.HideUponLaunchCheckbox = new System.Windows.Forms.CheckBox(); this.startOnWindowsLoadCheckBox = new System.Windows.Forms.CheckBox(); this.saveGlobalSettingButton = new SkimptControls.GlassButton(); this.tabPage5 = new System.Windows.Forms.TabPage(); this.fontDialog1 = new System.Windows.Forms.FontDialog(); this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components); this.notificationIconContext = new System.Windows.Forms.ContextMenuStrip(this.components); this.contextStartCamera = new System.Windows.Forms.ToolStripMenuItem(); this.contextHighlightMode = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.contextShowMenu = new System.Windows.Forms.ToolStripMenuItem(); this.contextExitMenu = new System.Windows.Forms.ToolStripMenuItem(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); this.tabPage2.SuspendLayout(); this.groupBox1.SuspendLayout(); this.tabPage3.SuspendLayout(); this.tabPage4.SuspendLayout(); this.groupBox2.SuspendLayout(); this.notificationIconContext.SuspendLayout(); this.SuspendLayout(); // // tabControl1 // this.tabControl1.Controls.Add(this.tabPage1); this.tabControl1.Controls.Add(this.tabPage2); this.tabControl1.Controls.Add(this.tabPage3); this.tabControl1.Controls.Add(this.tabPage4); this.tabControl1.Controls.Add(this.tabPage5); this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.tabControl1.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.tabControl1.HotTrack = true; this.tabControl1.ItemSize = new System.Drawing.Size(96, 26); this.tabControl1.Location = new System.Drawing.Point(0, 0); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; this.tabControl1.ShowToolTips = true; this.tabControl1.Size = new System.Drawing.Size(483, 250); this.tabControl1.SizeMode = System.Windows.Forms.TabSizeMode.Fixed; this.tabControl1.TabIndex = 0; // // tabPage1 // this.tabPage1.BackColor = System.Drawing.SystemColors.GradientInactiveCaption; this.tabPage1.Controls.Add(this.exitButton); this.tabPage1.Controls.Add(this.cameraButton); this.tabPage1.Controls.Add(this.hightlightButton); this.tabPage1.Controls.Add(this.updateMessageLink); this.tabPage1.Controls.Add(this.updateMessageLabel); this.tabPage1.Controls.Add(this.unhookButton); this.tabPage1.Controls.Add(this.mainProgramMessage); this.tabPage1.Location = new System.Drawing.Point(4, 30); this.tabPage1.Name = "tabPage1"; this.tabPage1.Padding = new System.Windows.Forms.Padding(3); this.tabPage1.Size = new System.Drawing.Size(475, 216); this.tabPage1.TabIndex = 0; this.tabPage1.Text = "Main"; this.tabPage1.ToolTipText = "Main screen"; // // exitButton // this.exitButton.Location = new System.Drawing.Point(13, 178); this.exitButton.Name = "exitButton"; this.exitButton.Size = new System.Drawing.Size(88, 31); this.exitButton.TabIndex = 5; this.exitButton.Text = "Exit Skimpt"; this.exitButton.UseVisualStyleBackColor = true; this.exitButton.Click += new System.EventHandler(this.exitButton_Click); // // cameraButton // this.cameraButton.BackColor = System.Drawing.Color.DarkViolet; this.cameraButton.ForeColor = System.Drawing.Color.Black; this.cameraButton.Location = new System.Drawing.Point(12, 73); this.cameraButton.Name = "cameraButton"; this.cameraButton.ShineColor = System.Drawing.Color.Thistle; this.cameraButton.Size = new System.Drawing.Size(214, 36); this.cameraButton.TabIndex = 6; this.cameraButton.Text = "Start Camera Mode"; this.cameraButton.Click += new System.EventHandler(this.cameraButton_Click); // // hightlightButton // this.hightlightButton.BackColor = System.Drawing.Color.SteelBlue; this.hightlightButton.Location = new System.Drawing.Point(244, 73); this.hightlightButton.Name = "hightlightButton"; this.hightlightButton.ShineColor = System.Drawing.Color.SkyBlue; this.hightlightButton.Size = new System.Drawing.Size(214, 36); this.hightlightButton.TabIndex = 5; this.hightlightButton.Text = "Start Highlight mode"; this.hightlightButton.Click += new System.EventHandler(this.hightlightButton_Click); // // updateMessageLink // this.updateMessageLink.AutoSize = true; this.updateMessageLink.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; this.updateMessageLink.Location = new System.Drawing.Point(184, 151); this.updateMessageLink.Name = "updateMessageLink"; this.updateMessageLink.Size = new System.Drawing.Size(126, 19); this.updateMessageLink.TabIndex = 4; this.updateMessageLink.TabStop = true; this.updateMessageLink.Text = "Skimpt Homepage"; this.updateMessageLink.Visible = false; this.updateMessageLink.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.updateMessageLink_LinkClicked); // // updateMessageLabel // this.updateMessageLabel.AutoSize = true; this.updateMessageLabel.ForeColor = System.Drawing.Color.Red; this.updateMessageLabel.Location = new System.Drawing.Point(15, 151); this.updateMessageLabel.Name = "updateMessageLabel"; this.updateMessageLabel.Size = new System.Drawing.Size(173, 19); this.updateMessageLabel.TabIndex = 3; this.updateMessageLabel.Text = "New Update Available on"; this.updateMessageLabel.Visible = false; // // unhookButton // this.unhookButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.unhookButton.Location = new System.Drawing.Point(320, 177); this.unhookButton.Name = "unhookButton"; this.unhookButton.Size = new System.Drawing.Size(149, 33); this.unhookButton.TabIndex = 1; this.unhookButton.Text = "Unhook Print Screen"; this.unhookButton.UseVisualStyleBackColor = true; this.unhookButton.Click += new System.EventHandler(this.unhookButton_Click); // // mainProgramMessage // this.mainProgramMessage.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.mainProgramMessage.ForeColor = System.Drawing.Color.Green; this.mainProgramMessage.Location = new System.Drawing.Point(8, 19); this.mainProgramMessage.Multiline = true; this.mainProgramMessage.Name = "mainProgramMessage"; this.mainProgramMessage.Size = new System.Drawing.Size(463, 48); this.mainProgramMessage.TabIndex = 0; this.mainProgramMessage.Text = "Program messages will be displayed here"; // // tabPage2 // this.tabPage2.BackColor = System.Drawing.SystemColors.GradientInactiveCaption; this.tabPage2.Controls.Add(this.groupBox1); this.tabPage2.Controls.Add(this.radioButton2); this.tabPage2.Controls.Add(this.radioButton1); this.tabPage2.Controls.Add(this.saveFileSettingButton); this.tabPage2.Location = new System.Drawing.Point(4, 30); this.tabPage2.Name = "tabPage2"; this.tabPage2.Padding = new System.Windows.Forms.Padding(3); this.tabPage2.Size = new System.Drawing.Size(475, 216); this.tabPage2.TabIndex = 1; this.tabPage2.Text = "File"; this.tabPage2.ToolTipText = "change file settings including save path"; // // groupBox1 // this.groupBox1.Controls.Add(this.browseButton); this.groupBox1.Controls.Add(this.fileLocationTextBox); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Location = new System.Drawing.Point(6, 74); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(463, 92); this.groupBox1.TabIndex = 3; this.groupBox1.TabStop = false; this.groupBox1.Text = "File Location"; // // browseButton // this.browseButton.Location = new System.Drawing.Point(416, 49); this.browseButton.Name = "browseButton"; this.browseButton.Size = new System.Drawing.Size(32, 27); this.browseButton.TabIndex = 2; this.browseButton.Text = "..."; this.browseButton.UseVisualStyleBackColor = true; this.browseButton.Click += new System.EventHandler(this.browseButton_Click); // // fileLocationTextBox // this.fileLocationTextBox.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.fileLocationTextBox.Location = new System.Drawing.Point(17, 50); this.fileLocationTextBox.Name = "fileLocationTextBox"; this.fileLocationTextBox.ReadOnly = true; this.fileLocationTextBox.Size = new System.Drawing.Size(393, 27); this.fileLocationTextBox.TabIndex = 1; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(13, 27); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(191, 19); this.label1.TabIndex = 0; this.label1.Text = "Save my file to this location:"; // // radioButton2 // this.radioButton2.AutoSize = true; this.radioButton2.Location = new System.Drawing.Point(26, 45); this.radioButton2.Name = "radioButton2"; this.radioButton2.Size = new System.Drawing.Size(213, 23); this.radioButton2.TabIndex = 1; this.radioButton2.Text = "Allow me to specify each file"; this.radioButton2.UseVisualStyleBackColor = true; // // radioButton1 // this.radioButton1.AutoSize = true; this.radioButton1.Checked = true; this.radioButton1.Location = new System.Drawing.Point(26, 16); this.radioButton1.Name = "radioButton1"; this.radioButton1.Size = new System.Drawing.Size(185, 23); this.radioButton1.TabIndex = 0; this.radioButton1.TabStop = true; this.radioButton1.Text = "Randomly name my files"; this.radioButton1.UseVisualStyleBackColor = true; // // saveFileSettingButton // this.saveFileSettingButton.Location = new System.Drawing.Point(155, 172); this.saveFileSettingButton.Name = "saveFileSettingButton"; this.saveFileSettingButton.Size = new System.Drawing.Size(141, 36); this.saveFileSettingButton.TabIndex = 5; this.saveFileSettingButton.Text = "Save File Settings"; this.saveFileSettingButton.Click += new System.EventHandler(this.saveFileSettingButton_Click); // // tabPage3 // this.tabPage3.BackColor = System.Drawing.SystemColors.GradientInactiveCaption; this.tabPage3.Controls.Add(this.saveFtpSettingButton); this.tabPage3.Controls.Add(this.ftpTestConnButton); this.tabPage3.Controls.Add(this.ftpDirTxtBox); this.tabPage3.Controls.Add(this.ftpPortTxtBox); this.tabPage3.Controls.Add(this.ftpPassTxtBox); this.tabPage3.Controls.Add(this.ftpUserTxtBox); this.tabPage3.Controls.Add(this.ftpHostTxtBox); this.tabPage3.Controls.Add(this.label6); this.tabPage3.Controls.Add(this.label5); this.tabPage3.Controls.Add(this.label4); this.tabPage3.Controls.Add(this.label3); this.tabPage3.Controls.Add(this.label2); this.tabPage3.Location = new System.Drawing.Point(4, 30); this.tabPage3.Name = "tabPage3"; this.tabPage3.Size = new System.Drawing.Size(475, 216); this.tabPage3.TabIndex = 2; this.tabPage3.Text = "Upload"; this.tabPage3.ToolTipText = "Set upload settings to remote server"; // // saveFtpSettingButton // this.saveFtpSettingButton.BackColor = System.Drawing.Color.DarkSlateBlue; this.saveFtpSettingButton.Location = new System.Drawing.Point(332, 173); this.saveFtpSettingButton.Name = "saveFtpSettingButton"; this.saveFtpSettingButton.ShineColor = System.Drawing.Color.SlateBlue; this.saveFtpSettingButton.Size = new System.Drawing.Size(135, 35); this.saveFtpSettingButton.TabIndex = 13; this.saveFtpSettingButton.Text = "Save FTP Settings"; this.saveFtpSettingButton.Click += new System.EventHandler(this.saveFtpSettingButton_Click); // // ftpTestConnButton // this.ftpTestConnButton.BackColor = System.Drawing.Color.Crimson; this.ftpTestConnButton.Location = new System.Drawing.Point(191, 173); this.ftpTestConnButton.Name = "ftpTestConnButton"; this.ftpTestConnButton.ShineColor = System.Drawing.Color.Pink; this.ftpTestConnButton.Size = new System.Drawing.Size(135, 35); this.ftpTestConnButton.TabIndex = 12; this.ftpTestConnButton.Text = "Test Connection"; this.ftpTestConnButton.Click += new System.EventHandler(this.ftpTestConnButton_Click); // // ftpDirTxtBox // this.ftpDirTxtBox.Location = new System.Drawing.Point(163, 140); this.ftpDirTxtBox.Name = "ftpDirTxtBox"; this.ftpDirTxtBox.Size = new System.Drawing.Size(307, 27); this.ftpDirTxtBox.TabIndex = 11; // // ftpPortTxtBox // this.ftpPortTxtBox.Location = new System.Drawing.Point(163, 107); this.ftpPortTxtBox.Name = "ftpPortTxtBox"; this.ftpPortTxtBox.Size = new System.Drawing.Size(307, 27); this.ftpPortTxtBox.TabIndex = 10; this.ftpPortTxtBox.Text = "21"; // // ftpPassTxtBox // this.ftpPassTxtBox.Location = new System.Drawing.Point(163, 74); this.ftpPassTxtBox.Name = "ftpPassTxtBox"; this.ftpPassTxtBox.Size = new System.Drawing.Size(307, 27); this.ftpPassTxtBox.TabIndex = 9; this.ftpPassTxtBox.UseSystemPasswordChar = true; // // ftpUserTxtBox // this.ftpUserTxtBox.Location = new System.Drawing.Point(163, 41); this.ftpUserTxtBox.Name = "ftpUserTxtBox"; this.ftpUserTxtBox.Size = new System.Drawing.Size(307, 27); this.ftpUserTxtBox.TabIndex = 8; // // ftpHostTxtBox // this.ftpHostTxtBox.Location = new System.Drawing.Point(163, 11); this.ftpHostTxtBox.Name = "ftpHostTxtBox"; this.ftpHostTxtBox.Size = new System.Drawing.Size(307, 27); this.ftpHostTxtBox.TabIndex = 5; // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(24, 143); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(133, 19); this.label6.TabIndex = 4; this.label6.Text = "Initial Directory (./)"; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(64, 110); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(93, 19); this.label5.TabIndex = 3; this.label5.Text = "Remote Port:"; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(28, 77); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(129, 19); this.label4.TabIndex = 2; this.label4.Text = "Remote Password:"******"label3"; this.label3.Size = new System.Drawing.Size(133, 19); this.label3.TabIndex = 1; this.label3.Text = "Remote Username:"******"label2"; this.label2.Size = new System.Drawing.Size(139, 19); this.label2.TabIndex = 0; this.label2.Text = "Remote Host Name:"; // // tabPage4 // this.tabPage4.BackColor = System.Drawing.SystemColors.GradientInactiveCaption; this.tabPage4.Controls.Add(this.savePSDasFileCheckbox); this.tabPage4.Controls.Add(this.groupBox2); this.tabPage4.Controls.Add(this.ShowMessagesCheckbox); this.tabPage4.Controls.Add(this.HideUponLaunchCheckbox); this.tabPage4.Controls.Add(this.startOnWindowsLoadCheckBox); this.tabPage4.Controls.Add(this.saveGlobalSettingButton); this.tabPage4.Location = new System.Drawing.Point(4, 30); this.tabPage4.Name = "tabPage4"; this.tabPage4.Size = new System.Drawing.Size(475, 216); this.tabPage4.TabIndex = 3; this.tabPage4.Text = "Settings"; this.tabPage4.ToolTipText = "Set global application settings"; // // savePSDasFileCheckbox // this.savePSDasFileCheckbox.AutoSize = true; this.savePSDasFileCheckbox.Location = new System.Drawing.Point(25, 90); this.savePSDasFileCheckbox.Name = "savePSDasFileCheckbox"; this.savePSDasFileCheckbox.Size = new System.Drawing.Size(191, 23); this.savePSDasFileCheckbox.TabIndex = 15; this.savePSDasFileCheckbox.Text = "Save a JPEG of a PSD file."; this.savePSDasFileCheckbox.UseVisualStyleBackColor = true; // // groupBox2 // this.groupBox2.Controls.Add(this.removeContextMenuButton); this.groupBox2.Controls.Add(this.attachContextMenuButton); this.groupBox2.Location = new System.Drawing.Point(25, 119); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(428, 62); this.groupBox2.TabIndex = 14; this.groupBox2.TabStop = false; this.groupBox2.Text = "Windows Context Menu"; // // removeContextMenuButton // this.removeContextMenuButton.BackColor = System.Drawing.Color.Crimson; this.removeContextMenuButton.Location = new System.Drawing.Point(220, 21); this.removeContextMenuButton.Name = "removeContextMenuButton"; this.removeContextMenuButton.ShineColor = System.Drawing.Color.Pink; this.removeContextMenuButton.Size = new System.Drawing.Size(198, 35); this.removeContextMenuButton.TabIndex = 14; this.removeContextMenuButton.Text = " Remove"; this.removeContextMenuButton.Click += new System.EventHandler(this.removeContextMenuButton_Click); // // attachContextMenuButton // this.attachContextMenuButton.BackColor = System.Drawing.Color.Crimson; this.attachContextMenuButton.Location = new System.Drawing.Point(16, 21); this.attachContextMenuButton.Name = "attachContextMenuButton"; this.attachContextMenuButton.ShineColor = System.Drawing.Color.Pink; this.attachContextMenuButton.Size = new System.Drawing.Size(198, 35); this.attachContextMenuButton.TabIndex = 13; this.attachContextMenuButton.Text = "Attach "; this.attachContextMenuButton.Click += new System.EventHandler(this.attachToWindowsButton_Click); // // ShowMessagesCheckbox // this.ShowMessagesCheckbox.AutoSize = true; this.ShowMessagesCheckbox.Location = new System.Drawing.Point(25, 61); this.ShowMessagesCheckbox.Name = "ShowMessagesCheckbox"; this.ShowMessagesCheckbox.Size = new System.Drawing.Size(306, 23); this.ShowMessagesCheckbox.TabIndex = 3; this.ShowMessagesCheckbox.Text = "Show program messages in a message box"; this.ShowMessagesCheckbox.UseVisualStyleBackColor = true; // // HideUponLaunchCheckbox // this.HideUponLaunchCheckbox.AutoSize = true; this.HideUponLaunchCheckbox.Location = new System.Drawing.Point(25, 32); this.HideUponLaunchCheckbox.Name = "HideUponLaunchCheckbox"; this.HideUponLaunchCheckbox.Size = new System.Drawing.Size(284, 23); this.HideUponLaunchCheckbox.TabIndex = 1; this.HideUponLaunchCheckbox.Text = "Hide instantly upon launch of program. "; this.HideUponLaunchCheckbox.UseVisualStyleBackColor = true; // // startOnWindowsLoadCheckBox // this.startOnWindowsLoadCheckBox.AutoSize = true; this.startOnWindowsLoadCheckBox.Location = new System.Drawing.Point(25, 3); this.startOnWindowsLoadCheckBox.Name = "startOnWindowsLoadCheckBox"; this.startOnWindowsLoadCheckBox.Size = new System.Drawing.Size(307, 23); this.startOnWindowsLoadCheckBox.TabIndex = 0; this.startOnWindowsLoadCheckBox.Text = "Start this program when Windows boots up"; this.startOnWindowsLoadCheckBox.UseVisualStyleBackColor = true; // // saveGlobalSettingButton // this.saveGlobalSettingButton.BackColor = System.Drawing.Color.Chocolate; this.saveGlobalSettingButton.Location = new System.Drawing.Point(158, 186); this.saveGlobalSettingButton.Name = "saveGlobalSettingButton"; this.saveGlobalSettingButton.OuterBorderColor = System.Drawing.Color.LightSalmon; this.saveGlobalSettingButton.Size = new System.Drawing.Size(161, 27); this.saveGlobalSettingButton.TabIndex = 6; this.saveGlobalSettingButton.Text = "Save Program Settings"; this.saveGlobalSettingButton.Click += new System.EventHandler(this.saveGlobalSettingButton_Click); // // tabPage5 // this.tabPage5.Location = new System.Drawing.Point(4, 30); this.tabPage5.Name = "tabPage5"; this.tabPage5.Size = new System.Drawing.Size(475, 216); this.tabPage5.TabIndex = 4; this.tabPage5.Text = "Log"; this.tabPage5.ToolTipText = "Check log files"; this.tabPage5.UseVisualStyleBackColor = true; // // notifyIcon // this.notifyIcon.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Info; this.notifyIcon.BalloonTipText = "Program Status: Running"; this.notifyIcon.BalloonTipTitle = "Skimpt v1.01"; this.notifyIcon.ContextMenuStrip = this.notificationIconContext; this.notifyIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon.Icon"))); this.notifyIcon.Text = "Skimpt v1.01\r\nProgram Status: Running"; this.notifyIcon.Visible = true; this.notifyIcon.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.notifyIcon_MouseDoubleClick); // // notificationIconContext // this.notificationIconContext.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.contextStartCamera, this.contextHighlightMode, this.toolStripSeparator1, this.contextShowMenu, this.contextExitMenu}); this.notificationIconContext.Name = "notificationIconContext"; this.notificationIconContext.Size = new System.Drawing.Size(172, 98); // // contextStartCamera // this.contextStartCamera.Name = "contextStartCamera"; this.contextStartCamera.Size = new System.Drawing.Size(171, 22); this.contextStartCamera.Text = "Start Camera Mode"; this.contextStartCamera.Click += new System.EventHandler(this.contextStartCamera_Click); // // contextHighlightMode // this.contextHighlightMode.Name = "contextHighlightMode"; this.contextHighlightMode.Size = new System.Drawing.Size(171, 22); this.contextHighlightMode.Text = "Start Highlight Mode"; this.contextHighlightMode.Click += new System.EventHandler(this.contextHighlightMode_Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Size = new System.Drawing.Size(168, 6); // // contextShowMenu // this.contextShowMenu.Name = "contextShowMenu"; this.contextShowMenu.Size = new System.Drawing.Size(171, 22); this.contextShowMenu.Text = "Show Main Window"; this.contextShowMenu.Click += new System.EventHandler(this.contextShowMenu_Click); // // contextExitMenu // this.contextExitMenu.Name = "contextExitMenu"; this.contextExitMenu.Size = new System.Drawing.Size(171, 22); this.contextExitMenu.Text = "Exit Skimpt"; this.contextExitMenu.Click += new System.EventHandler(this.contextExitMenu_Click); // // main // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoSize = true; this.BackColor = System.Drawing.SystemColors.GradientActiveCaption; this.ClientSize = new System.Drawing.Size(483, 250); this.Controls.Add(this.tabControl1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "main"; this.Opacity = 0.9; this.ShowIcon = false; this.ShowInTaskbar = false; this.Text = "Skimpt v 1.01"; this.TopMost = true; this.Load += new System.EventHandler(this.main_Load); this.Shown += new System.EventHandler(this.main_Shown); this.Closing += new System.ComponentModel.CancelEventHandler(this.main_Closing); this.tabControl1.ResumeLayout(false); this.tabPage1.ResumeLayout(false); this.tabPage1.PerformLayout(); this.tabPage2.ResumeLayout(false); this.tabPage2.PerformLayout(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.tabPage3.ResumeLayout(false); this.tabPage3.PerformLayout(); this.tabPage4.ResumeLayout(false); this.tabPage4.PerformLayout(); this.groupBox2.ResumeLayout(false); this.notificationIconContext.ResumeLayout(false); this.ResumeLayout(false); }
public void setNotifyIconVisible(Form in_me, NotifyIcon set_me, bool to_me) { if(in_me.InvokeRequired) { in_me.BeginInvoke(new setNotifyIconVisibleDelegate(setNotifyIconVisible), new Object[] {in_me,set_me,to_me}); } else { lock(set_me) { set_me.Visible = to_me; } } }
public static void begin() { YDColorizer.GlobalException.Initialize(); Timer timer = new Timer(); #region 配置文件不存在,创建默认配置文件 if (Config.IsConfigExists() == false) { Config.CreateDefault(); } #endregion Program.language = Config.GetLanguage(); List<string> dialogBoxTitles = AboutConfig.LoadSearchTitles(); #region 托盘图标 if (Config.IsNotifyIconVisible() == true) { NotifyIcon notifyIcon = new NotifyIcon(); notifyIcon.Icon = YDColorizer.Properties.Resources.icoYDColorizerRuning; switch (Program.language) { case 0: notifyIcon.Text = "YDWE颜色插件正在执行" + Environment.NewLine + "点击图标可以暂时停止执行"; break; case 1: notifyIcon.Text = "YDWE顏色插件正在執行" + Environment.NewLine + "點擊圖標可以暫時停止執行"; break; default: break; } notifyIcon.Visible = true; notifyIcon.Click += new EventHandler((object object_sender, EventArgs EventArgs_e) => { if (timer.Enabled == true) { timer.Enabled = false; notifyIcon.Icon = YDColorizer.Properties.Resources.icoYDColorizerStop; switch (Program.language) { case 0: notifyIcon.Text = "YDWE颜色插件已暂停" + Environment.NewLine + "点击图标可以恢复执行"; break; case 1: notifyIcon.Text = "YDWE顏色插件已暫停" + Environment.NewLine + "點擊圖標可以恢復執行"; break; default: break; } } else { timer.Enabled = true; notifyIcon.Icon = YDColorizer.Properties.Resources.icoYDColorizerRuning; switch (Program.language) { case 0: notifyIcon.Text = "YDWE颜色插件正在执行" + Environment.NewLine + "点击图标可以暂时停止执行"; break; case 1: notifyIcon.Text = "YDWE顏色插件正在執行" + Environment.NewLine + "點擊圖標可以暫時停止執行"; break; default: break; } } }); } #endregion timer.Interval = 100;// 设置搜索间隔为100毫秒 EditDialogBox edb = new EditDialogBox(); timer.Tick += new EventHandler((object object_sender, EventArgs EventArgs_e) => { try { if (edb.hWnd == IntPtr.Zero) { foreach (var title in dialogBoxTitles)// 遍历标题数组寻找对话框 { WinApi.Window dialogBox = new WinApi.Window(DialogBoxClassName, title);// 搜索we物体编辑器的文本编辑框 if (dialogBox.Handle != IntPtr.Zero)// 找到 { int thisProcessId = System.Diagnostics.Process.GetCurrentProcess().Id; int targetProcessId = AboutProcess.GetProcessId(dialogBox.Handle); if (thisProcessId == targetProcessId)// 搜索的对话框与该ydwe插件同进程 { edb.AttachDialog(dialogBox.Handle);// 重建模拟窗口 break; } } } } } catch (Exception e) { timer.Stop(); GlobalException.CatchException(e, e.ToString()); } }); timer.Start();// 启动搜索计时器 }
public MainForm () { // // _contextMenu // _contextMenu = new ContextMenu (); // // _notifyIcon // _notifyIcon = new NotifyIcon (); _notifyIcon.ContextMenu = _contextMenu; _notifyIcon.Click += new EventHandler (NotifyIcon_Click); // // _bringToFrontMenuItem // _bringToFrontMenuItem = new MenuItem (); _bringToFrontMenuItem.Text = "Bring to front..."; _bringToFrontMenuItem.Click += new EventHandler (BringToFrontMenuItem_Click); _contextMenu.MenuItems.Add (_bringToFrontMenuItem); // // _activateMenuItem // _activateMenuItem = new MenuItem (); _activateMenuItem.Text = "Activate..."; _activateMenuItem.Click += new EventHandler (ActivateMenuItem_Click); _contextMenu.MenuItems.Add (_activateMenuItem); // // _separatorMenuItem // _separatorMenuItem = new MenuItem (); _separatorMenuItem.Text = "-"; _contextMenu.MenuItems.Add (_separatorMenuItem); // // _activateOnClickMenuItem // _activateOnClickMenuItem = new MenuItem (); _activateOnClickMenuItem.Text = "Activate on Click"; _activateOnClickMenuItem.Click += new EventHandler (ActivateOnClickMenuItem_Click); _contextMenu.MenuItems.Add (_activateOnClickMenuItem); // // _tabControl // _tabControl = new TabControl (); _tabControl.Dock = DockStyle.Fill; Controls.Add (_tabControl); // // _bugDescriptionText1 // _bugDescriptionText1 = new TextBox (); _bugDescriptionText1.Dock = DockStyle.Fill; _bugDescriptionText1.Multiline = true; _bugDescriptionText1.Text = string.Format (CultureInfo.InvariantCulture, "Steps to execute:{0}{0}" + "1. Ensure another form is displayed on top of this one.{0}{0}" + "2. Right-click the notify icon.{0}{0}" + "3. Click the \"Bring to front...\" menu item.{0}{0}" + "Expected result:{0}{0}" + "1. On step 2, the form is not moved to the top of the z-order.{0}{0}" + "2. On step 3:{0}{0}" + " * The form is moved to the top of the z-order.{0}" + " * The form is activated.", Environment.NewLine); // // _tabPage1 // _tabPage1 = new TabPage (); _tabPage1.Text = "#1"; _tabPage1.Controls.Add (_bugDescriptionText1); _tabControl.Controls.Add (_tabPage1); // // _bugDescriptionText2 // _bugDescriptionText2 = new TextBox (); _bugDescriptionText2.Dock = DockStyle.Fill; _bugDescriptionText2.Multiline = true; _bugDescriptionText2.Text = string.Format (CultureInfo.InvariantCulture, "Steps to execute:{0}{0}" + "1. Ensure another form is displayed on top of this one.{0}{0}" + "2. Right-click the notify icon.{0}{0}" + "3. Click the \"Activate...\" menu item.{0}{0}" + "Expected result:{0}{0}" + "1. On step 2, the form is not moved to the top of the z-order.{0}{0}" + "2. On step 3:{0}{0}" + " * The form is moved to the top of the z-order.{0}" + " * The form is activated.", Environment.NewLine); // // _tabPage2 // _tabPage2 = new TabPage (); _tabPage2.Text = "#2"; _tabPage2.Controls.Add (_bugDescriptionText2); _tabControl.Controls.Add (_tabPage2); // // _bugDescriptionText3 // _bugDescriptionText3 = new TextBox (); _bugDescriptionText3.Dock = DockStyle.Fill; _bugDescriptionText3.Multiline = true; _bugDescriptionText3.Text = string.Format (CultureInfo.InvariantCulture, "Steps to execute:{0}{0}" + "1. Right-click the notify icon.{0}{0}" + "2. Click the Activate on Click menu item.{0}{0}" + "3. Ensure another form is displayed on top of this one.{0}{0}" + "4. Left-click the notify icon.{0}{0}" + "Expected result:{0}{0}" + "1. The form is moved to the top of the z-order.{0}{0}" + "2. The form is activated.", Environment.NewLine); // // _tabPage3 // _tabPage3 = new TabPage (); _tabPage3.Text = "#3"; _tabPage3.Controls.Add (_bugDescriptionText3); _tabControl.Controls.Add (_tabPage3); // // MainForm // ClientSize = new Size (300, 255); StartPosition = FormStartPosition.CenterScreen; Text = "bug #81904"; Load += new EventHandler (MainForm_Load); }
public static string GetName(NotifyIcon icon) { string result = String.Empty; switch (icon) { case NotifyIcon.Error: result = "error"; break; case NotifyIcon.Success: result = "success"; break; case NotifyIcon.Info: result = "info"; break; case NotifyIcon.Warn: result = "warn"; break; } return result; }
private void InitializeComponent() { // // TrayIconContextMenu // TrayIconContextMenu = new ContextMenuStrip(); TrayIconContextMenu.SuspendLayout(); // // TrayIcon // TrayIcon = new NotifyIcon(); TrayIcon.Icon = Resources.logo2; TrayIcon.Visible = true; TrayIcon.MouseUp += TrayIcon_MouseUp; TrayIcon.ContextMenuStrip = TrayIconContextMenu; TrayIcon.Text = Resources.ServiceName; // // DashboardMenuItem // DashboardMenuItem = new ToolStripMenuItem(); DashboardMenuItem.Name = "DashboardMenuItem"; DashboardMenuItem.Text = Resources.DashboardMenuItem; DashboardMenuItem.Click += DashboardMenuItem_Click; // // NetworkDnsMenuItem // NetworkDnsMenuItem = new ToolStripMenuItem(); NetworkDnsMenuItem.Name = "NetworkDnsMenuItem"; NetworkDnsMenuItem.Text = Resources.NetworkDnsMenuItem; DefaultNetworkDnsMenuItem = new ToolStripMenuItem("Default"); DefaultNetworkDnsMenuItem.Click += DefaultNetworkDnsMenuItem_Click; ManageNetworkDnsMenuItem = new ToolStripMenuItem("Manage"); ManageNetworkDnsMenuItem.Click += ManageNetworkDnsMenuItem_Click; // // ServiceMenuItem // ServiceMenuItem = new ToolStripMenuItem(); ServiceMenuItem.Name = "ServiceMenuItem"; ServiceMenuItem.Text = Resources.ServiceMenuItem; StartServiceMenuItem = new ToolStripMenuItem(Resources.ServiceStartMenuItem); StartServiceMenuItem.Click += StartServiceMenuItem_Click; RestartServiceMenuItem = new ToolStripMenuItem(Resources.ServiceRestartMenuItem); RestartServiceMenuItem.Click += RestartServiceMenuItem_Click; StopServiceMenuItem = new ToolStripMenuItem(Resources.ServiceStopMenuItem); StopServiceMenuItem.Click += StopServiceMenuItem_Click; ServiceMenuItem.DropDownItems.AddRange(new ToolStripItem[] { StartServiceMenuItem, RestartServiceMenuItem, StopServiceMenuItem }); // // AboutMenuItem // AboutMenuItem = new ToolStripMenuItem(); AboutMenuItem.Name = "AboutMenuItem"; AboutMenuItem.Text = Resources.AboutMenuItem; AboutMenuItem.Click += AboutMenuItem_Click; // // AutoStartMenuItem // AutoStartMenuItem = new ToolStripMenuItem(); AutoStartMenuItem.Name = "AutoStartMenuItem"; AutoStartMenuItem.Text = "&Auto Start Icon"; AutoStartMenuItem.Click += AutoStartMenuItem_Click; // // ExitMenuItem // ExitMenuItem = new ToolStripMenuItem(); ExitMenuItem.Name = "ExitMenuItem"; ExitMenuItem.Text = Resources.ExitMenuItem; ExitMenuItem.Click += ExitMenuItem_Click; TrayIconContextMenu.Items.AddRange(new ToolStripItem[] { DashboardMenuItem, new ToolStripSeparator(), NetworkDnsMenuItem, ServiceMenuItem, AboutMenuItem, new ToolStripSeparator(), AutoStartMenuItem, ExitMenuItem }); TrayIconContextMenu.ResumeLayout(false); }
public MyCustomApplicationContext() { if (cmu == null) { cmu = new ContextMenuStrip { ShowCheckMargin = false, ShowImageMargin = false, BackColor = BackgroundColor, ForeColor = ForegroundColor, Padding = new Padding(0), Font = new Font(UIFont, labelFontSize) }; ToolStripLabel TitleLabel = new ToolStripLabel("Select a Chrome Profile:") { Font = new Font(UIFont, titleFontSize), AutoSize = true, Padding = new Padding(0) }; cmu.Items.Add(TitleLabel); cmu.Items.Add(new ToolStripSeparator()); cmu.AutoSize = true; cmu.MaximumSize = new Size(Width, 0); cmu.DropShadowEnabled = false; cmu.RenderMode = ToolStripRenderMode.System; cmu.Items.Add(CreateMenuItem("Launch NAME", (object sender, EventArgs e) => LaunchChrome("1"))); cmu.Items.Add(CreateMenuItem("Launch NAME", (object sender, EventArgs e) => LaunchChrome("2"))); //... //REPEAT AS DESIRED! cmu.Items.Add(CreateMenuItem("Quit ChromeLauncher", Exit)); } if (trayIcon == null) { // Initialize Tray Icon trayIcon = new NotifyIcon() { Text = "Launch a Chrome Profile", Icon = Properties.Resources.chrome, ContextMenuStrip = cmu, Visible = true }; } trayIcon.Click += (object sender, EventArgs e) => { cmu.Show(Control.MousePosition); }; }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(ExecutorTemplateForm)); this.txLog = new System.Windows.Forms.TextBox(); this.statusBar = new System.Windows.Forms.StatusBar(); this.TrayIcon = new System.Windows.Forms.NotifyIcon(this.components); this.TrayMenu = new System.Windows.Forms.ContextMenu(); this.tmExit = new System.Windows.Forms.MenuItem(); this.MainMenu = new System.Windows.Forms.MainMenu(); this.menuItem1 = new System.Windows.Forms.MenuItem(); this.mmExit = new System.Windows.Forms.MenuItem(); this.menuItem2 = new System.Windows.Forms.MenuItem(); this.mmAbout = new System.Windows.Forms.MenuItem(); this.HideTimer = new System.Windows.Forms.Timer(this.components); this.groupBox4 = new System.Windows.Forms.GroupBox(); this.tabControl = new System.Windows.Forms.TabControl(); this.tabConnection = new System.Windows.Forms.TabPage(); this.groupBox3 = new System.Windows.Forms.GroupBox(); this.label5 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.txPassword = new System.Windows.Forms.TextBox(); this.txUsername = new System.Windows.Forms.TextBox(); this.btReset = new System.Windows.Forms.Button(); this.btDisconnect = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.txMgrPort = new System.Windows.Forms.TextBox(); this.txMgrHost = new System.Windows.Forms.TextBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.label3 = new System.Windows.Forms.Label(); this.txOwnPort = new System.Windows.Forms.TextBox(); this.cbDedicated = new System.Windows.Forms.CheckBox(); this.label4 = new System.Windows.Forms.Label(); this.btConnect = new System.Windows.Forms.Button(); this.tabExecution = new System.Windows.Forms.TabPage(); this.btStopExec = new System.Windows.Forms.Button(); this.btStartExec = new System.Windows.Forms.Button(); this.tabOptions = new System.Windows.Forms.TabPage(); this.label11 = new System.Windows.Forms.Label(); this.udMaxRetry = new System.Windows.Forms.NumericUpDown(); this.label10 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.chkRetryConnect = new System.Windows.Forms.CheckBox(); this.udReconnectInterval = new System.Windows.Forms.NumericUpDown(); this.label8 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.lblHBInt = new System.Windows.Forms.Label(); this.udHBInterval = new System.Windows.Forms.NumericUpDown(); this.pbar = new System.Windows.Forms.ProgressBar(); this.cmbId = new System.Windows.Forms.ComboBox(); this.groupBox4.SuspendLayout(); this.tabControl.SuspendLayout(); this.tabConnection.SuspendLayout(); this.groupBox3.SuspendLayout(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.tabExecution.SuspendLayout(); this.tabOptions.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.udMaxRetry)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.udReconnectInterval)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.udHBInterval)).BeginInit(); this.SuspendLayout(); // // txLog // this.txLog.Cursor = System.Windows.Forms.Cursors.IBeam; this.txLog.Location = new System.Drawing.Point(8, 16); this.txLog.Multiline = true; this.txLog.Name = "txLog"; this.txLog.ReadOnly = true; this.txLog.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.txLog.Size = new System.Drawing.Size(424, 96); this.txLog.TabIndex = 11; this.txLog.TabStop = false; this.txLog.Text = ""; this.txLog.DoubleClick += new System.EventHandler(this.txLog_DoubleClick); // // statusBar // this.statusBar.Location = new System.Drawing.Point(0, 541); this.statusBar.Name = "statusBar"; this.statusBar.Size = new System.Drawing.Size(458, 22); this.statusBar.TabIndex = 2; // // TrayIcon // this.TrayIcon.ContextMenu = this.TrayMenu; this.TrayIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("TrayIcon.Icon"))); this.TrayIcon.Text = "Alchemi Executor"; this.TrayIcon.Visible = true; this.TrayIcon.Click += new System.EventHandler(this.TrayIcon_Click); // // TrayMenu // this.TrayMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.tmExit}); // // tmExit // this.tmExit.Index = 0; this.tmExit.Text = "Exit"; this.tmExit.Click += new System.EventHandler(this.tmExit_Click); // // MainMenu // this.MainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItem1, this.menuItem2}); // // menuItem1 // this.menuItem1.Index = 0; this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.mmExit}); this.menuItem1.Text = "Executor"; // // mmExit // this.mmExit.Index = 0; this.mmExit.Text = "Exit"; this.mmExit.Click += new System.EventHandler(this.mmExit_Click); // // menuItem2 // this.menuItem2.Index = 1; this.menuItem2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.mmAbout}); this.menuItem2.Text = "Help"; // // mmAbout // this.mmAbout.Index = 0; this.mmAbout.Text = "About"; this.mmAbout.Click += new System.EventHandler(this.mmAbout_Click); // // HideTimer // this.HideTimer.Interval = 1000; this.HideTimer.Tick += new System.EventHandler(this.HideTimer_Tick); // // groupBox4 // this.groupBox4.Controls.Add(this.txLog); this.groupBox4.FlatStyle = System.Windows.Forms.FlatStyle.System; this.groupBox4.Location = new System.Drawing.Point(8, 408); this.groupBox4.Name = "groupBox4"; this.groupBox4.Size = new System.Drawing.Size(440, 120); this.groupBox4.TabIndex = 8; this.groupBox4.TabStop = false; this.groupBox4.Text = "Log messages"; // // tabControl // this.tabControl.Controls.Add(this.tabConnection); this.tabControl.Controls.Add(this.tabExecution); this.tabControl.Controls.Add(this.tabOptions); this.tabControl.ItemSize = new System.Drawing.Size(97, 18); this.tabControl.Location = new System.Drawing.Point(8, 8); this.tabControl.Name = "tabControl"; this.tabControl.SelectedIndex = 0; this.tabControl.Size = new System.Drawing.Size(440, 392); this.tabControl.TabIndex = 6; // // tabConnection // this.tabConnection.BackColor = System.Drawing.SystemColors.Control; this.tabConnection.Controls.Add(this.groupBox3); this.tabConnection.Controls.Add(this.btReset); this.tabConnection.Controls.Add(this.btDisconnect); this.tabConnection.Controls.Add(this.groupBox1); this.tabConnection.Controls.Add(this.groupBox2); this.tabConnection.Controls.Add(this.btConnect); this.tabConnection.Location = new System.Drawing.Point(4, 22); this.tabConnection.Name = "tabConnection"; this.tabConnection.Size = new System.Drawing.Size(432, 366); this.tabConnection.TabIndex = 0; this.tabConnection.Text = "Setup Connection"; // // groupBox3 // this.groupBox3.Controls.Add(this.label5); this.groupBox3.Controls.Add(this.label6); this.groupBox3.Controls.Add(this.txPassword); this.groupBox3.Controls.Add(this.txUsername); this.groupBox3.FlatStyle = System.Windows.Forms.FlatStyle.System; this.groupBox3.Location = new System.Drawing.Point(96, 96); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(224, 72); this.groupBox3.TabIndex = 5; this.groupBox3.TabStop = false; this.groupBox3.Text = "Credentials"; // // label5 // this.label5.Location = new System.Drawing.Point(120, 24); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(64, 16); this.label5.TabIndex = 3; this.label5.Text = "Password"; // // label6 // this.label6.Location = new System.Drawing.Point(16, 24); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(96, 16); this.label6.TabIndex = 2; this.label6.Text = "Username"; // // txPassword // this.txPassword.Location = new System.Drawing.Point(120, 40); this.txPassword.Name = "txPassword"; this.txPassword.PasswordChar = '*'; this.txPassword.Size = new System.Drawing.Size(88, 20); this.txPassword.TabIndex = 4; this.txPassword.Text = ""; // // txUsername // this.txUsername.Location = new System.Drawing.Point(16, 40); this.txUsername.Name = "txUsername"; this.txUsername.Size = new System.Drawing.Size(88, 20); this.txUsername.TabIndex = 3; this.txUsername.Text = ""; // // btReset // this.btReset.FlatStyle = System.Windows.Forms.FlatStyle.System; this.btReset.Location = new System.Drawing.Point(96, 296); this.btReset.Name = "btReset"; this.btReset.Size = new System.Drawing.Size(224, 23); this.btReset.TabIndex = 8; this.btReset.TabStop = false; this.btReset.Text = "Reset"; this.btReset.Click += new System.EventHandler(this.btReset_Click); // // btDisconnect // this.btDisconnect.FlatStyle = System.Windows.Forms.FlatStyle.System; this.btDisconnect.Location = new System.Drawing.Point(208, 328); this.btDisconnect.Name = "btDisconnect"; this.btDisconnect.Size = new System.Drawing.Size(112, 23); this.btDisconnect.TabIndex = 10; this.btDisconnect.Text = "Disconnect"; this.btDisconnect.Click += new System.EventHandler(this.btDisconnect_Click); // // groupBox1 // this.groupBox1.Controls.Add(this.label2); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.txMgrPort); this.groupBox1.Controls.Add(this.txMgrHost); this.groupBox1.FlatStyle = System.Windows.Forms.FlatStyle.System; this.groupBox1.Location = new System.Drawing.Point(96, 16); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(224, 72); this.groupBox1.TabIndex = 3; this.groupBox1.TabStop = false; this.groupBox1.Text = "Manager Node"; // // label2 // this.label2.Location = new System.Drawing.Point(144, 24); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(32, 16); this.label2.TabIndex = 3; this.label2.Text = "Port"; // // label1 // this.label1.Location = new System.Drawing.Point(16, 24); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(96, 16); this.label1.TabIndex = 2; this.label1.Text = "Host / IP Address"; // // txMgrPort // this.txMgrPort.Location = new System.Drawing.Point(144, 40); this.txMgrPort.Name = "txMgrPort"; this.txMgrPort.Size = new System.Drawing.Size(64, 20); this.txMgrPort.TabIndex = 2; this.txMgrPort.Text = ""; // // txMgrHost // this.txMgrHost.Location = new System.Drawing.Point(16, 40); this.txMgrHost.Name = "txMgrHost"; this.txMgrHost.TabIndex = 1; this.txMgrHost.Text = ""; // // groupBox2 // this.groupBox2.Controls.Add(this.label3); this.groupBox2.Controls.Add(this.txOwnPort); this.groupBox2.Controls.Add(this.cbDedicated); this.groupBox2.Controls.Add(this.label4); this.groupBox2.Controls.Add(this.cmbId); this.groupBox2.FlatStyle = System.Windows.Forms.FlatStyle.System; this.groupBox2.Location = new System.Drawing.Point(96, 176); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(224, 112); this.groupBox2.TabIndex = 4; this.groupBox2.TabStop = false; this.groupBox2.Text = "Own Node"; // // label3 // this.label3.Location = new System.Drawing.Point(144, 64); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(32, 16); this.label3.TabIndex = 3; this.label3.Text = "Port"; // // txOwnPort // this.txOwnPort.Location = new System.Drawing.Point(144, 80); this.txOwnPort.Name = "txOwnPort"; this.txOwnPort.Size = new System.Drawing.Size(64, 20); this.txOwnPort.TabIndex = 7; this.txOwnPort.Text = ""; // // cbDedicated // this.cbDedicated.FlatStyle = System.Windows.Forms.FlatStyle.System; this.cbDedicated.Location = new System.Drawing.Point(16, 72); this.cbDedicated.Name = "cbDedicated"; this.cbDedicated.Size = new System.Drawing.Size(88, 32); this.cbDedicated.TabIndex = 6; this.cbDedicated.Text = "Dedicated?"; // // label4 // this.label4.Location = new System.Drawing.Point(16, 24); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(96, 16); this.label4.TabIndex = 6; this.label4.Text = "Id"; // // btConnect // this.btConnect.FlatStyle = System.Windows.Forms.FlatStyle.System; this.btConnect.Location = new System.Drawing.Point(96, 328); this.btConnect.Name = "btConnect"; this.btConnect.Size = new System.Drawing.Size(104, 23); this.btConnect.TabIndex = 9; this.btConnect.Text = "Connect"; this.btConnect.Click += new System.EventHandler(this.btConnect_Click); // // tabExecution // this.tabExecution.BackColor = System.Drawing.SystemColors.Control; this.tabExecution.Controls.Add(this.btStopExec); this.tabExecution.Controls.Add(this.btStartExec); this.tabExecution.Location = new System.Drawing.Point(4, 22); this.tabExecution.Name = "tabExecution"; this.tabExecution.Size = new System.Drawing.Size(432, 366); this.tabExecution.TabIndex = 1; this.tabExecution.Text = "Manage Execution"; // // btStopExec // this.btStopExec.FlatStyle = System.Windows.Forms.FlatStyle.System; this.btStopExec.Location = new System.Drawing.Point(120, 152); this.btStopExec.Name = "btStopExec"; this.btStopExec.Size = new System.Drawing.Size(192, 23); this.btStopExec.TabIndex = 1; this.btStopExec.Text = "Stop Executing"; this.btStopExec.Click += new System.EventHandler(this.btStopExec_Click); // // btStartExec // this.btStartExec.FlatStyle = System.Windows.Forms.FlatStyle.System; this.btStartExec.Location = new System.Drawing.Point(120, 112); this.btStartExec.Name = "btStartExec"; this.btStartExec.Size = new System.Drawing.Size(192, 23); this.btStartExec.TabIndex = 0; this.btStartExec.Text = "Start Executing"; this.btStartExec.Click += new System.EventHandler(this.btStartExec_Click); // // tabOptions // this.tabOptions.Controls.Add(this.label11); this.tabOptions.Controls.Add(this.udMaxRetry); this.tabOptions.Controls.Add(this.label10); this.tabOptions.Controls.Add(this.label9); this.tabOptions.Controls.Add(this.chkRetryConnect); this.tabOptions.Controls.Add(this.udReconnectInterval); this.tabOptions.Controls.Add(this.label8); this.tabOptions.Controls.Add(this.label7); this.tabOptions.Controls.Add(this.lblHBInt); this.tabOptions.Controls.Add(this.udHBInterval); this.tabOptions.Location = new System.Drawing.Point(4, 22); this.tabOptions.Name = "tabOptions"; this.tabOptions.Size = new System.Drawing.Size(432, 366); this.tabOptions.TabIndex = 2; this.tabOptions.Text = "Options"; // // label11 // this.label11.Location = new System.Drawing.Point(183, 126); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(88, 16); this.label11.TabIndex = 9; this.label11.Text = "times at most."; // // udMaxRetry // this.udMaxRetry.Location = new System.Drawing.Point(118, 124); this.udMaxRetry.Minimum = new System.Decimal(new int[] { 1, 0, 0, -2147483648}); this.udMaxRetry.Name = "udMaxRetry"; this.udMaxRetry.Size = new System.Drawing.Size(52, 20); this.udMaxRetry.TabIndex = 8; this.udMaxRetry.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; this.udMaxRetry.Value = new System.Decimal(new int[] { 3, 0, 0, 0}); // // label10 // this.label10.Location = new System.Drawing.Point(24, 126); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(88, 16); this.label10.TabIndex = 7; this.label10.Text = "Try to reconnect "; // // label9 // this.label9.Location = new System.Drawing.Point(24, 99); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(176, 16); this.label9.TabIndex = 6; this.label9.Text = "Continue to try and connect every"; // // chkRetryConnect // this.chkRetryConnect.Checked = true; this.chkRetryConnect.CheckState = System.Windows.Forms.CheckState.Checked; this.chkRetryConnect.Location = new System.Drawing.Point(24, 72); this.chkRetryConnect.Name = "chkRetryConnect"; this.chkRetryConnect.Size = new System.Drawing.Size(267, 17); this.chkRetryConnect.TabIndex = 5; this.chkRetryConnect.Text = "Retry connecting to Manager on disconnection."; // // udReconnectInterval // this.udReconnectInterval.Location = new System.Drawing.Point(200, 97); this.udReconnectInterval.Maximum = new System.Decimal(new int[] { 10000, 0, 0, 0}); this.udReconnectInterval.Minimum = new System.Decimal(new int[] { 2, 0, 0, 0}); this.udReconnectInterval.Name = "udReconnectInterval"; this.udReconnectInterval.Size = new System.Drawing.Size(72, 20); this.udReconnectInterval.TabIndex = 4; this.udReconnectInterval.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; this.udReconnectInterval.Value = new System.Decimal(new int[] { 30, 0, 0, 0}); // // label8 // this.label8.Location = new System.Drawing.Point(280, 99); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(56, 16); this.label8.TabIndex = 3; this.label8.Text = "seconds."; // // label7 // this.label7.Location = new System.Drawing.Point(216, 24); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(56, 16); this.label7.TabIndex = 2; this.label7.Text = "seconds."; // // lblHBInt // this.lblHBInt.Location = new System.Drawing.Point(24, 23); this.lblHBInt.Name = "lblHBInt"; this.lblHBInt.Size = new System.Drawing.Size(100, 16); this.lblHBInt.TabIndex = 1; this.lblHBInt.Text = "Heartbeat interval"; // // udHBInterval // this.udHBInterval.Location = new System.Drawing.Point(133, 20); this.udHBInterval.Maximum = new System.Decimal(new int[] { 10000, 0, 0, 0}); this.udHBInterval.Minimum = new System.Decimal(new int[] { 2, 0, 0, 0}); this.udHBInterval.Name = "udHBInterval"; this.udHBInterval.Size = new System.Drawing.Size(72, 20); this.udHBInterval.TabIndex = 0; this.udHBInterval.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; this.udHBInterval.Value = new System.Decimal(new int[] { 5, 0, 0, 0}); // // pbar // this.pbar.Location = new System.Drawing.Point(200, 548); this.pbar.Maximum = 5; this.pbar.Name = "pbar"; this.pbar.Size = new System.Drawing.Size(240, 8); this.pbar.Step = 1; this.pbar.TabIndex = 12; this.pbar.Visible = false; // // cmbId // this.cmbId.Location = new System.Drawing.Point(16, 40); this.cmbId.Name = "cmbId"; this.cmbId.Size = new System.Drawing.Size(192, 21); this.cmbId.TabIndex = 11; // // ExecutorTemplateForm // this.AcceptButton = this.btConnect; this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(458, 563); this.Controls.Add(this.pbar); this.Controls.Add(this.groupBox4); this.Controls.Add(this.statusBar); this.Controls.Add(this.tabControl); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.Menu = this.MainMenu; this.Name = "ExecutorTemplateForm"; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Alchemi Executor"; this.Load += new System.EventHandler(this.ExecutorTemplateForm_Load); this.groupBox4.ResumeLayout(false); this.tabControl.ResumeLayout(false); this.tabConnection.ResumeLayout(false); this.groupBox3.ResumeLayout(false); this.groupBox1.ResumeLayout(false); this.groupBox2.ResumeLayout(false); this.tabExecution.ResumeLayout(false); this.tabOptions.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.udMaxRetry)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.udReconnectInterval)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.udHBInterval)).EndInit(); this.ResumeLayout(false); }
public MyCustomApplicationContext() { Assembly _assembly = Assembly.GetExecutingAssembly(); Stream iconStream = _assembly.GetManifestResourceStream("AlwaysOnTop.icon.ico"); using (RegistryKey rkSettings = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\AlwaysOnTop", true)) { if (rkSettings == null) { Registry.CurrentUser.CreateSubKey(@"SOFTWARE\AlwaysOnTop", RegistryKeyPermissionCheck.ReadWriteSubTree); } } RegistryKey regSettings = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\AlwaysOnTop", true); AoTBuild = Methods.TryRegString(regSettings, "Build", AlwaysOnTop.build, true); IP = Methods.TryRegString(regSettings, "Installation Path", AoTPath, true); RaL = Methods.TryRegInt(regSettings, "Run at Login", 0, false); UHK = Methods.TryRegInt(regSettings, "Use Hot Key", 0, false); HK = Methods.TryRegString(regSettings, "Hotkey", "", false); CT = Methods.TryRegInt(regSettings, "Use Context Menu", 0, false); UPM = Methods.TryRegInt(regSettings, "Use Permanent Windows", 0, false); PW = Methods.TryRegString(regSettings, "Windows by Title", "", false); DBN = Methods.TryRegInt(regSettings, "Disable Balloon Notify", 0, false); try { // Initialize Tray Icon trayIcon = new NotifyIcon() { Icon = new Icon(iconStream), ContextMenu = new ContextMenu(new MenuItem[] { new MenuItem("AlwaysOnTop", AoT), new MenuItem("Settings", Settings), new MenuItem("Help", HelpBox), new MenuItem("About", AboutBox), new MenuItem("Exit", Xit) }), Visible = true }; trayIcon.Click += TrayIcon_Click; if (DBN != 1) { trayIcon.ShowBalloonTip(5000, "AlwaysOnTop", "AlwaysOnTop is running in the background.", ToolTipIcon.Info); } if (CT == 1) /* call method to enabled titlebar context menu*/ } { if (UHK == 1 && HK != "") { string delim = "+"; String[] sHK = HK.Split(new string[] { delim }, StringSplitOptions.None); string modifier = sHK[0]; skey = sHK[1]; kMod = new Keys(); switch (modifier.ToLower()) { case "ctrl": kMod = Keys.Control; break; case "alt": kMod = Keys.Alt; break; case "shift": kMod = Keys.Shift; break; case "winkey": kMod = Keys.LWin; break; default: kMod = Keys.None; break; } TypeConverter keysConverter = TypeDescriptor.GetConverter(typeof(Keys)); key = (Keys)keysConverter.ConvertFromString(skey); gkh = new globalKeyboardHook(); gkh.HookedKeys.Add(kMod); gkh.HookedKeys.Add(key); gkh.KeyUp += new KeyEventHandler(keyup_hook); gkh.hook(); if (DBN != 1) { trayIcon.ShowBalloonTip(500, "Settings", kMod + "+" + key + " Hotkey registered", ToolTipIcon.Info); } } if (UPM == 1) /* call method to enabled titlebar context menu*/ } { }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ManagerTemplateForm)); this.uiManagerHostLabel = new System.Windows.Forms.Label(); this.uiManagerHostTextBox = new System.Windows.Forms.TextBox(); this.uiStartButton = new System.Windows.Forms.Button(); this.uiNodeConfigurationGroupBox = new System.Windows.Forms.GroupBox(); this.uiDedicatedCheckBox = new System.Windows.Forms.CheckBox(); this.uiIdLabel = new System.Windows.Forms.Label(); this.uiIntermediateComboBox = new System.Windows.Forms.CheckBox(); this.uiIdTextBox = new System.Windows.Forms.TextBox(); this.uiManagerPortLabel = new System.Windows.Forms.Label(); this.uiManagerPortTextBox = new System.Windows.Forms.TextBox(); this.uiResetButton = new System.Windows.Forms.Button(); this.uiStopButton = new System.Windows.Forms.Button(); this.TrayIcon = new System.Windows.Forms.NotifyIcon(this.components); this.TrayMenu = new System.Windows.Forms.ContextMenu(); this.tmExit = new System.Windows.Forms.MenuItem(); this.MainMenu = new System.Windows.Forms.MainMenu(this.components); this.uiManagerMenuItem = new System.Windows.Forms.MenuItem(); this.uiManagerExitMenuItem = new System.Windows.Forms.MenuItem(); this.uiHelpMenuItem = new System.Windows.Forms.MenuItem(); this.uiHelpAboutMenuItem = new System.Windows.Forms.MenuItem(); this.uiActionsGroupBox = new System.Windows.Forms.GroupBox(); this.uiStatusBar = new System.Windows.Forms.StatusBar(); this.tabControl = new System.Windows.Forms.TabControl(); this.uiSetupConnectionTabPage = new System.Windows.Forms.TabPage(); this.uiAdvancedTabPage = new System.Windows.Forms.TabPage(); this.uiSchedulerComboBox = new System.Windows.Forms.ComboBox(); this.uiStorageConfigurationGroupBox = new System.Windows.Forms.GroupBox(); this.uiDatabaseFileGroupBox = new System.Windows.Forms.GroupBox(); this.uiDatabaseFileButton = new System.Windows.Forms.Button(); this.uiDatabaseFileTextBox = new System.Windows.Forms.TextBox(); this.uiDatabaseTypeLabel = new System.Windows.Forms.Label(); this.uiDatabaseTypeComboBox = new System.Windows.Forms.ComboBox(); this.uiDatabaseServerGroupBox = new System.Windows.Forms.GroupBox(); this.uiDatabasePasswordTextBox = new System.Windows.Forms.TextBox(); this.uiDatabaseServerTextBox = new System.Windows.Forms.TextBox(); this.uiDatabaseUserLabel = new System.Windows.Forms.Label(); this.uiDatabasePasswordLabel = new System.Windows.Forms.Label(); this.uiDatabaseServerLabel = new System.Windows.Forms.Label(); this.uiDatabaseNameTextBox = new System.Windows.Forms.TextBox(); this.uiDatabaseNameLabel = new System.Windows.Forms.Label(); this.uiDatabaseUserTextBox = new System.Windows.Forms.TextBox(); this.uiSchedulerLabel = new System.Windows.Forms.Label(); this.tabEndPoints = new System.Windows.Forms.TabPage(); this.uiProgressBar = new System.Windows.Forms.ProgressBar(); this.uiLogMessagesTextBox = new System.Windows.Forms.TextBox(); this.uiLogMessagesLabel = new System.Windows.Forms.Label(); this.uiViewFullLogLinkLabel = new System.Windows.Forms.LinkLabel(); this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); this.ucEndPoints = new Alchemi.Core.EndPointUtils.EndPointManagerControl(); this.uiNodeConfigurationGroupBox.SuspendLayout(); this.uiActionsGroupBox.SuspendLayout(); this.tabControl.SuspendLayout(); this.uiSetupConnectionTabPage.SuspendLayout(); this.uiAdvancedTabPage.SuspendLayout(); this.uiStorageConfigurationGroupBox.SuspendLayout(); this.uiDatabaseFileGroupBox.SuspendLayout(); this.uiDatabaseServerGroupBox.SuspendLayout(); this.tabEndPoints.SuspendLayout(); this.SuspendLayout(); // // uiManagerHostLabel // this.uiManagerHostLabel.AutoSize = true; this.uiManagerHostLabel.Location = new System.Drawing.Point(38, 103); this.uiManagerHostLabel.Name = "uiManagerHostLabel"; this.uiManagerHostLabel.Size = new System.Drawing.Size(74, 13); this.uiManagerHostLabel.TabIndex = 1; this.uiManagerHostLabel.Text = "Manager Host"; this.uiManagerHostLabel.TextAlign = System.Drawing.ContentAlignment.BottomRight; // // uiManagerHostTextBox // this.uiManagerHostTextBox.Location = new System.Drawing.Point(120, 100); this.uiManagerHostTextBox.Name = "uiManagerHostTextBox"; this.uiManagerHostTextBox.Size = new System.Drawing.Size(104, 20); this.uiManagerHostTextBox.TabIndex = 9; // // uiStartButton // this.uiStartButton.FlatStyle = System.Windows.Forms.FlatStyle.System; this.uiStartButton.Location = new System.Drawing.Point(88, 50); this.uiStartButton.Name = "uiStartButton"; this.uiStartButton.Size = new System.Drawing.Size(128, 23); this.uiStartButton.TabIndex = 12; this.uiStartButton.Text = "Start"; this.uiStartButton.Click += new System.EventHandler(this.uiStartButton_Click); // // uiNodeConfigurationGroupBox // this.uiNodeConfigurationGroupBox.Controls.Add(this.uiDedicatedCheckBox); this.uiNodeConfigurationGroupBox.Controls.Add(this.uiIdLabel); this.uiNodeConfigurationGroupBox.Controls.Add(this.uiIntermediateComboBox); this.uiNodeConfigurationGroupBox.Controls.Add(this.uiIdTextBox); this.uiNodeConfigurationGroupBox.Controls.Add(this.uiManagerPortLabel); this.uiNodeConfigurationGroupBox.Controls.Add(this.uiManagerPortTextBox); this.uiNodeConfigurationGroupBox.Controls.Add(this.uiManagerHostLabel); this.uiNodeConfigurationGroupBox.Controls.Add(this.uiManagerHostTextBox); this.uiNodeConfigurationGroupBox.FlatStyle = System.Windows.Forms.FlatStyle.System; this.uiNodeConfigurationGroupBox.Location = new System.Drawing.Point(8, 12); this.uiNodeConfigurationGroupBox.Name = "uiNodeConfigurationGroupBox"; this.uiNodeConfigurationGroupBox.Size = new System.Drawing.Size(416, 171); this.uiNodeConfigurationGroupBox.TabIndex = 6; this.uiNodeConfigurationGroupBox.TabStop = false; this.uiNodeConfigurationGroupBox.Text = "Node Configuration"; // // uiDedicatedCheckBox // this.uiDedicatedCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.System; this.uiDedicatedCheckBox.Location = new System.Drawing.Point(120, 68); this.uiDedicatedCheckBox.Name = "uiDedicatedCheckBox"; this.uiDedicatedCheckBox.Size = new System.Drawing.Size(88, 24); this.uiDedicatedCheckBox.TabIndex = 8; this.uiDedicatedCheckBox.Text = "Dedicated"; // // uiIdLabel // this.uiIdLabel.Location = new System.Drawing.Point(96, 44); this.uiIdLabel.Name = "uiIdLabel"; this.uiIdLabel.Size = new System.Drawing.Size(16, 16); this.uiIdLabel.TabIndex = 12; this.uiIdLabel.Text = "Id"; this.uiIdLabel.TextAlign = System.Drawing.ContentAlignment.BottomRight; // // uiIntermediateComboBox // this.uiIntermediateComboBox.Enabled = false; this.uiIntermediateComboBox.FlatStyle = System.Windows.Forms.FlatStyle.System; this.uiIntermediateComboBox.Location = new System.Drawing.Point(120, 20); this.uiIntermediateComboBox.Name = "uiIntermediateComboBox"; this.uiIntermediateComboBox.Size = new System.Drawing.Size(88, 24); this.uiIntermediateComboBox.TabIndex = 6; this.uiIntermediateComboBox.TabStop = false; this.uiIntermediateComboBox.Text = "Intermediate"; // // uiIdTextBox // this.uiIdTextBox.Enabled = false; this.uiIdTextBox.Location = new System.Drawing.Point(120, 44); this.uiIdTextBox.Name = "uiIdTextBox"; this.uiIdTextBox.Size = new System.Drawing.Size(240, 20); this.uiIdTextBox.TabIndex = 7; this.uiIdTextBox.TabStop = false; // // uiManagerPortLabel // this.uiManagerPortLabel.AutoSize = true; this.uiManagerPortLabel.Location = new System.Drawing.Point(41, 135); this.uiManagerPortLabel.Name = "uiManagerPortLabel"; this.uiManagerPortLabel.Size = new System.Drawing.Size(71, 13); this.uiManagerPortLabel.TabIndex = 6; this.uiManagerPortLabel.Text = "Manager Port"; this.uiManagerPortLabel.TextAlign = System.Drawing.ContentAlignment.BottomRight; // // uiManagerPortTextBox // this.uiManagerPortTextBox.Location = new System.Drawing.Point(120, 132); this.uiManagerPortTextBox.Name = "uiManagerPortTextBox"; this.uiManagerPortTextBox.Size = new System.Drawing.Size(104, 20); this.uiManagerPortTextBox.TabIndex = 10; // // uiResetButton // this.uiResetButton.FlatStyle = System.Windows.Forms.FlatStyle.System; this.uiResetButton.Location = new System.Drawing.Point(88, 20); this.uiResetButton.Name = "uiResetButton"; this.uiResetButton.Size = new System.Drawing.Size(248, 23); this.uiResetButton.TabIndex = 11; this.uiResetButton.TabStop = false; this.uiResetButton.Text = "Reset"; this.uiResetButton.Click += new System.EventHandler(this.uiResetButton_Click); // // uiStopButton // this.uiStopButton.FlatStyle = System.Windows.Forms.FlatStyle.System; this.uiStopButton.Location = new System.Drawing.Point(224, 50); this.uiStopButton.Name = "uiStopButton"; this.uiStopButton.Size = new System.Drawing.Size(112, 23); this.uiStopButton.TabIndex = 13; this.uiStopButton.Text = "Stop"; this.uiStopButton.Click += new System.EventHandler(this.uiStopButton_Click); // // TrayIcon // this.TrayIcon.ContextMenu = this.TrayMenu; this.TrayIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("TrayIcon.Icon"))); this.TrayIcon.Text = "Alchemi Manager"; this.TrayIcon.Visible = true; this.TrayIcon.Click += new System.EventHandler(this.TrayIcon_Click); // // TrayMenu // this.TrayMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.tmExit }); // // tmExit // this.tmExit.Index = 0; this.tmExit.Text = "Exit"; this.tmExit.Click += new System.EventHandler(this.tmExit_Click); // // MainMenu // this.MainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.uiManagerMenuItem, this.uiHelpMenuItem }); // // uiManagerMenuItem // this.uiManagerMenuItem.Index = 0; this.uiManagerMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.uiManagerExitMenuItem }); this.uiManagerMenuItem.Text = "Manager"; // // uiManagerExitMenuItem // this.uiManagerExitMenuItem.Index = 0; this.uiManagerExitMenuItem.Text = "Exit"; this.uiManagerExitMenuItem.Click += new System.EventHandler(this.uiManagerExitMenuItem_Click); // // uiHelpMenuItem // this.uiHelpMenuItem.Index = 1; this.uiHelpMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.uiHelpAboutMenuItem }); this.uiHelpMenuItem.Text = "Help"; // // uiHelpAboutMenuItem // this.uiHelpAboutMenuItem.Index = 0; this.uiHelpAboutMenuItem.Text = "About"; this.uiHelpAboutMenuItem.Click += new System.EventHandler(this.uiHelpAboutMenuItem_Click); // // uiActionsGroupBox // this.uiActionsGroupBox.Controls.Add(this.uiResetButton); this.uiActionsGroupBox.Controls.Add(this.uiStopButton); this.uiActionsGroupBox.Controls.Add(this.uiStartButton); this.uiActionsGroupBox.FlatStyle = System.Windows.Forms.FlatStyle.System; this.uiActionsGroupBox.Location = new System.Drawing.Point(23, 305); this.uiActionsGroupBox.Name = "uiActionsGroupBox"; this.uiActionsGroupBox.Size = new System.Drawing.Size(416, 89); this.uiActionsGroupBox.TabIndex = 9; this.uiActionsGroupBox.TabStop = false; this.uiActionsGroupBox.Text = "Actions"; // // uiStatusBar // this.uiStatusBar.Location = new System.Drawing.Point(0, 447); this.uiStatusBar.Name = "uiStatusBar"; this.uiStatusBar.Size = new System.Drawing.Size(456, 22); this.uiStatusBar.TabIndex = 10; // // tabControl // this.tabControl.Controls.Add(this.uiSetupConnectionTabPage); this.tabControl.Controls.Add(this.uiAdvancedTabPage); this.tabControl.Controls.Add(this.tabEndPoints); this.tabControl.Location = new System.Drawing.Point(10, 10); this.tabControl.Name = "tabControl"; this.tabControl.SelectedIndex = 0; this.tabControl.Size = new System.Drawing.Size(440, 289); this.tabControl.TabIndex = 12; // // uiSetupConnectionTabPage // this.uiSetupConnectionTabPage.Controls.Add(this.uiNodeConfigurationGroupBox); this.uiSetupConnectionTabPage.Location = new System.Drawing.Point(4, 22); this.uiSetupConnectionTabPage.Name = "uiSetupConnectionTabPage"; this.uiSetupConnectionTabPage.Size = new System.Drawing.Size(432, 263); this.uiSetupConnectionTabPage.TabIndex = 0; this.uiSetupConnectionTabPage.Text = "Setup Connection"; this.uiSetupConnectionTabPage.UseVisualStyleBackColor = true; // // uiAdvancedTabPage // this.uiAdvancedTabPage.Controls.Add(this.uiSchedulerComboBox); this.uiAdvancedTabPage.Controls.Add(this.uiStorageConfigurationGroupBox); this.uiAdvancedTabPage.Controls.Add(this.uiSchedulerLabel); this.uiAdvancedTabPage.Location = new System.Drawing.Point(4, 22); this.uiAdvancedTabPage.Name = "uiAdvancedTabPage"; this.uiAdvancedTabPage.Padding = new System.Windows.Forms.Padding(3); this.uiAdvancedTabPage.Size = new System.Drawing.Size(432, 263); this.uiAdvancedTabPage.TabIndex = 1; this.uiAdvancedTabPage.Text = "Advanced"; this.uiAdvancedTabPage.UseVisualStyleBackColor = true; // // uiSchedulerComboBox // this.uiSchedulerComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; this.uiSchedulerComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.uiSchedulerComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.uiSchedulerComboBox.FormattingEnabled = true; this.uiSchedulerComboBox.Location = new System.Drawing.Point(118, 210); this.uiSchedulerComboBox.Name = "uiSchedulerComboBox"; this.uiSchedulerComboBox.Size = new System.Drawing.Size(296, 21); this.uiSchedulerComboBox.TabIndex = 34; // // uiStorageConfigurationGroupBox // this.uiStorageConfigurationGroupBox.Controls.Add(this.uiDatabaseFileGroupBox); this.uiStorageConfigurationGroupBox.Controls.Add(this.uiDatabaseTypeLabel); this.uiStorageConfigurationGroupBox.Controls.Add(this.uiDatabaseTypeComboBox); this.uiStorageConfigurationGroupBox.Controls.Add(this.uiDatabaseServerGroupBox); this.uiStorageConfigurationGroupBox.Location = new System.Drawing.Point(9, 6); this.uiStorageConfigurationGroupBox.Name = "uiStorageConfigurationGroupBox"; this.uiStorageConfigurationGroupBox.Size = new System.Drawing.Size(416, 155); this.uiStorageConfigurationGroupBox.TabIndex = 33; this.uiStorageConfigurationGroupBox.TabStop = false; this.uiStorageConfigurationGroupBox.Text = "Storage Configuration"; // // uiDatabaseFileGroupBox // this.uiDatabaseFileGroupBox.Controls.Add(this.uiDatabaseFileButton); this.uiDatabaseFileGroupBox.Controls.Add(this.uiDatabaseFileTextBox); this.uiDatabaseFileGroupBox.Location = new System.Drawing.Point(9, 40); this.uiDatabaseFileGroupBox.Name = "uiDatabaseFileGroupBox"; this.uiDatabaseFileGroupBox.Size = new System.Drawing.Size(378, 63); this.uiDatabaseFileGroupBox.TabIndex = 43; this.uiDatabaseFileGroupBox.TabStop = false; this.uiDatabaseFileGroupBox.Text = "Database File"; // // uiDatabaseFileButton // this.uiDatabaseFileButton.Location = new System.Drawing.Point(330, 21); this.uiDatabaseFileButton.Name = "uiDatabaseFileButton"; this.uiDatabaseFileButton.Size = new System.Drawing.Size(31, 23); this.uiDatabaseFileButton.TabIndex = 3; this.uiDatabaseFileButton.Text = "..."; this.uiDatabaseFileButton.UseVisualStyleBackColor = true; this.uiDatabaseFileButton.Click += new System.EventHandler(this.uiDatabaseFileButton_Click); // // uiDatabaseFileTextBox // this.uiDatabaseFileTextBox.Enabled = false; this.uiDatabaseFileTextBox.Location = new System.Drawing.Point(12, 21); this.uiDatabaseFileTextBox.Name = "uiDatabaseFileTextBox"; this.uiDatabaseFileTextBox.Size = new System.Drawing.Size(312, 20); this.uiDatabaseFileTextBox.TabIndex = 2; // // uiDatabaseTypeLabel // this.uiDatabaseTypeLabel.AutoSize = true; this.uiDatabaseTypeLabel.Location = new System.Drawing.Point(6, 22); this.uiDatabaseTypeLabel.Name = "uiDatabaseTypeLabel"; this.uiDatabaseTypeLabel.Size = new System.Drawing.Size(31, 13); this.uiDatabaseTypeLabel.TabIndex = 42; this.uiDatabaseTypeLabel.Text = "Type"; this.uiDatabaseTypeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // uiDatabaseTypeComboBox // this.uiDatabaseTypeComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; this.uiDatabaseTypeComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.uiDatabaseTypeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.uiDatabaseTypeComboBox.FormattingEnabled = true; this.uiDatabaseTypeComboBox.Location = new System.Drawing.Point(43, 19); this.uiDatabaseTypeComboBox.Name = "uiDatabaseTypeComboBox"; this.uiDatabaseTypeComboBox.Size = new System.Drawing.Size(296, 21); this.uiDatabaseTypeComboBox.TabIndex = 41; this.uiDatabaseTypeComboBox.SelectedIndexChanged += new System.EventHandler(this.uiDatabaseTypeComboBox_SelectedIndexChanged); // // uiDatabaseServerGroupBox // this.uiDatabaseServerGroupBox.Controls.Add(this.uiDatabasePasswordTextBox); this.uiDatabaseServerGroupBox.Controls.Add(this.uiDatabaseServerTextBox); this.uiDatabaseServerGroupBox.Controls.Add(this.uiDatabaseUserLabel); this.uiDatabaseServerGroupBox.Controls.Add(this.uiDatabasePasswordLabel); this.uiDatabaseServerGroupBox.Controls.Add(this.uiDatabaseServerLabel); this.uiDatabaseServerGroupBox.Controls.Add(this.uiDatabaseNameTextBox); this.uiDatabaseServerGroupBox.Controls.Add(this.uiDatabaseNameLabel); this.uiDatabaseServerGroupBox.Controls.Add(this.uiDatabaseUserTextBox); this.uiDatabaseServerGroupBox.Location = new System.Drawing.Point(6, 49); this.uiDatabaseServerGroupBox.Name = "uiDatabaseServerGroupBox"; this.uiDatabaseServerGroupBox.Size = new System.Drawing.Size(378, 86); this.uiDatabaseServerGroupBox.TabIndex = 33; this.uiDatabaseServerGroupBox.TabStop = false; this.uiDatabaseServerGroupBox.Text = "Database Server Configuration"; // // uiDatabasePasswordTextBox // this.uiDatabasePasswordTextBox.Location = new System.Drawing.Point(260, 54); this.uiDatabasePasswordTextBox.Name = "uiDatabasePasswordTextBox"; this.uiDatabasePasswordTextBox.PasswordChar = '*'; this.uiDatabasePasswordTextBox.Size = new System.Drawing.Size(104, 20); this.uiDatabasePasswordTextBox.TabIndex = 35; // // uiDatabaseServerTextBox // this.uiDatabaseServerTextBox.Location = new System.Drawing.Point(68, 22); this.uiDatabaseServerTextBox.Name = "uiDatabaseServerTextBox"; this.uiDatabaseServerTextBox.Size = new System.Drawing.Size(104, 20); this.uiDatabaseServerTextBox.TabIndex = 32; // // uiDatabaseUserLabel // this.uiDatabaseUserLabel.AutoSize = true; this.uiDatabaseUserLabel.Location = new System.Drawing.Point(187, 25); this.uiDatabaseUserLabel.Name = "uiDatabaseUserLabel"; this.uiDatabaseUserLabel.Size = new System.Drawing.Size(55, 13); this.uiDatabaseUserLabel.TabIndex = 37; this.uiDatabaseUserLabel.Text = "Username"; this.uiDatabaseUserLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // uiDatabasePasswordLabel // this.uiDatabasePasswordLabel.AutoSize = true; this.uiDatabasePasswordLabel.Location = new System.Drawing.Point(187, 57); this.uiDatabasePasswordLabel.Name = "uiDatabasePasswordLabel"; this.uiDatabasePasswordLabel.Size = new System.Drawing.Size(53, 13); this.uiDatabasePasswordLabel.TabIndex = 36; this.uiDatabasePasswordLabel.Text = "Password"; this.uiDatabasePasswordLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // uiDatabaseServerLabel // this.uiDatabaseServerLabel.AutoSize = true; this.uiDatabaseServerLabel.Location = new System.Drawing.Point(9, 25); this.uiDatabaseServerLabel.Name = "uiDatabaseServerLabel"; this.uiDatabaseServerLabel.Size = new System.Drawing.Size(38, 13); this.uiDatabaseServerLabel.TabIndex = 38; this.uiDatabaseServerLabel.Text = "Server"; this.uiDatabaseServerLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // uiDatabaseNameTextBox // this.uiDatabaseNameTextBox.Location = new System.Drawing.Point(68, 54); this.uiDatabaseNameTextBox.Name = "uiDatabaseNameTextBox"; this.uiDatabaseNameTextBox.Size = new System.Drawing.Size(104, 20); this.uiDatabaseNameTextBox.TabIndex = 33; // // uiDatabaseNameLabel // this.uiDatabaseNameLabel.AutoSize = true; this.uiDatabaseNameLabel.Location = new System.Drawing.Point(9, 57); this.uiDatabaseNameLabel.Name = "uiDatabaseNameLabel"; this.uiDatabaseNameLabel.Size = new System.Drawing.Size(53, 13); this.uiDatabaseNameLabel.TabIndex = 39; this.uiDatabaseNameLabel.Text = "DB Name"; this.uiDatabaseNameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // uiDatabaseUserTextBox // this.uiDatabaseUserTextBox.Location = new System.Drawing.Point(260, 22); this.uiDatabaseUserTextBox.Name = "uiDatabaseUserTextBox"; this.uiDatabaseUserTextBox.Size = new System.Drawing.Size(104, 20); this.uiDatabaseUserTextBox.TabIndex = 34; // // uiSchedulerLabel // this.uiSchedulerLabel.AutoSize = true; this.uiSchedulerLabel.Location = new System.Drawing.Point(33, 213); this.uiSchedulerLabel.Name = "uiSchedulerLabel"; this.uiSchedulerLabel.Size = new System.Drawing.Size(55, 13); this.uiSchedulerLabel.TabIndex = 32; this.uiSchedulerLabel.Text = "Scheduler"; this.uiSchedulerLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // tabEndPoints // this.tabEndPoints.Controls.Add(this.ucEndPoints); this.tabEndPoints.Location = new System.Drawing.Point(4, 22); this.tabEndPoints.Name = "tabEndPoints"; this.tabEndPoints.Padding = new System.Windows.Forms.Padding(3); this.tabEndPoints.Size = new System.Drawing.Size(432, 263); this.tabEndPoints.TabIndex = 2; this.tabEndPoints.Text = "End Points"; this.tabEndPoints.UseVisualStyleBackColor = true; // // uiProgressBar // this.uiProgressBar.Location = new System.Drawing.Point(23, 575); this.uiProgressBar.Name = "uiProgressBar"; this.uiProgressBar.Size = new System.Drawing.Size(414, 10); this.uiProgressBar.Step = 1; this.uiProgressBar.TabIndex = 13; this.uiProgressBar.Visible = false; // // uiLogMessagesTextBox // this.uiLogMessagesTextBox.BackColor = System.Drawing.SystemColors.Info; this.uiLogMessagesTextBox.Location = new System.Drawing.Point(22, 424); this.uiLogMessagesTextBox.Multiline = true; this.uiLogMessagesTextBox.Name = "uiLogMessagesTextBox"; this.uiLogMessagesTextBox.ReadOnly = true; this.uiLogMessagesTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.uiLogMessagesTextBox.Size = new System.Drawing.Size(416, 145); this.uiLogMessagesTextBox.TabIndex = 15; this.uiLogMessagesTextBox.TabStop = false; // // uiLogMessagesLabel // this.uiLogMessagesLabel.Location = new System.Drawing.Point(20, 406); this.uiLogMessagesLabel.Name = "uiLogMessagesLabel"; this.uiLogMessagesLabel.Size = new System.Drawing.Size(88, 15); this.uiLogMessagesLabel.TabIndex = 16; this.uiLogMessagesLabel.Text = "Log Messages"; this.uiLogMessagesLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // uiViewFullLogLinkLabel // this.uiViewFullLogLinkLabel.AutoSize = true; this.uiViewFullLogLinkLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.uiViewFullLogLinkLabel.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; this.uiViewFullLogLinkLabel.Location = new System.Drawing.Point(94, 404); this.uiViewFullLogLinkLabel.Name = "uiViewFullLogLinkLabel"; this.uiViewFullLogLinkLabel.Size = new System.Drawing.Size(98, 15); this.uiViewFullLogLinkLabel.TabIndex = 17; this.uiViewFullLogLinkLabel.TabStop = true; this.uiViewFullLogLinkLabel.Text = "( View full log ... )"; this.uiViewFullLogLinkLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // openFileDialog // this.openFileDialog.DefaultExt = "db"; // // ucEndPoints // this.ucEndPoints.EndPoints = null; this.ucEndPoints.Location = new System.Drawing.Point(6, 6); this.ucEndPoints.Name = "ucEndPoints"; this.ucEndPoints.Size = new System.Drawing.Size(420, 251); this.ucEndPoints.TabIndex = 0; // // ManagerTemplateForm // this.AcceptButton = this.uiStartButton; this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(456, 469); this.Controls.Add(this.uiViewFullLogLinkLabel); this.Controls.Add(this.uiLogMessagesLabel); this.Controls.Add(this.uiActionsGroupBox); this.Controls.Add(this.uiLogMessagesTextBox); this.Controls.Add(this.uiProgressBar); this.Controls.Add(this.tabControl); this.Controls.Add(this.uiStatusBar); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.Menu = this.MainMenu; this.Name = "ManagerTemplateForm"; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Alchemi Manager"; this.Load += new System.EventHandler(this.ManagerTemplateForm_Load); this.uiNodeConfigurationGroupBox.ResumeLayout(false); this.uiNodeConfigurationGroupBox.PerformLayout(); this.uiActionsGroupBox.ResumeLayout(false); this.tabControl.ResumeLayout(false); this.uiSetupConnectionTabPage.ResumeLayout(false); this.uiAdvancedTabPage.ResumeLayout(false); this.uiAdvancedTabPage.PerformLayout(); this.uiStorageConfigurationGroupBox.ResumeLayout(false); this.uiStorageConfigurationGroupBox.PerformLayout(); this.uiDatabaseFileGroupBox.ResumeLayout(false); this.uiDatabaseFileGroupBox.PerformLayout(); this.uiDatabaseServerGroupBox.ResumeLayout(false); this.uiDatabaseServerGroupBox.PerformLayout(); this.tabEndPoints.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); }
public void Stop() { this.notifyIcon.Visible = false; this.notifyIcon = null; }
/// <summary> /// 接続先ウィンドウが閉じられた /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void target_Closing(object sender, CancelEventArgs e) { m_NotifyIcon.Dispose(); m_NotifyIcon = null; }
public MainWindow() { InitializeComponent(); WindowStyle = WindowStyle.SingleBorderWindow; Grid.Effect = new BlurEffect() { Radius = 5, RenderingBias = RenderingBias.Performance }; if (TimeZoneInfo.Local.Id.Contains("China Standard Time") && RegionInfo.CurrentRegion.GeoId == 45) { //Mainland China PRC DnsSettings.SecondDnsIp = IPAddress.Parse("119.29.29.29"); DnsSettings.HttpsDnsUrl = "https://neatdns.ustclug.org/resolve"; UrlSettings.MDnsList = "https://cdn.jsdelivr.net/gh/mili-tan/AuroraDNS.GUI/List/L10N/DNS-CN.list"; UrlSettings.WhatMyIpApi = "https://myip.ustclug.org/"; } else if (TimeZoneInfo.Local.Id.Contains("Taipei Standard Time") && RegionInfo.CurrentRegion.GeoId == 237) { //Taiwan ROC DnsSettings.SecondDnsIp = IPAddress.Parse("101.101.101.101"); DnsSettings.HttpsDnsUrl = "https://dns.twnic.tw/dns-query"; UrlSettings.MDnsList = "https://cdn.jsdelivr.net/gh/mili-tan/AuroraDNS.GUI/List/L10N/DNS-TW.list"; } else if (RegionInfo.CurrentRegion.GeoId == 104) { //HongKong SAR UrlSettings.MDnsList = "https://cdn.jsdelivr.net/gh/mili-tan/AuroraDNS.GUI/List/L10N/DNS-HK.list"; } if (File.Exists($"{SetupBasePath}url.json")) { UrlSettings.ReadConfig($"{SetupBasePath}url.json"); } if (File.Exists($"{SetupBasePath}config.json")) { DnsSettings.ReadConfig($"{SetupBasePath}config.json"); } if (DnsSettings.BlackListEnable && File.Exists($"{SetupBasePath}black.list")) { DnsSettings.ReadBlackList($"{SetupBasePath}black.list"); } if (DnsSettings.WhiteListEnable && File.Exists($"{SetupBasePath}white.list")) { DnsSettings.ReadWhiteList($"{SetupBasePath}white.list"); } if (DnsSettings.WhiteListEnable && File.Exists($"{SetupBasePath}rewrite.list")) { DnsSettings.ReadWhiteList($"{SetupBasePath}rewrite.list"); } ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; // if (false) // ServicePointManager.ServerCertificateValidationCallback += // (sender, cert, chain, sslPolicyErrors) => true; // //强烈不建议 忽略 TLS 证书安全错误 // // switch (0.0) // { // case 1: // ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls; // break; // case 1.1: // ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11; // break; // case 1.2: // ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; // break; // default: // ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11; // break; // } LocIPAddr = IPAddress.Parse(IpTools.GetLocIp()); IntIPAddr = IPAddress.Parse(IpTools.GetIntIp()); MDnsServer = new DnsServer(DnsSettings.ListenIp, 10, 10); MDnsServer.QueryReceived += QueryResolve.ServerOnQueryReceived; MDnsSvrWorker.DoWork += (sender, args) => MDnsServer.Start(); MDnsSvrWorker.Disposed += (sender, args) => MDnsServer.Stop(); NotifyIcon = new NotifyIcon() { Text = @"AuroraDNS", Visible = false, Icon = Properties.Resources.AuroraWhite }; WinFormMenuItem showItem = new WinFormMenuItem("最小化 / 恢复", MinimizedNormal); WinFormMenuItem restartItem = new WinFormMenuItem("重新启动", (sender, args) => { if (MDnsSvrWorker.IsBusy) { MDnsSvrWorker.Dispose(); } Process.Start(new ProcessStartInfo { FileName = GetType().Assembly.Location }); Environment.Exit(Environment.ExitCode); }); WinFormMenuItem notepadLogItem = new WinFormMenuItem("查阅日志", (sender, args) => { if (File.Exists( $"{SetupBasePath}Log/{DateTime.Today.Year}{DateTime.Today.Month:00}{DateTime.Today.Day:00}.log")) { Process.Start(new ProcessStartInfo("notepad.exe", $"{SetupBasePath}Log/{DateTime.Today.Year}{DateTime.Today.Month:00}{DateTime.Today.Day:00}.log")); } else { MessageBox.Show("找不到当前日志文件,或当前未产生日志文件。"); } }); WinFormMenuItem abootItem = new WinFormMenuItem("关于…", (sender, args) => new AboutWindow().ShowDialog()); WinFormMenuItem updateItem = new WinFormMenuItem("检查更新…", (sender, args) => MyTools.CheckUpdate(GetType().Assembly.Location)); WinFormMenuItem settingsItem = new WinFormMenuItem("设置…", (sender, args) => new SettingsWindow().ShowDialog()); WinFormMenuItem exitItem = new WinFormMenuItem("退出", (sender, args) => Environment.Exit(Environment.ExitCode)); NotifyIcon.ContextMenu = new WinFormContextMenu(new[] { showItem, notepadLogItem, new WinFormMenuItem("-"), abootItem, updateItem, settingsItem, new WinFormMenuItem("-"), restartItem, exitItem }); NotifyIcon.DoubleClick += MinimizedNormal; if (MyTools.IsNslookupLocDns()) { IsSysDns.ToolTip = "已设为系统 DNS"; } }
public ServerNotifyIcon(ILogManager logManager, IServerApplicationHost appHost, IServerConfigurationManager configurationManager, ILocalizationManager localization) { _logger = logManager.GetLogger("MainWindow"); _localization = localization; _appHost = appHost; _configurationManager = configurationManager; var components = new System.ComponentModel.Container(); var resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); contextMenuStrip1 = new ContextMenuStrip(components); notifyIcon1 = new NotifyIcon(components); cmdExit = new ToolStripMenuItem(); cmdCommunity = new ToolStripMenuItem(); toolStripSeparator1 = new ToolStripSeparator(); cmdRestart = new ToolStripMenuItem(); toolStripSeparator2 = new ToolStripSeparator(); cmdConfigure = new ToolStripMenuItem(); cmdBrowse = new ToolStripMenuItem(); // // notifyIcon1 // notifyIcon1.ContextMenuStrip = contextMenuStrip1; notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); notifyIcon1.Text = "Emby"; notifyIcon1.Visible = true; // // contextMenuStrip1 // contextMenuStrip1.Items.AddRange(new ToolStripItem[] { cmdBrowse, cmdConfigure, toolStripSeparator2, cmdRestart, toolStripSeparator1, cmdCommunity, cmdExit }); contextMenuStrip1.Name = "contextMenuStrip1"; contextMenuStrip1.ShowCheckMargin = true; contextMenuStrip1.ShowImageMargin = false; contextMenuStrip1.Size = new System.Drawing.Size(209, 214); // // cmdExit // cmdExit.Name = "cmdExit"; cmdExit.Size = new System.Drawing.Size(208, 22); // // cmdCommunity // cmdCommunity.Name = "cmdCommunity"; cmdCommunity.Size = new System.Drawing.Size(208, 22); // // toolStripSeparator1 // toolStripSeparator1.Name = "toolStripSeparator1"; toolStripSeparator1.Size = new System.Drawing.Size(205, 6); // // cmdRestart // cmdRestart.Name = "cmdRestart"; cmdRestart.Size = new System.Drawing.Size(208, 22); // // toolStripSeparator2 // toolStripSeparator2.Name = "toolStripSeparator2"; toolStripSeparator2.Size = new System.Drawing.Size(205, 6); // // cmdConfigure // cmdConfigure.Name = "cmdConfigure"; cmdConfigure.Size = new System.Drawing.Size(208, 22); // // cmdBrowse // cmdBrowse.Name = "cmdBrowse"; cmdBrowse.Size = new System.Drawing.Size(208, 22); cmdExit.Click += cmdExit_Click; cmdRestart.Click += cmdRestart_Click; cmdConfigure.Click += cmdConfigure_Click; cmdCommunity.Click += cmdCommunity_Click; cmdBrowse.Click += cmdBrowse_Click; _configurationManager.ConfigurationUpdated += Instance_ConfigurationUpdated; LocalizeText(); notifyIcon1.DoubleClick += notifyIcon1_DoubleClick; Application.ApplicationExit += Application_ApplicationExit; }
private void Notify(String message) { NotifyIcon.ShowBalloonTip(5000, "EZBlocker", message, ToolTipIcon.None); }
/// <summary> /// デザイナ サポートに必要なメソッドです。このメソッドの内容を /// コード エディタで変更しないでください。 /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MainForm)); this._list = new System.Windows.Forms.ListView(); this._sshHostColumn = new System.Windows.Forms.ColumnHeader(); this._accountColumn = new System.Windows.Forms.ColumnHeader(); this._typeColumn = new System.Windows.Forms.ColumnHeader(); this._listenPortColumn = new System.Windows.Forms.ColumnHeader(); this._destinationHostColumn = new System.Windows.Forms.ColumnHeader(); this._destinationPortColumn = new System.Windows.Forms.ColumnHeader(); this._statusColumn = new System.Windows.Forms.ColumnHeader(); this._mainMenu = new MenuStrip(); this._menuFile = new ToolStripMenuItem(); this._menuNewProfile = new ToolStripMenuItem(); this._menuTaskTray = new ToolStripMenuItem(); this._menuExit = new ToolStripMenuItem(); this._menuProfile = new ToolStripMenuItem(); this._menuProfileProperty = new ToolStripMenuItem(); this._menuProfileRemove = new ToolStripMenuItem(); this._menuProfileUp = new ToolStripMenuItem(); this._menuProfileDown = new ToolStripMenuItem(); this._menuProfileConnect = new ToolStripMenuItem(); this._menuProfileDisconnect = new ToolStripMenuItem(); this._menuAllProfile = new ToolStripMenuItem(); this._menuAllProfileConnect = new ToolStripMenuItem(); this._menuAllProfileDisconnect = new ToolStripMenuItem(); this._menuTool = new ToolStripMenuItem(); this._menuOption = new ToolStripMenuItem(); this._menuHelp = new ToolStripMenuItem(); this._menuAboutBox = new ToolStripMenuItem(); this._taskTrayIcon = new System.Windows.Forms.NotifyIcon(this.components); this.SuspendLayout(); // // _list // this._list.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this._sshHostColumn, this._accountColumn, this._typeColumn, this._listenPortColumn, this._destinationHostColumn, this._destinationPortColumn, this._statusColumn }); this._list.Dock = System.Windows.Forms.DockStyle.Fill; this._list.FullRowSelect = true; this._list.GridLines = true; this._list.Location = new System.Drawing.Point(0, 0); this._list.MultiSelect = false; this._list.Name = "_list"; this._list.Size = new System.Drawing.Size(504, 345); this._list.TabIndex = 0; this._list.View = System.Windows.Forms.View.Details; this._list.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.OnListViewKeyPress); this._list.DoubleClick += new System.EventHandler(this.OnListViewDoubleClicked); this._list.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OnListViewMouseUp); this._list.SelectedIndexChanged += new System.EventHandler(this.OnSelectedIndexChanged); // // _sshHostColumn // this._sshHostColumn.Width = 69; // // _accountColumn // // // _typeColumn // // // _listenPortColumn // this._listenPortColumn.Width = 75; // // _destinationHostColumn // this._destinationHostColumn.Width = 100; // // _destinationPortColumn // this._destinationPortColumn.Width = 75; // // _statusColumn // // // _mainMenu // this._mainMenu.Items.AddRange(new ToolStripMenuItem[] { this._menuFile, this._menuProfile, this._menuAllProfile, this._menuTool, this._menuHelp }); // // _menuFile // this._menuFile.DropDownItems.AddRange(new ToolStripItem[] { this._menuNewProfile, new ToolStripSeparator(), this._menuTaskTray, this._menuExit }); // // _menuNewProfile // this._menuNewProfile.Click += new System.EventHandler(this.OnMenu); // // _menuTaskTray // this._menuTaskTray.Click += new System.EventHandler(this.OnMenu); // // _menuExit // this._menuExit.Click += new System.EventHandler(this.OnMenu); // // _menuProfile // this._menuProfile.DropDownItems.AddRange(new ToolStripItem[] { this._menuProfileProperty, this._menuProfileRemove, new ToolStripSeparator(), this._menuProfileUp, this._menuProfileDown, new ToolStripSeparator(), this._menuProfileConnect, this._menuProfileDisconnect }); this._menuProfile.DropDownOpening += new System.EventHandler(this.OnProfileMenuClicked); // // _menuProfileProperty // this._menuProfileProperty.Click += new System.EventHandler(this.OnMenu); // // _menuProfileRemove // this._menuProfileRemove.Click += new System.EventHandler(this.OnMenu); // // _menuProfileUp // this._menuProfileUp.Click += new System.EventHandler(this.OnMenu); // // _menuProfileDown // this._menuProfileDown.Click += new System.EventHandler(this.OnMenu); // // _menuProfileConnect // this._menuProfileConnect.Click += new System.EventHandler(this.OnMenu); // // _menuProfileDisconnect // this._menuProfileDisconnect.Click += new System.EventHandler(this.OnMenu); // // _menuAllProfile // this._menuAllProfile.DropDownItems.AddRange(new ToolStripMenuItem[] { this._menuAllProfileConnect, this._menuAllProfileDisconnect }); // // _menuAllProfileConnect // this._menuAllProfileConnect.Click += new System.EventHandler(this.OnMenu); // // _menuAllProfileDisconnect // this._menuAllProfileDisconnect.Click += new System.EventHandler(this.OnMenu); // // _menuTool // this._menuTool.DropDownItems.AddRange(new ToolStripMenuItem[] { this._menuOption }); // // _menuOption // this._menuOption.Click += new System.EventHandler(this.OnMenu); // // _menuHelp // this._menuHelp.DropDownItems.AddRange(new ToolStripMenuItem[] { this._menuAboutBox }); // // _menuAboutBox // this._menuAboutBox.Click += new System.EventHandler(this.OnMenu); // // _taskTrayIcon // this._taskTrayIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("_taskTrayIcon.Icon"))); this._taskTrayIcon.Text = "Poderosa SSH Portforwarding Gateway"; this._taskTrayIcon.Visible = true; this._taskTrayIcon.DoubleClick += new System.EventHandler(this.OnTaskTrayIconDoubleClicked); // // MainForm // this.AutoScaleBaseSize = new System.Drawing.Size(5, 12); this.ClientSize = new System.Drawing.Size(504, 345); this.Controls.Add(this._list); this.Controls.Add(_mainMenu); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.MainMenuStrip = this._mainMenu; this.Name = "MainForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; this.Text = Env.WindowTitle; this.ResumeLayout(false); }
public TrayNotify(NotifyIcon icon) { _icon = icon; }
public MainWindow() { InitializeComponent(); Globals.LogBox = LogBox; _lastFocusedTextBox = PlayingTopLineFormatTextBox; _notifyIcon = new NotifyIcon { Text = "iTunesRichPresence", Visible = false, Icon = System.Drawing.Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location) }; _notifyIcon.MouseDoubleClick += (sender, args) => { SetVisibility(true); }; ThemeComboBox.ItemsSource = ThemeManager.Accents.Select(accent => accent.Name); ThemeComboBox.SelectedItem = Settings.Default.Accent; ThemeManager.ChangeAppStyle(Application.Current, ThemeManager.GetAccent(Settings.Default.Accent), ThemeManager.GetAppTheme("BaseLight")); RunOnStartupCheckBox.IsChecked = Settings.Default.RunOnStartup; PlayingTopLineFormatTextBox.Text = Settings.Default.PlayingTopLine; PlayingBottomLineFormatTextBox.Text = Settings.Default.PlayingBottomLine; PausedTopLineFormatTextBox.Text = Settings.Default.PausedTopLine; PausedBottomLineFormatTextBox.Text = Settings.Default.PausedBottomLine; PlaybackDurationCheckBox.IsChecked = Settings.Default.DisplayPlaybackDuration; ClearOnPauseCheckBox.IsChecked = Settings.Default.ClearOnPause; ExperimentsCheckBox.IsChecked = Settings.Default.ExperimentsEnabled; ExperimentsButton.Visibility = Settings.Default.ExperimentsEnabled ? Visibility.Visible : Visibility.Collapsed; AppNameComboBox.Items.Add("iTunes"); AppNameComboBox.Items.Add("Apple Music"); try { CreateBridge(); } catch (COMException) { _bridge = null; } AppNameComboBox.SelectedItem = Settings.Default.AppName; try { var gitHubClient = new GitHubClient(new ProductHeaderValue("iTunesRichPresence")); _latestRelease = gitHubClient.Repository.Release.GetLatest("nint8835", "iTunesRichPresence").Result; if (!Assembly.GetExecutingAssembly().GetName().Version.ToString().StartsWith(_latestRelease.Name.Substring(1))) { UpdateButton.Visibility = Visibility.Visible; } } catch (WebException) { // Occurs when it fails to check for updates, so we can safely ignore it } #if DEBUG PatreonEmailLabel.Visibility = Visibility.Visible; PatreonEmailTextBox.Visibility = Visibility.Visible; PatreonStatusLabel.Visibility = Visibility.Visible; AlbumArtCheckBox.Visibility = Visibility.Visible; #else PatreonEmailLabel.Visibility = Visibility.Hidden; PatreonEmailTextBox.Visibility = Visibility.Hidden; PatreonStatusLabel.Visibility = Visibility.Hidden; AlbumArtCheckBox.Visibility = Visibility.Hidden; #endif PopulateToolbox(); using (var uptime = new PerformanceCounter("System", "System Up Time")) { uptime.NextValue(); var timeSinceStart = TimeSpan.FromSeconds(uptime.NextValue()); if (timeSinceStart.Minutes < 2) { // If it's been less than 2 minutes since the system was started, we'll treat it as if the app was started on boot SetVisibility(false); } } }
public MainWindow(Dictionary <string, string> args) { InitializeComponent(); //Set Client ID string rawID = $"{Environment.MachineName}-{Environment.UserName}-Miner Tracker-Client"; CLIENT_ID = CryptTool.Encrypt(rawID); //Set SystemTray Icon systemTrayIcon = new NotifyIcon(); systemTrayIcon.Icon = new Icon(SYSTEM_TRAY_ICON); systemTrayIcon.Visible = true; systemTrayIcon.Text = ToolTipsText; this.Hide(); systemTrayIcon.DoubleClick += delegate(object callBack, EventArgs mouseEvent) { this.Show(); this.WindowState = WindowState.Normal; this.Activate(); }; systemTrayIcon.BalloonTipClosed += (sender, e) => { var thisIcon = (NotifyIcon)sender; thisIcon.Visible = false; thisIcon.Dispose(); }; System.Windows.Forms.ContextMenu contextMenu = new System.Windows.Forms.ContextMenu(); PCIDContextMenu = contextMenu.MenuItems.Add("Checking PCID..."); PCIDContextMenu.Enabled = false; GPUContextMenu = contextMenu.MenuItems.Add("GPU List"); GPUContextMenu.Enabled = false; contextMenu.MenuItems.Add("View Log", (s, e) => { try { Process.Start("notepad.exe", Path.Combine(ServiceConfig.LogPath, EventLogger.GetLogFileName())); } catch (Exception ex) { ShowErrorDialog("Unable to open log", ex.ToString()); EventLogger.WriteLog("OPEN LOG ERROR", ex.ToString()); } }); contextMenu.MenuItems.Add("Change PC ID", (s, e) => { OpenSettingContextMenu(); }); contextMenu.MenuItems.Add("Restore", (s, e) => { this.Show(); this.WindowState = WindowState.Normal; this.Activate(); }); contextMenu.MenuItems.Add("Exit", (s, e) => { System.Windows.Application.Current.Shutdown(); }); systemTrayIcon.ContextMenu = contextMenu; //Get version var currentVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(); FooterVersionTextBlock.Text = $"Version: {currentVersion}"; var createdTime = AssemblyInformationManager.GetCreatedTime(@"C:\Program Files\Miner Tracker\Miner Tracker Desktop.exe"); AboutVersionTextBlock.Text = $"Version {currentVersion} -Released {createdTime.Month}/{createdTime.Year}"; //Get config var serviceConfigReader = new ConfigurationReader(); ServiceConfig = serviceConfigReader.GetServiceConfig(); //If can not get service config, then show error and shutdown if (!ClassUtils.CheckNull(ServiceConfig)) { EventLogger.WriteLog("CLIENT READ SERVICE CONFIG ERROR", "Null retrieved config"); ShowErrorDialog("File system error", "Unable to retrieve service configuration"); System.Windows.Application.Current.Shutdown(); } var userConfigReader = new ConfigurationReader(isService: false, userConfigPath: ServiceConfig.UserConfigPath, userConfigFile: ServiceConfig.UserConfigFileName); UserConfig = userConfigReader.GetUserConfig(); var CurrentUserConfig = UserConfig; //Service config is okay but can not retrieve the user.config if (!ClassUtils.CheckNull(UserConfig)) { ShowErrorDialog("File system error", "Unable to retrieve client configuration. Options have been set to default."); UserConfig = new UserConfiguration { ID = CurrentUserConfig == null || CurrentUserConfig.ID == 0 ? ServiceConfig.UserID : CurrentUserConfig.ID, LogPath = CurrentUserConfig == null || CurrentUserConfig.LogPath == null ? ServiceConfig.UserLogPath : CurrentUserConfig.LogPath, OpenOnStartup = CurrentUserConfig == null || CurrentUserConfig.OpenOnStartup == null ? ServiceConfig.UserOpenOnStartup : CurrentUserConfig.OpenOnStartup, CheckInterval = CurrentUserConfig == null || CurrentUserConfig.CheckInterval == null ? ServiceConfig.UserCheckInterval : CurrentUserConfig.CheckInterval, MinimizedWhenClose = CurrentUserConfig == null || CurrentUserConfig.MinimizedWhenClose == null ? ServiceConfig.UserMinimizedWhenClose : CurrentUserConfig.MinimizedWhenClose, PCID = CurrentUserConfig == null || CurrentUserConfig.PCID == null ? ServiceConfig.UserPCID : CurrentUserConfig.PCID, PreviousPCID = CurrentUserConfig == null || CurrentUserConfig.PreviousPCID == null ? ServiceConfig.UserPCID : CurrentUserConfig.PreviousPCID }; SaveUserConfig(); } // Since here, can use UserConfig SetupComputerSection(); SetupConfigSection(); SetupOptionSection(); try { CheckTimer = new System.Timers.Timer(); CheckTimer.Elapsed += new ElapsedEventHandler(OnTimer); CheckTimer.Interval = 10; CheckTimer.Start(); } catch (Exception ex) { EventLogger.WriteLog("TIMER ERROR", ex.ToString(), UserConfig.LogPath); EventLogger.WriteLog("", "Exiting....", UserConfig.LogPath); return; } if (args.TryGetValue("--minimized", out string value)) { if (value.Equals("true")) { //this.Hide(); } } }
// ********************************************************* // Start public GCApplicationContext() { string version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); Console.WriteLine(version); // Initialize GameProcess dictionnary GameProcess = new Dictionary <string, Process> { }; // Initialize Tray Icon trayIcon = new NotifyIcon() { Icon = Properties.Resources.AppIcon, ContextMenuStrip = new ContextMenuStrip(), Visible = true }; GamesToolStripMenuItem = new ToolStripMenuItem("Games", Properties.Resources.controller); GamesToolStripMenuItem.Name = "games"; GamesToolStripMenuItem.DropDownItems.Add(new ToolStripMenuItem("New", Properties.Resources.controller_add, new EventHandler(MenuGameNewEdit_Click))); trayIcon.ContextMenuStrip.Items.Add(GamesToolStripMenuItem); trayIcon.ContextMenuStrip.Items.Add(new ToolStripSeparator()); trayIcon.ContextMenuStrip.Items.Add(new ToolStripMenuItem("About", Properties.Resources.information, new EventHandler(MenuAbout_Click))); trayIcon.ContextMenuStrip.Items.Add(new ToolStripSeparator()); trayIcon.ContextMenuStrip.Items.Add(new ToolStripMenuItem("Exit", Properties.Resources.door_in, new EventHandler(MenuExit_Click))); // Initialize GCProgramDataFolder GCProgramDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\GameserverControl"; if (!Directory.Exists(GCProgramDataFolder)) { Directory.CreateDirectory(GCProgramDataFolder); } // Get XML Config or create it GCXMLConfigFile = GCProgramDataFolder + "\\GCConfig.xml"; if (!File.Exists(GCXMLConfigFile)) { ConfigsXMLNode = GCXMLConfig.AppendChild(GCXMLConfig.CreateNode(XmlNodeType.Element, "Configs", null)); WebServerXMLNode = ConfigsXMLNode.AppendChild(GCXMLConfig.CreateNode(XmlNodeType.Element, "WebServer", null)); GamesXMLNode = ConfigsXMLNode.AppendChild(GCXMLConfig.CreateNode(XmlNodeType.Element, "Games", null)); } else { GCXMLConfig.Load(GCXMLConfigFile); // Root Node ConfigsXMLNode = GCXMLConfig.SelectSingleNode("/Configs"); if (ConfigsXMLNode == null) { GCXMLConfig = new XmlDocument(); ConfigsXMLNode = GCXMLConfig.AppendChild(GCXMLConfig.CreateNode(XmlNodeType.Element, "Configs", null)); } // WebServer Node WebServerXMLNode = ConfigsXMLNode.SelectSingleNode("./WebServer"); if (WebServerXMLNode == null) { WebServerXMLNode = ConfigsXMLNode.AppendChild(GCXMLConfig.CreateNode(XmlNodeType.Element, "WebServer", null)); } WebServerXMLNode = XMLCreateOrUpdateWebServerConfig(WebServerXMLNode); // Games Node GamesXMLNode = ConfigsXMLNode.SelectSingleNode("./Games"); if (GamesXMLNode == null) { GamesXMLNode = ConfigsXMLNode.AppendChild(GCXMLConfig.CreateNode(XmlNodeType.Element, "Games", null)); } } // Read Games Config if (GamesXMLNode.HasChildNodes) { GamesToolStripMenuItem.DropDownItems.Add(new ToolStripSeparator()); XmlNode newGameConfig; foreach (XmlNode GameXMLNode in GamesXMLNode.ChildNodes) { string gameGUID = GameXMLNode.Attributes["guid"].Value; newGameConfig = XMLCreateOrUpdateGameConfig(GamesXMLNode.SelectSingleNode("./Game[@guid='" + gameGUID + "']")); XMLAddGame(newGameConfig); } } // Create a Http server and start listening for incoming connections url = "http://+:" + WebServerXMLNode.SelectSingleNode("./Port").InnerText + "/"; listener = new HttpListener(); listener.Prefixes.Add(url); try { listener.Start(); Console.WriteLine("Listening for connections on {0}", url); // Handle requests Task listenTask = HTTPHandleIncomingConnections(); } catch (HttpListenerException e) { MessageBox.Show("Unable to listen on port " + WebServerXMLNode.SelectSingleNode("./Port").InnerText + "\rYou can't control GameserverControl from another computer\r\rTry to correct this with GCSetComputerSettings and restart GameserverControl\r\rError message :\r" + e.Message, "Can't start webserver on specified port", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static Point GetWindowPosition(NotifyIcon notifyicon, int windowwidth, int windowheight) { Rectangle taskbar; var position = GetTaskbarPosition(out taskbar); if (position == TaskbarPosition.Unknown) { return(new Point((Screen.PrimaryScreen.WorkingArea.Width + windowwidth) / 2, (Screen.PrimaryScreen.WorkingArea.Height + windowheight) / 2)); } var iconPos = GetNotifyIconPosition(notifyicon); var windowOffset = (int)Math.Round(8 * FormSwitcher.DpiFactor); var iconOffset = (int)Math.Round(8 * FormSwitcher.DpiFactor); var maxLeft = taskbar.Left + taskbar.Width - windowwidth - windowOffset; var maxTop = taskbar.Top + taskbar.Height - windowheight + windowOffset; int left; int top; switch (position) { case TaskbarPosition.Top: if (iconPos.X - windowwidth / 2 > maxLeft) { left = maxLeft; } else { left = iconPos.X - windowwidth / 2; } if (iconPos.Y > taskbar.Top + taskbar.Height) { top = iconPos.Y + iconOffset; } else { top = taskbar.Top + taskbar.Height + windowOffset; } break; case TaskbarPosition.Left: if (iconPos.X > taskbar.Left + taskbar.Width) { left = iconPos.X + iconOffset; } else { left = taskbar.Left + taskbar.Width + windowOffset; } if (iconPos.Y - windowheight / 2 > maxTop) { top = maxTop; } else { top = iconPos.Y - windowheight / 2; } break; case TaskbarPosition.Right: if (iconPos.X < taskbar.Left) { left = iconPos.X - windowwidth - iconOffset; } else { left = taskbar.Left - windowwidth - windowOffset; } if (iconPos.Y - windowheight / 2 > maxTop) { top = maxTop; } else { top = iconPos.Y - windowheight / 2; } break; default: if (iconPos.X - windowwidth / 2 > maxLeft) { left = maxLeft; } else { left = iconPos.X - windowwidth / 2; } if (iconPos.Y < taskbar.Top) { top = iconPos.Y - windowheight - iconOffset; } else { top = taskbar.Top - windowheight - windowOffset; } break; } return(new Point(left, top)); }
public TrayForm() { components = new Container(); TrayIcon = new NotifyIcon(components); }
/// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmSplash)); this.timer1 = new System.Windows.Forms.Timer(this.components); this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.主界面ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.切换用户ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.消息面板ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.退出ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.btnConfig = new System.Windows.Forms.LinkLabel(); this.btnclose = new System.Windows.Forms.LinkLabel(); this.contextMenuStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // // timer1 // this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // // notifyIcon1 // this.notifyIcon1.ContextMenuStrip = this.contextMenuStrip1; this.notifyIcon1.Visible = true; this.notifyIcon1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.notifyIcon1_MouseDoubleClick); // // contextMenuStrip1 // this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.主界面ToolStripMenuItem, this.切换用户ToolStripMenuItem, this.消息面板ToolStripMenuItem, this.toolStripSeparator1, this.退出ToolStripMenuItem }); this.contextMenuStrip1.Name = "contextMenuStrip1"; this.contextMenuStrip1.Size = new System.Drawing.Size(125, 98); // // 主界面ToolStripMenuItem // this.主界面ToolStripMenuItem.Name = "主界面ToolStripMenuItem"; this.主界面ToolStripMenuItem.Size = new System.Drawing.Size(124, 22); this.主界面ToolStripMenuItem.Text = "主界面"; this.主界面ToolStripMenuItem.Click += new System.EventHandler(this.主界面ToolStripMenuItem_Click); // // 切换用户ToolStripMenuItem // this.切换用户ToolStripMenuItem.Name = "切换用户ToolStripMenuItem"; this.切换用户ToolStripMenuItem.Size = new System.Drawing.Size(124, 22); this.切换用户ToolStripMenuItem.Text = "切换用户"; this.切换用户ToolStripMenuItem.Visible = false; // // 消息面板ToolStripMenuItem // this.消息面板ToolStripMenuItem.Name = "消息面板ToolStripMenuItem"; this.消息面板ToolStripMenuItem.Size = new System.Drawing.Size(124, 22); this.消息面板ToolStripMenuItem.Text = "消息面板"; this.消息面板ToolStripMenuItem.Visible = false; // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Size = new System.Drawing.Size(121, 6); // // 退出ToolStripMenuItem // this.退出ToolStripMenuItem.Name = "退出ToolStripMenuItem"; this.退出ToolStripMenuItem.Size = new System.Drawing.Size(124, 22); this.退出ToolStripMenuItem.Text = "退出"; this.退出ToolStripMenuItem.Click += new System.EventHandler(this.退出ToolStripMenuItem_Click); // // pictureBox1 // this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill; this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); this.pictureBox1.Location = new System.Drawing.Point(0, 0); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(347, 167); this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox1.TabIndex = 1; this.pictureBox1.TabStop = false; // // btnConfig // this.btnConfig.AutoSize = true; this.btnConfig.BackColor = System.Drawing.Color.Gainsboro; this.btnConfig.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.btnConfig.Font = new System.Drawing.Font("楷体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnConfig.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; this.btnConfig.Location = new System.Drawing.Point(12, 138); this.btnConfig.Name = "btnConfig"; this.btnConfig.Size = new System.Drawing.Size(106, 18); this.btnConfig.TabIndex = 2; this.btnConfig.TabStop = true; this.btnConfig.Text = "设置通讯连接"; this.btnConfig.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.btnConfig_LinkClicked); // // btnclose // this.btnclose.AutoSize = true; this.btnclose.BackColor = System.Drawing.Color.Gainsboro; this.btnclose.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.btnclose.Font = new System.Drawing.Font("楷体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnclose.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; this.btnclose.Location = new System.Drawing.Point(277, 138); this.btnclose.Name = "btnclose"; this.btnclose.Size = new System.Drawing.Size(58, 18); this.btnclose.TabIndex = 3; this.btnclose.TabStop = true; this.btnclose.Text = "关 闭"; this.btnclose.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.btnclose_LinkClicked); // // FrmSplash // this.BackColor = System.Drawing.Color.AliceBlue; this.ClientSize = new System.Drawing.Size(347, 167); this.ControlBox = false; this.Controls.Add(this.btnclose); this.Controls.Add(this.btnConfig); this.Controls.Add(this.pictureBox1); this.DoubleBuffered = true; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Name = "FrmSplash"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.TopMost = true; this.TransparencyKey = System.Drawing.Color.Red; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmSplash_FormClosing); this.Load += new System.EventHandler(this.FrmSplash_Load); this.contextMenuStrip1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); }
/// <summary> /// Initializes a new instance of the <see cref="ProcessIcon"/> class. /// </summary> public ProcessIcon() { // Instantiate the NotifyIcon object. ni = new NotifyIcon(); }
//Constructor public WindowSink(NotifyIcon notIcon) { notifyIcon = notIcon; }
static void Main() { Mutex mutex = new Mutex(true, "FileLocker", out bool isNew); if (!isNew) { return; } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ContextMenu contextMenu = new ContextMenu(); MenuItem menuItem = new MenuItem() { Index = 0, Text = "Add file", }; menuItem.Click += AddFile; contextMenu.MenuItems.Add(menuItem); menuItem = new MenuItem() { Index = 1, Text = "Show control panel", }; menuItem.Click += ShowForm; contextMenu.MenuItems.Add(menuItem); menuItem = new MenuItem() { Index = 2, Text = "Add to auto launch", }; menuItem.Click += AddToStartup; contextMenu.MenuItems.Add(menuItem); menuItem = new MenuItem() { Index = 3, Text = "Exit", }; menuItem.Click += CloseApp; contextMenu.MenuItems.Add(menuItem); NotifyIcon notifyIcon = new NotifyIcon { Icon = new Icon(@"Resources\icon.ico"), Text = "FileLocker", ContextMenu = contextMenu, Visible = true, }; notifyIcon.DoubleClick += ShowForm; Hooker.SetHook(); Application.Run(); //notifyIcon.Visible = false; }
public void setNotifyIconText(Form in_me, NotifyIcon set_me, string to_me) { if(in_me.InvokeRequired) { in_me.BeginInvoke(new setNotifyIconTextDelegate(setNotifyIconText), new Object[] {in_me,set_me,to_me}); } else { lock(set_me) { set_me.Text = to_me; } } }
public TrayBuilder() { notifyIcon = new NotifyIcon(); tray = new TemperatureTray(notifyIcon); }
/// <summary> /// Handles the Window's StateChanged event. /// </summary> /// <param name="sender">Event source.</param> /// <param name="e">Event arguments.</param> private void HandleStateChanged(object sender, EventArgs e) { if (_notifyIcon == null) { // Initialize NotifyIcon instance "on demand" _notifyIcon = new NotifyIcon(); _notifyIcon.Icon = Icon.ExtractAssociatedIcon(Assembly.GetEntryAssembly().Location); _notifyIcon.MouseClick += new MouseEventHandler(HandleNotifyIconOrBalloonClicked); _notifyIcon.BalloonTipClicked += new EventHandler(HandleNotifyIconOrBalloonClicked); } // Update copy of Window Title in case it has changed _notifyIcon.Text = _window.Title; // Show/hide Window and NotifyIcon var minimized = (_window.WindowState == WindowState.Minimized); _window.ShowInTaskbar = !minimized; _notifyIcon.Visible = minimized; if (minimized && !_balloonShown) { // If this is the first time minimizing to the tray, show the user what happened _notifyIcon.ShowBalloonTip(1000, null, _window.Title, ToolTipIcon.None); _balloonShown = true; } }
public Configuration(NotifyIcon notifyIcon) { InitializeComponent(); pvtNotifyIcon = notifyIcon; }
public MainForm () { // // _contextMenuStrip // _contextMenuStrip = new ContextMenuStrip (); // // _toolStripMenuItem1 // _toolStripMenuItem1 = new ToolStripMenuItem (); _toolStripMenuItem1.Text = "Menu Item 1"; _contextMenuStrip.Items.Add (_toolStripMenuItem1); // // _toolStripMenuItem2 // _toolStripMenuItem2 = new ToolStripMenuItem (); _toolStripMenuItem2.Text = "Menu Item 2"; _contextMenuStrip.Items.Add (_toolStripMenuItem2); // // _toolStripMenuItem3 // _toolStripMenuItem3 = new ToolStripMenuItem (); _toolStripMenuItem3.Text = "Menu Item 3"; _contextMenuStrip.Items.Add (_toolStripMenuItem3); // // _toolStripMenuItem4 // _toolStripMenuItem4 = new ToolStripMenuItem (); _toolStripMenuItem4.Text = "Menu Item 4"; _contextMenuStrip.Items.Add (_toolStripMenuItem4); // // _notifyIcon // _notifyIcon = new NotifyIcon (); _notifyIcon.ContextMenuStrip = _contextMenuStrip; _notifyIcon.Icon = Icon; _notifyIcon.Visible = true; // // _tabControl // _tabControl = new TabControl (); _tabControl.Dock = DockStyle.Fill; Controls.Add (_tabControl); // // _bugDescriptionText1 // _bugDescriptionText1 = new TextBox (); _bugDescriptionText1.Dock = DockStyle.Fill; _bugDescriptionText1.Multiline = true; _bugDescriptionText1.Text = string.Format (CultureInfo.InvariantCulture, "Steps to execute:{0}{0}" + "1. Ensure the taskbar is positioned at the top of the screen.{0}{0}" + "2. Right-click the notify icon.{0}{0}" + "Expected result:{0}{0}" + "1. The context menu pops up below the cursor.", Environment.NewLine); // // _tabPage1 // _tabPage1 = new TabPage (); _tabPage1.Text = "#1"; _tabPage1.Controls.Add (_bugDescriptionText1); _tabControl.Controls.Add (_tabPage1); // // MainForm // ClientSize = new Size (300, 170); StartPosition = FormStartPosition.CenterScreen; Text = "bug #82210"; }
public NotifyCommand(NotifyIcon notifyIcon) { _notifyIcon = notifyIcon; }
public static string GetShowReference(string message, string title = null, NotifyIcon icon = NotifyIcon.Info, Target target = Target.Top) { Notify notify = new Notify(); notify.Message = message; notify.Title = title; notify.NotifyIcon = icon; notify.Target = target; return notify.GetShowReference(); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ManagerTemplateForm)); this.uiManagerHostLabel = new System.Windows.Forms.Label(); this.uiManagerHostTextBox = new System.Windows.Forms.TextBox(); this.uiStartButton = new System.Windows.Forms.Button(); this.uiNodeConfigurationGroupBox = new System.Windows.Forms.GroupBox(); this.uiDedicatedCheckBox = new System.Windows.Forms.CheckBox(); this.uiIdLabel = new System.Windows.Forms.Label(); this.uiIntermediateComboBox = new System.Windows.Forms.CheckBox(); this.uiIdTextBox = new System.Windows.Forms.TextBox(); this.uiManagerPortLabel = new System.Windows.Forms.Label(); this.uiManagerPortTextBox = new System.Windows.Forms.TextBox(); this.uiResetButton = new System.Windows.Forms.Button(); this.uiStopButton = new System.Windows.Forms.Button(); this.TrayIcon = new System.Windows.Forms.NotifyIcon(this.components); this.TrayMenu = new System.Windows.Forms.ContextMenu(); this.tmExit = new System.Windows.Forms.MenuItem(); this.MainMenu = new System.Windows.Forms.MainMenu(this.components); this.uiManagerMenuItem = new System.Windows.Forms.MenuItem(); this.uiManagerExitMenuItem = new System.Windows.Forms.MenuItem(); this.uiHelpMenuItem = new System.Windows.Forms.MenuItem(); this.uiHelpAboutMenuItem = new System.Windows.Forms.MenuItem(); this.uiActionsGroupBox = new System.Windows.Forms.GroupBox(); this.uiStatusBar = new System.Windows.Forms.StatusBar(); this.tabControl = new System.Windows.Forms.TabControl(); this.uiSetupConnectionTabPage = new System.Windows.Forms.TabPage(); this.uiAdvancedTabPage = new System.Windows.Forms.TabPage(); this.uiSchedulerComboBox = new System.Windows.Forms.ComboBox(); this.uiStorageConfigurationGroupBox = new System.Windows.Forms.GroupBox(); this.uiDatabaseFileGroupBox = new System.Windows.Forms.GroupBox(); this.uiDatabaseFileButton = new System.Windows.Forms.Button(); this.uiDatabaseFileTextBox = new System.Windows.Forms.TextBox(); this.uiDatabaseTypeLabel = new System.Windows.Forms.Label(); this.uiDatabaseTypeComboBox = new System.Windows.Forms.ComboBox(); this.uiDatabaseServerGroupBox = new System.Windows.Forms.GroupBox(); this.uiDatabasePasswordTextBox = new System.Windows.Forms.TextBox(); this.uiDatabaseServerTextBox = new System.Windows.Forms.TextBox(); this.uiDatabaseUserLabel = new System.Windows.Forms.Label(); this.uiDatabasePasswordLabel = new System.Windows.Forms.Label(); this.uiDatabaseServerLabel = new System.Windows.Forms.Label(); this.uiDatabaseNameTextBox = new System.Windows.Forms.TextBox(); this.uiDatabaseNameLabel = new System.Windows.Forms.Label(); this.uiDatabaseUserTextBox = new System.Windows.Forms.TextBox(); this.uiSchedulerLabel = new System.Windows.Forms.Label(); this.tabEndPoints = new System.Windows.Forms.TabPage(); this.uiProgressBar = new System.Windows.Forms.ProgressBar(); this.uiLogMessagesTextBox = new System.Windows.Forms.TextBox(); this.uiLogMessagesLabel = new System.Windows.Forms.Label(); this.uiViewFullLogLinkLabel = new System.Windows.Forms.LinkLabel(); this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); this.ucEndPoints = new Alchemi.Core.EndPointUtils.EndPointManagerControl(); this.uiNodeConfigurationGroupBox.SuspendLayout(); this.uiActionsGroupBox.SuspendLayout(); this.tabControl.SuspendLayout(); this.uiSetupConnectionTabPage.SuspendLayout(); this.uiAdvancedTabPage.SuspendLayout(); this.uiStorageConfigurationGroupBox.SuspendLayout(); this.uiDatabaseFileGroupBox.SuspendLayout(); this.uiDatabaseServerGroupBox.SuspendLayout(); this.tabEndPoints.SuspendLayout(); this.SuspendLayout(); // // uiManagerHostLabel // this.uiManagerHostLabel.AutoSize = true; this.uiManagerHostLabel.Location = new System.Drawing.Point(38, 103); this.uiManagerHostLabel.Name = "uiManagerHostLabel"; this.uiManagerHostLabel.Size = new System.Drawing.Size(74, 13); this.uiManagerHostLabel.TabIndex = 1; this.uiManagerHostLabel.Text = "Manager Host"; this.uiManagerHostLabel.TextAlign = System.Drawing.ContentAlignment.BottomRight; // // uiManagerHostTextBox // this.uiManagerHostTextBox.Location = new System.Drawing.Point(120, 100); this.uiManagerHostTextBox.Name = "uiManagerHostTextBox"; this.uiManagerHostTextBox.Size = new System.Drawing.Size(104, 20); this.uiManagerHostTextBox.TabIndex = 9; // // uiStartButton // this.uiStartButton.FlatStyle = System.Windows.Forms.FlatStyle.System; this.uiStartButton.Location = new System.Drawing.Point(88, 50); this.uiStartButton.Name = "uiStartButton"; this.uiStartButton.Size = new System.Drawing.Size(128, 23); this.uiStartButton.TabIndex = 12; this.uiStartButton.Text = "Start"; this.uiStartButton.Click += new System.EventHandler(this.uiStartButton_Click); // // uiNodeConfigurationGroupBox // this.uiNodeConfigurationGroupBox.Controls.Add(this.uiDedicatedCheckBox); this.uiNodeConfigurationGroupBox.Controls.Add(this.uiIdLabel); this.uiNodeConfigurationGroupBox.Controls.Add(this.uiIntermediateComboBox); this.uiNodeConfigurationGroupBox.Controls.Add(this.uiIdTextBox); this.uiNodeConfigurationGroupBox.Controls.Add(this.uiManagerPortLabel); this.uiNodeConfigurationGroupBox.Controls.Add(this.uiManagerPortTextBox); this.uiNodeConfigurationGroupBox.Controls.Add(this.uiManagerHostLabel); this.uiNodeConfigurationGroupBox.Controls.Add(this.uiManagerHostTextBox); this.uiNodeConfigurationGroupBox.FlatStyle = System.Windows.Forms.FlatStyle.System; this.uiNodeConfigurationGroupBox.Location = new System.Drawing.Point(8, 12); this.uiNodeConfigurationGroupBox.Name = "uiNodeConfigurationGroupBox"; this.uiNodeConfigurationGroupBox.Size = new System.Drawing.Size(416, 171); this.uiNodeConfigurationGroupBox.TabIndex = 6; this.uiNodeConfigurationGroupBox.TabStop = false; this.uiNodeConfigurationGroupBox.Text = "Node Configuration"; // // uiDedicatedCheckBox // this.uiDedicatedCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.System; this.uiDedicatedCheckBox.Location = new System.Drawing.Point(120, 68); this.uiDedicatedCheckBox.Name = "uiDedicatedCheckBox"; this.uiDedicatedCheckBox.Size = new System.Drawing.Size(88, 24); this.uiDedicatedCheckBox.TabIndex = 8; this.uiDedicatedCheckBox.Text = "Dedicated"; // // uiIdLabel // this.uiIdLabel.Location = new System.Drawing.Point(96, 44); this.uiIdLabel.Name = "uiIdLabel"; this.uiIdLabel.Size = new System.Drawing.Size(16, 16); this.uiIdLabel.TabIndex = 12; this.uiIdLabel.Text = "Id"; this.uiIdLabel.TextAlign = System.Drawing.ContentAlignment.BottomRight; // // uiIntermediateComboBox // this.uiIntermediateComboBox.Enabled = false; this.uiIntermediateComboBox.FlatStyle = System.Windows.Forms.FlatStyle.System; this.uiIntermediateComboBox.Location = new System.Drawing.Point(120, 20); this.uiIntermediateComboBox.Name = "uiIntermediateComboBox"; this.uiIntermediateComboBox.Size = new System.Drawing.Size(88, 24); this.uiIntermediateComboBox.TabIndex = 6; this.uiIntermediateComboBox.TabStop = false; this.uiIntermediateComboBox.Text = "Intermediate"; // // uiIdTextBox // this.uiIdTextBox.Enabled = false; this.uiIdTextBox.Location = new System.Drawing.Point(120, 44); this.uiIdTextBox.Name = "uiIdTextBox"; this.uiIdTextBox.Size = new System.Drawing.Size(240, 20); this.uiIdTextBox.TabIndex = 7; this.uiIdTextBox.TabStop = false; // // uiManagerPortLabel // this.uiManagerPortLabel.AutoSize = true; this.uiManagerPortLabel.Location = new System.Drawing.Point(41, 135); this.uiManagerPortLabel.Name = "uiManagerPortLabel"; this.uiManagerPortLabel.Size = new System.Drawing.Size(71, 13); this.uiManagerPortLabel.TabIndex = 6; this.uiManagerPortLabel.Text = "Manager Port"; this.uiManagerPortLabel.TextAlign = System.Drawing.ContentAlignment.BottomRight; // // uiManagerPortTextBox // this.uiManagerPortTextBox.Location = new System.Drawing.Point(120, 132); this.uiManagerPortTextBox.Name = "uiManagerPortTextBox"; this.uiManagerPortTextBox.Size = new System.Drawing.Size(104, 20); this.uiManagerPortTextBox.TabIndex = 10; // // uiResetButton // this.uiResetButton.FlatStyle = System.Windows.Forms.FlatStyle.System; this.uiResetButton.Location = new System.Drawing.Point(88, 20); this.uiResetButton.Name = "uiResetButton"; this.uiResetButton.Size = new System.Drawing.Size(248, 23); this.uiResetButton.TabIndex = 11; this.uiResetButton.TabStop = false; this.uiResetButton.Text = "Reset"; this.uiResetButton.Click += new System.EventHandler(this.uiResetButton_Click); // // uiStopButton // this.uiStopButton.FlatStyle = System.Windows.Forms.FlatStyle.System; this.uiStopButton.Location = new System.Drawing.Point(224, 50); this.uiStopButton.Name = "uiStopButton"; this.uiStopButton.Size = new System.Drawing.Size(112, 23); this.uiStopButton.TabIndex = 13; this.uiStopButton.Text = "Stop"; this.uiStopButton.Click += new System.EventHandler(this.uiStopButton_Click); // // TrayIcon // this.TrayIcon.ContextMenu = this.TrayMenu; this.TrayIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("TrayIcon.Icon"))); this.TrayIcon.Text = "Alchemi Manager"; this.TrayIcon.Visible = true; this.TrayIcon.Click += new System.EventHandler(this.TrayIcon_Click); // // TrayMenu // this.TrayMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.tmExit}); // // tmExit // this.tmExit.Index = 0; this.tmExit.Text = "Exit"; this.tmExit.Click += new System.EventHandler(this.tmExit_Click); // // MainMenu // this.MainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.uiManagerMenuItem, this.uiHelpMenuItem}); // // uiManagerMenuItem // this.uiManagerMenuItem.Index = 0; this.uiManagerMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.uiManagerExitMenuItem}); this.uiManagerMenuItem.Text = "Manager"; // // uiManagerExitMenuItem // this.uiManagerExitMenuItem.Index = 0; this.uiManagerExitMenuItem.Text = "Exit"; this.uiManagerExitMenuItem.Click += new System.EventHandler(this.uiManagerExitMenuItem_Click); // // uiHelpMenuItem // this.uiHelpMenuItem.Index = 1; this.uiHelpMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.uiHelpAboutMenuItem}); this.uiHelpMenuItem.Text = "Help"; // // uiHelpAboutMenuItem // this.uiHelpAboutMenuItem.Index = 0; this.uiHelpAboutMenuItem.Text = "About"; this.uiHelpAboutMenuItem.Click += new System.EventHandler(this.uiHelpAboutMenuItem_Click); // // uiActionsGroupBox // this.uiActionsGroupBox.Controls.Add(this.uiResetButton); this.uiActionsGroupBox.Controls.Add(this.uiStopButton); this.uiActionsGroupBox.Controls.Add(this.uiStartButton); this.uiActionsGroupBox.FlatStyle = System.Windows.Forms.FlatStyle.System; this.uiActionsGroupBox.Location = new System.Drawing.Point(23, 305); this.uiActionsGroupBox.Name = "uiActionsGroupBox"; this.uiActionsGroupBox.Size = new System.Drawing.Size(416, 89); this.uiActionsGroupBox.TabIndex = 9; this.uiActionsGroupBox.TabStop = false; this.uiActionsGroupBox.Text = "Actions"; // // uiStatusBar // this.uiStatusBar.Location = new System.Drawing.Point(0, 447); this.uiStatusBar.Name = "uiStatusBar"; this.uiStatusBar.Size = new System.Drawing.Size(456, 22); this.uiStatusBar.TabIndex = 10; // // tabControl // this.tabControl.Controls.Add(this.uiSetupConnectionTabPage); this.tabControl.Controls.Add(this.uiAdvancedTabPage); this.tabControl.Controls.Add(this.tabEndPoints); this.tabControl.Location = new System.Drawing.Point(10, 10); this.tabControl.Name = "tabControl"; this.tabControl.SelectedIndex = 0; this.tabControl.Size = new System.Drawing.Size(440, 289); this.tabControl.TabIndex = 12; // // uiSetupConnectionTabPage // this.uiSetupConnectionTabPage.Controls.Add(this.uiNodeConfigurationGroupBox); this.uiSetupConnectionTabPage.Location = new System.Drawing.Point(4, 22); this.uiSetupConnectionTabPage.Name = "uiSetupConnectionTabPage"; this.uiSetupConnectionTabPage.Size = new System.Drawing.Size(432, 263); this.uiSetupConnectionTabPage.TabIndex = 0; this.uiSetupConnectionTabPage.Text = "Setup Connection"; this.uiSetupConnectionTabPage.UseVisualStyleBackColor = true; // // uiAdvancedTabPage // this.uiAdvancedTabPage.Controls.Add(this.uiSchedulerComboBox); this.uiAdvancedTabPage.Controls.Add(this.uiStorageConfigurationGroupBox); this.uiAdvancedTabPage.Controls.Add(this.uiSchedulerLabel); this.uiAdvancedTabPage.Location = new System.Drawing.Point(4, 22); this.uiAdvancedTabPage.Name = "uiAdvancedTabPage"; this.uiAdvancedTabPage.Padding = new System.Windows.Forms.Padding(3); this.uiAdvancedTabPage.Size = new System.Drawing.Size(432, 263); this.uiAdvancedTabPage.TabIndex = 1; this.uiAdvancedTabPage.Text = "Advanced"; this.uiAdvancedTabPage.UseVisualStyleBackColor = true; // // uiSchedulerComboBox // this.uiSchedulerComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; this.uiSchedulerComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.uiSchedulerComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.uiSchedulerComboBox.FormattingEnabled = true; this.uiSchedulerComboBox.Location = new System.Drawing.Point(118, 210); this.uiSchedulerComboBox.Name = "uiSchedulerComboBox"; this.uiSchedulerComboBox.Size = new System.Drawing.Size(296, 21); this.uiSchedulerComboBox.TabIndex = 34; // // uiStorageConfigurationGroupBox // this.uiStorageConfigurationGroupBox.Controls.Add(this.uiDatabaseFileGroupBox); this.uiStorageConfigurationGroupBox.Controls.Add(this.uiDatabaseTypeLabel); this.uiStorageConfigurationGroupBox.Controls.Add(this.uiDatabaseTypeComboBox); this.uiStorageConfigurationGroupBox.Controls.Add(this.uiDatabaseServerGroupBox); this.uiStorageConfigurationGroupBox.Location = new System.Drawing.Point(9, 6); this.uiStorageConfigurationGroupBox.Name = "uiStorageConfigurationGroupBox"; this.uiStorageConfigurationGroupBox.Size = new System.Drawing.Size(416, 155); this.uiStorageConfigurationGroupBox.TabIndex = 33; this.uiStorageConfigurationGroupBox.TabStop = false; this.uiStorageConfigurationGroupBox.Text = "Storage Configuration"; // // uiDatabaseFileGroupBox // this.uiDatabaseFileGroupBox.Controls.Add(this.uiDatabaseFileButton); this.uiDatabaseFileGroupBox.Controls.Add(this.uiDatabaseFileTextBox); this.uiDatabaseFileGroupBox.Location = new System.Drawing.Point(9, 40); this.uiDatabaseFileGroupBox.Name = "uiDatabaseFileGroupBox"; this.uiDatabaseFileGroupBox.Size = new System.Drawing.Size(378, 63); this.uiDatabaseFileGroupBox.TabIndex = 43; this.uiDatabaseFileGroupBox.TabStop = false; this.uiDatabaseFileGroupBox.Text = "Database File"; // // uiDatabaseFileButton // this.uiDatabaseFileButton.Location = new System.Drawing.Point(330, 21); this.uiDatabaseFileButton.Name = "uiDatabaseFileButton"; this.uiDatabaseFileButton.Size = new System.Drawing.Size(31, 23); this.uiDatabaseFileButton.TabIndex = 3; this.uiDatabaseFileButton.Text = "..."; this.uiDatabaseFileButton.UseVisualStyleBackColor = true; this.uiDatabaseFileButton.Click += new System.EventHandler(this.uiDatabaseFileButton_Click); // // uiDatabaseFileTextBox // this.uiDatabaseFileTextBox.Enabled = false; this.uiDatabaseFileTextBox.Location = new System.Drawing.Point(12, 21); this.uiDatabaseFileTextBox.Name = "uiDatabaseFileTextBox"; this.uiDatabaseFileTextBox.Size = new System.Drawing.Size(312, 20); this.uiDatabaseFileTextBox.TabIndex = 2; // // uiDatabaseTypeLabel // this.uiDatabaseTypeLabel.AutoSize = true; this.uiDatabaseTypeLabel.Location = new System.Drawing.Point(6, 22); this.uiDatabaseTypeLabel.Name = "uiDatabaseTypeLabel"; this.uiDatabaseTypeLabel.Size = new System.Drawing.Size(31, 13); this.uiDatabaseTypeLabel.TabIndex = 42; this.uiDatabaseTypeLabel.Text = "Type"; this.uiDatabaseTypeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // uiDatabaseTypeComboBox // this.uiDatabaseTypeComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; this.uiDatabaseTypeComboBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.uiDatabaseTypeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.uiDatabaseTypeComboBox.FormattingEnabled = true; this.uiDatabaseTypeComboBox.Location = new System.Drawing.Point(43, 19); this.uiDatabaseTypeComboBox.Name = "uiDatabaseTypeComboBox"; this.uiDatabaseTypeComboBox.Size = new System.Drawing.Size(296, 21); this.uiDatabaseTypeComboBox.TabIndex = 41; this.uiDatabaseTypeComboBox.SelectedIndexChanged += new System.EventHandler(this.uiDatabaseTypeComboBox_SelectedIndexChanged); // // uiDatabaseServerGroupBox // this.uiDatabaseServerGroupBox.Controls.Add(this.uiDatabasePasswordTextBox); this.uiDatabaseServerGroupBox.Controls.Add(this.uiDatabaseServerTextBox); this.uiDatabaseServerGroupBox.Controls.Add(this.uiDatabaseUserLabel); this.uiDatabaseServerGroupBox.Controls.Add(this.uiDatabasePasswordLabel); this.uiDatabaseServerGroupBox.Controls.Add(this.uiDatabaseServerLabel); this.uiDatabaseServerGroupBox.Controls.Add(this.uiDatabaseNameTextBox); this.uiDatabaseServerGroupBox.Controls.Add(this.uiDatabaseNameLabel); this.uiDatabaseServerGroupBox.Controls.Add(this.uiDatabaseUserTextBox); this.uiDatabaseServerGroupBox.Location = new System.Drawing.Point(6, 49); this.uiDatabaseServerGroupBox.Name = "uiDatabaseServerGroupBox"; this.uiDatabaseServerGroupBox.Size = new System.Drawing.Size(378, 86); this.uiDatabaseServerGroupBox.TabIndex = 33; this.uiDatabaseServerGroupBox.TabStop = false; this.uiDatabaseServerGroupBox.Text = "Database Server Configuration"; // // uiDatabasePasswordTextBox // this.uiDatabasePasswordTextBox.Location = new System.Drawing.Point(260, 54); this.uiDatabasePasswordTextBox.Name = "uiDatabasePasswordTextBox"; this.uiDatabasePasswordTextBox.PasswordChar = '*'; this.uiDatabasePasswordTextBox.Size = new System.Drawing.Size(104, 20); this.uiDatabasePasswordTextBox.TabIndex = 35; // // uiDatabaseServerTextBox // this.uiDatabaseServerTextBox.Location = new System.Drawing.Point(68, 22); this.uiDatabaseServerTextBox.Name = "uiDatabaseServerTextBox"; this.uiDatabaseServerTextBox.Size = new System.Drawing.Size(104, 20); this.uiDatabaseServerTextBox.TabIndex = 32; // // uiDatabaseUserLabel // this.uiDatabaseUserLabel.AutoSize = true; this.uiDatabaseUserLabel.Location = new System.Drawing.Point(187, 25); this.uiDatabaseUserLabel.Name = "uiDatabaseUserLabel"; this.uiDatabaseUserLabel.Size = new System.Drawing.Size(55, 13); this.uiDatabaseUserLabel.TabIndex = 37; this.uiDatabaseUserLabel.Text = "Username"; this.uiDatabaseUserLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // uiDatabasePasswordLabel // this.uiDatabasePasswordLabel.AutoSize = true; this.uiDatabasePasswordLabel.Location = new System.Drawing.Point(187, 57); this.uiDatabasePasswordLabel.Name = "uiDatabasePasswordLabel"; this.uiDatabasePasswordLabel.Size = new System.Drawing.Size(53, 13); this.uiDatabasePasswordLabel.TabIndex = 36; this.uiDatabasePasswordLabel.Text = "Password"; this.uiDatabasePasswordLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // uiDatabaseServerLabel // this.uiDatabaseServerLabel.AutoSize = true; this.uiDatabaseServerLabel.Location = new System.Drawing.Point(9, 25); this.uiDatabaseServerLabel.Name = "uiDatabaseServerLabel"; this.uiDatabaseServerLabel.Size = new System.Drawing.Size(38, 13); this.uiDatabaseServerLabel.TabIndex = 38; this.uiDatabaseServerLabel.Text = "Server"; this.uiDatabaseServerLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // uiDatabaseNameTextBox // this.uiDatabaseNameTextBox.Location = new System.Drawing.Point(68, 54); this.uiDatabaseNameTextBox.Name = "uiDatabaseNameTextBox"; this.uiDatabaseNameTextBox.Size = new System.Drawing.Size(104, 20); this.uiDatabaseNameTextBox.TabIndex = 33; // // uiDatabaseNameLabel // this.uiDatabaseNameLabel.AutoSize = true; this.uiDatabaseNameLabel.Location = new System.Drawing.Point(9, 57); this.uiDatabaseNameLabel.Name = "uiDatabaseNameLabel"; this.uiDatabaseNameLabel.Size = new System.Drawing.Size(53, 13); this.uiDatabaseNameLabel.TabIndex = 39; this.uiDatabaseNameLabel.Text = "DB Name"; this.uiDatabaseNameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // uiDatabaseUserTextBox // this.uiDatabaseUserTextBox.Location = new System.Drawing.Point(260, 22); this.uiDatabaseUserTextBox.Name = "uiDatabaseUserTextBox"; this.uiDatabaseUserTextBox.Size = new System.Drawing.Size(104, 20); this.uiDatabaseUserTextBox.TabIndex = 34; // // uiSchedulerLabel // this.uiSchedulerLabel.AutoSize = true; this.uiSchedulerLabel.Location = new System.Drawing.Point(33, 213); this.uiSchedulerLabel.Name = "uiSchedulerLabel"; this.uiSchedulerLabel.Size = new System.Drawing.Size(55, 13); this.uiSchedulerLabel.TabIndex = 32; this.uiSchedulerLabel.Text = "Scheduler"; this.uiSchedulerLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // tabEndPoints // this.tabEndPoints.Controls.Add(this.ucEndPoints); this.tabEndPoints.Location = new System.Drawing.Point(4, 22); this.tabEndPoints.Name = "tabEndPoints"; this.tabEndPoints.Padding = new System.Windows.Forms.Padding(3); this.tabEndPoints.Size = new System.Drawing.Size(432, 263); this.tabEndPoints.TabIndex = 2; this.tabEndPoints.Text = "End Points"; this.tabEndPoints.UseVisualStyleBackColor = true; // // uiProgressBar // this.uiProgressBar.Location = new System.Drawing.Point(23, 575); this.uiProgressBar.Name = "uiProgressBar"; this.uiProgressBar.Size = new System.Drawing.Size(414, 10); this.uiProgressBar.Step = 1; this.uiProgressBar.TabIndex = 13; this.uiProgressBar.Visible = false; // // uiLogMessagesTextBox // this.uiLogMessagesTextBox.BackColor = System.Drawing.SystemColors.Info; this.uiLogMessagesTextBox.Location = new System.Drawing.Point(22, 424); this.uiLogMessagesTextBox.Multiline = true; this.uiLogMessagesTextBox.Name = "uiLogMessagesTextBox"; this.uiLogMessagesTextBox.ReadOnly = true; this.uiLogMessagesTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.uiLogMessagesTextBox.Size = new System.Drawing.Size(416, 145); this.uiLogMessagesTextBox.TabIndex = 15; this.uiLogMessagesTextBox.TabStop = false; // // uiLogMessagesLabel // this.uiLogMessagesLabel.Location = new System.Drawing.Point(20, 406); this.uiLogMessagesLabel.Name = "uiLogMessagesLabel"; this.uiLogMessagesLabel.Size = new System.Drawing.Size(88, 15); this.uiLogMessagesLabel.TabIndex = 16; this.uiLogMessagesLabel.Text = "Log Messages"; this.uiLogMessagesLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // uiViewFullLogLinkLabel // this.uiViewFullLogLinkLabel.AutoSize = true; this.uiViewFullLogLinkLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.uiViewFullLogLinkLabel.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline; this.uiViewFullLogLinkLabel.Location = new System.Drawing.Point(94, 404); this.uiViewFullLogLinkLabel.Name = "uiViewFullLogLinkLabel"; this.uiViewFullLogLinkLabel.Size = new System.Drawing.Size(98, 15); this.uiViewFullLogLinkLabel.TabIndex = 17; this.uiViewFullLogLinkLabel.TabStop = true; this.uiViewFullLogLinkLabel.Text = "( View full log ... )"; this.uiViewFullLogLinkLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // openFileDialog // this.openFileDialog.DefaultExt = "db"; // // ucEndPoints // this.ucEndPoints.EndPoints = null; this.ucEndPoints.Location = new System.Drawing.Point(6, 6); this.ucEndPoints.Name = "ucEndPoints"; this.ucEndPoints.Size = new System.Drawing.Size(420, 251); this.ucEndPoints.TabIndex = 0; // // ManagerTemplateForm // this.AcceptButton = this.uiStartButton; this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(456, 469); this.Controls.Add(this.uiViewFullLogLinkLabel); this.Controls.Add(this.uiLogMessagesLabel); this.Controls.Add(this.uiActionsGroupBox); this.Controls.Add(this.uiLogMessagesTextBox); this.Controls.Add(this.uiProgressBar); this.Controls.Add(this.tabControl); this.Controls.Add(this.uiStatusBar); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.Menu = this.MainMenu; this.Name = "ManagerTemplateForm"; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Alchemi Manager"; this.Load += new System.EventHandler(this.ManagerTemplateForm_Load); this.uiNodeConfigurationGroupBox.ResumeLayout(false); this.uiNodeConfigurationGroupBox.PerformLayout(); this.uiActionsGroupBox.ResumeLayout(false); this.tabControl.ResumeLayout(false); this.uiSetupConnectionTabPage.ResumeLayout(false); this.uiAdvancedTabPage.ResumeLayout(false); this.uiAdvancedTabPage.PerformLayout(); this.uiStorageConfigurationGroupBox.ResumeLayout(false); this.uiStorageConfigurationGroupBox.PerformLayout(); this.uiDatabaseFileGroupBox.ResumeLayout(false); this.uiDatabaseFileGroupBox.PerformLayout(); this.uiDatabaseServerGroupBox.ResumeLayout(false); this.uiDatabaseServerGroupBox.PerformLayout(); this.tabEndPoints.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); }
public NotifyIconEx(IContainer container) { try { m_ntf = new NotifyIcon(container); } catch (Exception) { Debug.Assert(false); } }
/// <summary> /// Creates a new instance of the NotifyIconMessageWindow class. /// </summary> /// <param name="parent">NotifyIcon for which this MessageWindow is operating.</param> public NotifyIconMessageWindow(NotifyIcon parent) { m_parent = parent; }
private void App_Exit(object sender, ExitEventArgs e) { SystemEvents.UserPreferenceChanged -= SystemEvents_UserPreferenceChanged; try { MutexList.RemoveAll(); } catch (Exception ex) { LogWriter.Log(ex, "Impossible to remove all mutexes of the opened projects."); } try { NotifyIcon?.Dispose(); } catch (Exception ex) { LogWriter.Log(ex, "Impossible to dispose the system tray icon."); } try { EncodingManager.StopAllEncodings(); } catch (Exception ex) { LogWriter.Log(ex, "Impossible to cancel all encodings."); } try { UserSettings.Save(); } catch (Exception ex) { LogWriter.Log(ex, "Impossible to save the user settings."); } try { if (_mutex != null && _accepted) { _mutex.ReleaseMutex(); _accepted = false; } } catch (Exception ex) { LogWriter.Log(ex, "Impossible to release the single instance mutex."); } try { HotKeyCollection.Default.Dispose(); } catch (Exception ex) { LogWriter.Log(ex, "Impossible to dispose the hotkeys."); } }
private void InitializeComponent2() { TrayIcon = new NotifyIcon(); TrayIcon.BalloonTipIcon = ToolTipIcon.Info; TrayIcon.BalloonTipText = "Instead of double-clicking the Icon, please right-click the Icon and select a context menu option."; TrayIcon.BalloonTipTitle = "Use the Context Menu"; TrayIcon.Text = "DevTrkr Context Menu"; //The icon is added to the project resources. Here I assume that the name of the file is 'TrayIcon.ico' TrayIcon.Icon = Properties.Resources.Role; //Optional - handle doubleclicks on the icon: TrayIcon.DoubleClick += TrayIcon_DoubleClick; //Optional - Add a context menu to the TrayIcon: TrayIconContextMenu = new ContextMenuStrip(); CloseMenuItem = new ToolStripMenuItem(); RunForm1 = new ToolStripMenuItem(); AboutForm = new ToolStripMenuItem(); OptionsForm = new ToolStripMenuItem(); TrayIconContextMenu.SuspendLayout(); // // TrayIconContextMenu // this.TrayIconContextMenu.Items.AddRange(new ToolStripItem[] { this.CloseMenuItem }); this.TrayIconContextMenu.Name = "TrayIconContextMenu"; this.TrayIconContextMenu.Size = new Size(153, 70); // // Form1 // this.TrayIconContextMenu.Items.AddRange(new ToolStripItem[] { this.RunForm1 }); this.TrayIconContextMenu.Items.AddRange(new ToolStripItem[] { this.OptionsForm }); this.TrayIconContextMenu.Items.AddRange(new ToolStripItem[] { this.AboutForm }); // // CloseMenuItem // this.CloseMenuItem.Name = "CloseMenuItem"; this.CloseMenuItem.Size = new Size(152, 22); this.CloseMenuItem.Text = "Close DevTrkr Application"; this.CloseMenuItem.Click += new EventHandler(this.CloseMenuItem_Click); this.RunForm1.Name = "RunReports"; this.RunForm1.Size = new Size(152, 22); this.RunForm1.Text = "Run Reports"; this.RunForm1.Click += new EventHandler(this.RunForm1_Click); this.OptionsForm.Name = "Options"; this.OptionsForm.Size = new Size(152, 222); this.OptionsForm.Text = "Options"; this.OptionsForm.Click += new EventHandler(this.OptionsForm_Click); this.AboutForm.Name = "AboutForm"; this.AboutForm.Size = new Size(152, 22); this.AboutForm.Text = "About DevTracker"; this.AboutForm.Click += new EventHandler(this.AboutForm_Click); TrayIconContextMenu.ResumeLayout(false); TrayIcon.ContextMenuStrip = TrayIconContextMenu; TrayIcon.Visible = true; }
public MainForm () { // // _contextMenu // _contextMenu = new ContextMenu (); // // _notifyIcon // _notifyIcon = new NotifyIcon (); _notifyIcon.ContextMenu = _contextMenu; // // _bringToFrontMenuItem // _bringToFrontMenuItem = new MenuItem (); _bringToFrontMenuItem.Text = "Bring to front..."; _bringToFrontMenuItem.Click += new EventHandler (BringToFrontMenuItem_Click); _contextMenu.MenuItems.Add (_bringToFrontMenuItem); // // _activateMenuItem // _activateMenuItem = new MenuItem (); _activateMenuItem.Text = "Activate..."; _activateMenuItem.Click += new EventHandler (ActivateMenuItem_Click); _contextMenu.MenuItems.Add (_activateMenuItem); // // _tabControl // _tabControl = new TabControl (); _tabControl.Dock = DockStyle.Fill; Controls.Add (_tabControl); // // _bugDescriptionText1 // _bugDescriptionText1 = new TextBox (); _bugDescriptionText1.Dock = DockStyle.Fill; _bugDescriptionText1.Multiline = true; _bugDescriptionText1.Text = string.Format (CultureInfo.InvariantCulture, "Steps to execute:{0}{0}" + "1. Right-click the notificy icon.{0}{0}" + "2. Click on another part of the notification area.{0}{0}" + "Expected result:{0}{0}" + "1. The context menu is closed.{0}{0}" + "2. The notify icon is redrawn.", Environment.NewLine); // // _tabPage1 // _tabPage1 = new TabPage (); _tabPage1.Text = "#1"; _tabPage1.Controls.Add (_bugDescriptionText1); _tabControl.Controls.Add (_tabPage1); // // _bugDescriptionText1 // _bugDescriptionText1 = new TextBox (); _bugDescriptionText1.Dock = DockStyle.Fill; _bugDescriptionText1.Multiline = true; _bugDescriptionText1.Text = string.Format (CultureInfo.InvariantCulture, "Steps to execute:{0}{0}" + "1. Right-click the notificy icon.{0}{0}" + "2. Right-click the notificy icon.{0}{0}" + "Expected result:{0}{0}" + "1. On step 2, the first context menu is closed and a new " + "context menu is displayed.{0}{0}" + "Applies to:{0}" + "Microsoft Windows", Environment.NewLine); // // _tabPage1 // _tabPage1 = new TabPage (); _tabPage1.Text = "#1"; _tabPage1.Controls.Add (_bugDescriptionText1); _tabControl.Controls.Add (_tabPage1); // // MainForm // ClientSize = new Size (300, 220); StartPosition = FormStartPosition.CenterScreen; Text = "bug #82160"; Load += new EventHandler (MainForm_Load); }