private void ReadmeFileNotificationHandler(object aSender, FileNotificationEventArgs aArgs) { try { if ((aArgs.NotifyCode == OTAFileNotification.ofnFileOpened) && OtaUtils.IsProjectFile(aArgs.FileName)) { IOTAProject project1 = OtaUtils.GetCurrentProject(); if (project1 != null) { for (int i = 0; i < project1.ModuleCount; i++) { IOTAModuleInfo info1 = project1.GetModuleInfo(i); string text2 = info1.FileName; if (String.IsNullOrEmpty(text2) || !OtaUtils.IsDocFile(text2)) { continue; } if (System.IO.Path.GetFileName(text2).IndexOf("README", StringComparison.OrdinalIgnoreCase) > -1) { System.Diagnostics.Process.Start(text2); } else { LoggingService.Warn("Readme: no readme file in this project."); } } } else { LoggingService.Warn("Readme: IOTAProject is null even though a project file is opened."); } } } catch (Exception ex) { LoggingService.Error("Readme: bug is here." + ex.GetType() + ex.Message + ex.StackTrace); throw; } }
private static void SetActiveProjectFileNotificationHandler(object aSender, FileNotificationEventArgs aArgs) { try { // Notification for the Project Group if (OtaUtils.IsProjectGroupFile(aArgs.FileName) && aArgs.NotifyCode == OTAFileNotification.ofnFileOpened) { fTimerActiveProject.Interval = 2000; fTimerActiveProject.Tick += new EventHandler(DoTimerActiveProject); fTimerActiveProject.Enabled = true; } else if (OtaUtils.IsProjectGroupFile(aArgs.FileName) && aArgs.NotifyCode == OTAFileNotification.ofnFileClosing) { // Reset the configuration//TODO project option //OptionManager.ResetProjectGroupOptions(); } else if (OtaUtils.IsProjectFile(aArgs.FileName) && aArgs.NotifyCode == OTAFileNotification.ofnActiveProjectChanged) { //TODO: move to NFamily somehow. // Ant _Ant = Ant.getInstance(); // // if (_Ant != null) { // _Ant.ResetTargets(); // } } } catch (Exception ex) { Lextm.Windows.Forms.MessageBoxFactory.Fatal(Name, ex); } }
private static void OpenCloseFileNotificationHandler(object sender, FileNotificationEventArgs e) { try { LoggingService.Info("file opening is " + e.FileName); // if (!OTAUtils.IsSourceFile(e.FileName)) { // LoggingService.Warn("not a source file."); // return; // } if (e.NotifyCode == OTAFileNotification.ofnFileOpened) { IOTAModule _Module = OtaUtils.GetModuleServices().FindModule(e.FileName); if (_Module != null) { IOTASourceEditor _Editor = OtaUtils.GetSourceEditor(_Module); if (_Editor != null) { _Editor.ViewActivated -= new ViewActivatedEventHandler(ActivateProjectFromFile); _Editor.ViewActivated += new ViewActivatedEventHandler(ActivateProjectFromFile); LoggingService.Info("view activated added"); } else { LoggingService.Warn("view activated not added"); } } else { LoggingService.Warn("null module"); } } else if (e.NotifyCode == OTAFileNotification.ofnFileClosing) { IOTAModule _Module = OtaUtils.GetModuleServices().FindModule(e.FileName); if (_Module != null) { IOTASourceEditor _Editor = OtaUtils.GetSourceEditor(_Module); if (_Editor != null) { _Editor.ViewActivated -= new ViewActivatedEventHandler(ActivateProjectFromFile); LoggingService.Info("view activated removed"); } else { LoggingService.Warn("null editor"); } } } } catch (Exception ex) { Lextm.Windows.Forms.MessageBoxFactory.Fatal(Name, ex); } }
private void OpenCloseFileNotificationHandler(object aSender, FileNotificationEventArgs aArgs) { LoggingService.Debug("enter handler"); try { if (OtaUtils.IsCSFile(aArgs.FileName) && aArgs.NotifyCode == OTAFileNotification.ofnFileOpened) { IOTAModule _Module = OtaUtils.GetModuleServices().FindModule(aArgs.FileName); if (_Module != null) { IDesignerHost _Designer = OtaUtils.GetDesignerForModule(_Module); if (_Designer != null) { // this module has a designer, so it is Control, UserControl, or Form. IComponentChangeService _ChangeService = (IComponentChangeService) _Designer.GetService(typeof(IComponentChangeService)); // drops default handler and installs custom handler. _ChangeService.ComponentAdded -= new ComponentEventHandler(OnComponentAdded); _ChangeService.ComponentAdded += new ComponentEventHandler(OnComponentAdded); LoggingService.Info("component added"); } else { LoggingService.Warn("component not added"); } } } else if (OtaUtils.IsCSFile(aArgs.FileName) && aArgs.NotifyCode == OTAFileNotification.ofnFileClosing) { IOTAModule _Module = OtaUtils.GetModuleServices().FindModule(aArgs.FileName); if (_Module != null) { // Remove the Auto Rename Control Handler IDesignerHost _Designer = OtaUtils.GetDesignerForModule(_Module); if (_Designer != null) { IComponentChangeService _ChangeService = (IComponentChangeService) _Designer.GetService(typeof(IComponentChangeService)); _ChangeService.ComponentAdded -= new ComponentEventHandler(OnComponentAdded); LoggingService.Info("component removed"); } } } } catch (Exception ex) { Lextm.Windows.Forms.MessageBoxFactory.Fatal(Name, ex); } }
private static void ShowWarningsFileNotificationHandler(object aSender, FileNotificationEventArgs aArgs) { // Notification for the Project Group if (aArgs.NotifyCode == OTAFileNotification.ofnFileOpened) { MessageService.ShowAll(); } }
private static void OpenCloseFileNotificationHandler(object sender, FileNotificationEventArgs e) { try { LoggingService.Info("file opening is " + e.FileName); if (!OtaUtils.IsSourceFile(e.FileName)) { LoggingService.Warn("not a source file."); return; } if (e.NotifyCode == OTAFileNotification.ofnFileOpened) { IOTAModule _Module = OtaUtils.GetModuleServices().FindModule(e.FileName); if (_Module != null) { IOTAEditor _Editor = OtaUtils.GetEditorWithSourceEditor(_Module); if (_Editor != null) { _Editor.Modified -= new EventHandler(KeyDispatcher); _Editor.Modified += new EventHandler(KeyDispatcher); LoggingService.Info("AC trigger added"); } else { LoggingService.Warn("AC trigger not added"); } } else { LoggingService.Warn("null module"); } } else if (e.NotifyCode == OTAFileNotification.ofnFileClosing) { IOTAModule _Module = OtaUtils.GetModuleServices().FindModule(e.FileName); if (_Module != null) { // Remove the Auto Completion Handler IOTAEditor _Editor = OtaUtils.GetEditorWithSourceEditor(_Module); if (_Editor != null) { _Editor.Modified -= new EventHandler(KeyDispatcher); LoggingService.Info("AC trigger removed"); } else { LoggingService.Warn("null editor"); } } } } catch (Exception ex) { Lextm.Windows.Forms.MessageBoxFactory.Fatal(Name, ex); throw; } }