private void CheckOkEnable() { bool isEnable = !manualEditPanel.Visible; if (txtName.Text.Length == 0 || cboParentCollector.SelectedIndex < 0 || (!chkFolder.Checked && (cboCollector.SelectedIndex < 0 || SelectedEntry.Configuration == null || SelectedEntry.Configuration.Length == 0))) { isEnable = false; } cmdOK.Enabled = isEnable; configureEditButtonCollector.Enabled = cboCollector.SelectedIndex > -1 && !txtConfig.Visible && !chkFolder.Checked; cboCollector.Enabled = !chkFolder.Checked && allowCollectorChange; chkCollectOnParentWarning.Enabled = !chkFolder.Checked; numericUpDownRepeatAlertInXMin.Enabled = !chkFolder.Checked; AlertOnceInXMinNumericUpDown.Enabled = !chkFolder.Checked; delayAlertSecNumericUpDown.Enabled = !chkFolder.Checked; lblAgentDescription.Text = ""; if (cboCollector.SelectedIndex > -1) { try { AgentRegistration ar = (AgentRegistration)cboCollector.SelectedItem; System.Reflection.Assembly a = System.Reflection.Assembly.LoadFrom(ar.AssemblyPath); System.Reflection.AssemblyDescriptionAttribute ad = (System.Reflection.AssemblyDescriptionAttribute)System.Reflection.AssemblyDescriptionAttribute.GetCustomAttribute( a, typeof(System.Reflection.AssemblyDescriptionAttribute)); lblAgentDescription.Text = "Description: " + ad.Description; } catch { } } }
private void CheckOkEnable() { bool isEnable = !txtConfig.Visible; if (txtName.Text.Length == 0 || cboNotifier.SelectedIndex < 0 || SelectedEntry.Configuration == null || SelectedEntry.Configuration.Length == 0) { isEnable = false; } cmdOK.Enabled = isEnable; configureEditButtonNotifier.Enabled = cboNotifier.SelectedIndex > -1 && !txtConfig.Visible; lblAgentDescription.Text = ""; if (cboNotifier.SelectedIndex > -1) { try { AgentRegistration ar = (AgentRegistration)cboNotifier.SelectedItem; System.Reflection.Assembly a = System.Reflection.Assembly.LoadFrom(ar.AssemblyPath); System.Reflection.AssemblyDescriptionAttribute ad = (System.Reflection.AssemblyDescriptionAttribute)System.Reflection.AssemblyDescriptionAttribute.GetCustomAttribute( a, typeof(System.Reflection.AssemblyDescriptionAttribute)); lblAgentDescription.Text = "Description: " + ad.Description; } catch { } } }
/// <summary> /// Shows the settings dialog, or, by default, shows a message box indicating the assembly name, version and copyright information. /// </summary> protected virtual void ShowSettingsDialog() { System.IO.StringWriter sw = new System.IO.StringWriter(); System.Reflection.AssemblyName name = System.Reflection.Assembly.GetExecutingAssembly().GetName(); sw.WriteLine(name.Name); sw.WriteLine("Version " + name.Version); object[] attribs = System.Reflection.Assembly.GetExecutingAssembly(). GetCustomAttributes(typeof(System.Reflection.AssemblyDescriptionAttribute), false); if (attribs != null && attribs.Length != 0) { System.Reflection.AssemblyDescriptionAttribute desc = attribs[0] as System.Reflection.AssemblyDescriptionAttribute; if (desc.Description != string.Empty) { sw.WriteLine(desc.Description); } } attribs = System.Reflection.Assembly.GetExecutingAssembly(). GetCustomAttributes(typeof(System.Reflection.AssemblyCopyrightAttribute), false); if (attribs != null && attribs.Length != 0) { System.Reflection.AssemblyCopyrightAttribute copyright = attribs[0] as System.Reflection.AssemblyCopyrightAttribute; if (copyright.Copyright != string.Empty) { sw.WriteLine(); sw.WriteLine(copyright.Copyright); } } if (settingsText != null && settingsText != string.Empty) { sw.WriteLine(); sw.WriteLine(SettingsText); } MessageBox.Show(sw.ToString(), "PixieSaver", MessageBoxButtons.OK); }
public static string GetApplicationDescription() { System.Reflection.AssemblyDescriptionAttribute attribute = (System.Reflection.AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(System.Reflection.AssemblyDescriptionAttribute)); return(attribute.Description); }