//////////////////////////////////////// /// <summary> /// Constructor. /// Mapping to SourceForge project is determined from the assembly attributes.</summary> /// <param name="anon">True if anonymous login</param> public FeedbackForm(bool anon) { Assembly assembly = Assembly.GetEntryAssembly(); // use ProjectMappingAttribute for mapping ProjectMappingAttribute mapAttr = (ProjectMappingAttribute)Attribute.GetCustomAttribute(assembly, typeof(ProjectMappingAttribute)); if (mapAttr != null && mapAttr.Mapping != null && mapAttr.Mapping.Trim().Length != 0) { m_mappingName = mapAttr.Mapping.Trim(); } else { m_mappingName = null; } InitializeComponent(); // set the priority to low m_cmbPriority.SelectedIndex = 2; m_anonymous = anon; if (anon) { m_passwordLabel.Visible = false; m_passwordTextBox.Visible = false; m_userLabel.Visible = false; m_userTextBox.Visible = false; } else { m_txtEmail.Visible = false; m_lblEmail.Visible = false; } }
/// <summary> /// Initializes component</summary> /// <returns>True iff component was initialized correctly</returns> void IInitializable.Initialize() { // check for assembly mapping attribute. // this attribute is used for bug-reporting and checking for update. Assembly assembly = Assembly.GetEntryAssembly(); ProjectMappingAttribute mapAttr = (ProjectMappingAttribute)Attribute.GetCustomAttribute(assembly, typeof(ProjectMappingAttribute)); m_assemblyMappingFound = (mapAttr != null && mapAttr.Mapping != null && mapAttr.Mapping.Trim().Length != 0); if (m_assemblyMappingFound) { // check for new update m_updateCheck = new VersionCheck(); m_updateCheck.CheckComplete += updateCheck_CheckComplete; m_commandService.RegisterCommand(new CommandInfo( Command.HelpCheckForUpdate, StandardMenu.Help, StandardCommandGroup.HelpUpdate, "Check for update...".Localize(), "Check for product update".Localize()), this); RegisterSettings(); } }
/// <summary> /// Constructor. /// Mapping name and version are obtained from attributes on the assembly: /// /// AssemblyTitleAttribute specifies mapping (or ProjectMappingAttribute, if present). /// AssemblyVersionAttribute specifies version. /// The file release in SourceForge should be named: /// "{mapping name} {version}" /// ,e.g., /// "SoundConvert 1.0" /// "SCREAM Tool 5.1.0".</summary> public VersionCheck() { Assembly assembly = Assembly.GetEntryAssembly(); // use ProjectMappingAttribute for mapping ProjectMappingAttribute mapAttr = (ProjectMappingAttribute)Attribute.GetCustomAttribute(assembly, typeof(ProjectMappingAttribute)); if (mapAttr != null && mapAttr.Mapping != null && mapAttr.Mapping.Trim().Length != 0) { m_appMappingName = mapAttr.Mapping.Trim(); } else { m_appMappingName = null; } m_appVersion = assembly.GetName().Version; // Force control to have a handle. // Usually a control will get a handle assigned to it only when it becomes visible for the first time. // Note: that the handle of the control will tie it to the thread that creates it. // We want to tie the control to the main thread. #pragma warning disable 168 //suppress warning about unused local variable IntPtr dummyHandle = m_dummyControl.Handle; #pragma warning restore 168 }
/// <summary> /// Initializes plugin</summary> /// <returns>true, iff plugin was initialized correctly</returns> void IInitializable.Initialize() { // check for assembly mapping attribute. // this attribute is used for bug-reporting and checking for update. Assembly assembly = Assembly.GetEntryAssembly(); ProjectMappingAttribute mapAttr = (ProjectMappingAttribute)Attribute.GetCustomAttribute(assembly, typeof(ProjectMappingAttribute)); m_assemblyMappingFound = (mapAttr != null && mapAttr.Mapping != null && mapAttr.Mapping.Trim().Length != 0); if (m_assemblyMappingFound) { m_commandService.RegisterCommand(new CommandInfo( Command.HelpSendFeedback, StandardMenu.Help, StandardCommandGroup.HelpUpdate, "Send Feedback...".Localize(), "Report bug or request feature".Localize()), this); } }