private void InitializeNotifyIcon() { if (mNotifyIcon == null) { mNotifyIcon = new NotifyIcon(); mNotifyIcon.DoubleClick += new EventHandler(mNotifyIcon_DoubleClick); } ContextMenu contextMenu = new ContextMenu(); MenuItem nameMenuItem = new MenuItem(this.Name + " (" + AemInstanceTypeUtil.GetLabel(this.AemInstanceType) + ")"); nameMenuItem.Enabled = false; contextMenu.MenuItems.Add(nameMenuItem); contextMenu.MenuItems.Add(new MenuItem("-")); AemActions.AddControlMenuItems(contextMenu.MenuItems, this); contextMenu.MenuItems.Add(new MenuItem("-")); AemActions.AddLogMenuItems(contextMenu.MenuItems, this); contextMenu.MenuItems.Add(new MenuItem("-")); AemActions.AddOpenMenuItems(contextMenu.MenuItems, this, true); contextMenu.MenuItems.Add(new MenuItem("-")); contextMenu.MenuItems.Add(new MenuItem("Properties", propertiesMenuItem_Click)); this.NotifyIcon.ContextMenu = contextMenu; mNotifyIcon.Text = this.Name; mNotifyIcon.Visible = this.ShowInTaskbar; string trayIcon = "trayicon_disabled"; mNotifyIcon.Icon = IconCache.GetIcon(this.IconSet, this.CustomIconPath, trayIcon); }
public void UpdateInstanceListView() { AemInstance selectedInstance = this.SelectedInstanceInListview; DataTable dt = new DataTable(); dt.Columns.Add("Instance", typeof(AemInstance)); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("Type", typeof(string)); dt.Columns.Add("URL", typeof(string)); dt.Columns.Add("Path", typeof(string)); dt.Columns.Add("Status", typeof(string)); foreach (AemInstance instance in Program.InstanceList) { DataRow row = dt.NewRow(); row["Instance"] = instance; row["Name"] = instance.Name; row["Type"] = AemInstanceTypeUtil.GetLabel(instance.AemInstanceType); row["URL"] = instance.UrlWithContextPath; row["Path"] = instance.Path; row["Status"] = instance.GetStatusText(); dt.Rows.Add(row); } dgInstances.DataSource = dt; foreach (DataGridViewRow gridRow in dgInstances.Rows) { DataRow row = (DataRow)((DataRowView)gridRow.DataBoundItem).Row; if (row["Instance"] == selectedInstance) { dgInstances.CurrentCell = gridRow.Cells[0]; break; } } }
private void AemInstanceDialog_Load(object sender, EventArgs e) { // init instance type selectbox int selectedAemInstanceType = 0; cboAemInstanceType.DisplayMember = "Key"; cboAemInstanceType.ValueMember = "Value"; int i = 0; foreach (AemInstanceType aemInstanceType in Enum.GetValues(typeof(AemInstanceType))) { string name = AemInstanceTypeUtil.GetLabel(aemInstanceType); cboAemInstanceType.Items.Add(new KeyValuePair <string, AemInstanceType>(name, aemInstanceType)); if (aemInstanceType == mInstance.AemInstanceType) { selectedAemInstanceType = i; } i++; } // init iconset selectbox int selectedIconSet = 0; cboIconSet.DisplayMember = "Key"; cboIconSet.ValueMember = "Value"; i = 0; foreach (IconSet iconset in Enum.GetValues(typeof(IconSet))) { string name = iconset.ToString().ToLower(); if (iconset == IconSet.DEFAULT) { name = "Default"; } else if (iconset.ToString().StartsWith("NUM")) { name = "Number #" + iconset.ToString().Substring(3); } else if (iconset.ToString().StartsWith("INV_NUM")) { name = "Number #" + iconset.ToString().Substring(7) + " (inverted)"; } else if (iconset.ToString().StartsWith("Q")) { name = "Square #" + iconset.ToString().Substring(1); } else if (iconset.ToString().StartsWith("INV_Q")) { name = "Square #" + iconset.ToString().Substring(5) + " (inverted)"; } cboIconSet.Items.Add(new KeyValuePair <string, IconSet>(name, iconset)); if (iconset == mInstance.IconSet) { selectedIconSet = i; } i++; } cboAemInstanceType.SelectedIndex = selectedAemInstanceType; txtName.Text = mInstance.Name; txtHostname.Text = mInstance.Hostname; txtPort.Text = mInstance.Port.ToString(); txtContextPath.Text = mInstance.ContextPath; txtPath.Text = mInstance.Path; txtJavaExecutable.Text = mInstance.JavaExecutable; txtUsername.Text = mInstance.Username; txtPassword.Text = mInstance.Password; chkRunmodeAuthor.Checked = (mInstance.Runmode == Runmode.AUTHOR); chkRunmodePublish.Checked = (mInstance.Runmode == Runmode.PUBLISH); txtAdditionalRunmodes.Text = mInstance.AdditionalRunmodes; chkRunmodeSampleContent.Checked = mInstance.RunmodeSampleContent; cboIconSet.SelectedIndex = selectedIconSet; txtCustomIconPath.Text = mInstance.CustomIconPath; txtHeapMinSizeMb.Text = mInstance.HeapMinSizeMb.ToString(); txtHeapMaxSizeMb.Text = mInstance.HeapMaxSizeMb.ToString(); txtMaxPermSizeMb.Text = mInstance.MaxPermSizeMb.ToString(); chkJVMDebug.Checked = mInstance.JVMDebug; txtDebugPort.Text = mInstance.DebugPort.ToString(); txtDebugPort.Enabled = chkJVMDebug.Checked; chkJProfiler.Checked = mInstance.JProfiler; txtJProfilerPort.Text = mInstance.JProfilerPort.ToString(); txtJProfilerPort.Enabled = chkJProfiler.Checked; chkJConsole.Checked = mInstance.JConsole; txtJConsolePort.Text = mInstance.JConsolePort.ToString(); txtJConsolePort.Enabled = chkJConsole.Checked; chkHideConfigWizards.Checked = mInstance.HideConfigWizard; chkShowInstanceWindow.Checked = mInstance.ShowInstanceWindow; chkOpenBrowser.Checked = mInstance.OpenBrowser; chkRemoteProcess.Checked = mInstance.RemoteProcess; chkShowInTaskbar.Checked = mInstance.ShowInTaskbar; chkCustomJVMParam1Active.Checked = mInstance.CustomJVMParam1Active; txtCustomJVMParam1.Text = mInstance.CustomJVMParam1; txtCustomJVMParam1.Enabled = chkCustomJVMParam1Active.Checked; chkCustomJVMParam2Active.Checked = mInstance.CustomJVMParam2Active; txtCustomJVMParam2.Text = mInstance.CustomJVMParam2; txtCustomJVMParam2.Enabled = chkCustomJVMParam2Active.Checked; chkCustomJVMParam3Active.Checked = mInstance.CustomJVMParam3Active; txtCustomJVMParam3.Text = mInstance.CustomJVMParam3; txtCustomJVMParam3.Enabled = chkCustomJVMParam3Active.Checked; txtBrowserExecutable.Text = mInstance.BrowserExecutable; }