public Main() { Core.Controller.Register.Frames(new Window[] { this, new Search(), new Credits() }); EventsManager.MainFrame FrameEvents = new EventsManager.MainFrame(); EventsManager.TabControl TabControllEvents = new EventsManager.TabControl(); EventsManager.MainMenu MenuEvents = new EventsManager.MainMenu(); EventsManager.SearchFrame SearchEvents = new EventsManager.SearchFrame(); InitializeComponent(); Core.Utility.Main.SetResourceImage(Properties.Resources.box_full, ImageFormat.Png, DataMenuItem); Core.Utility.Main.SetResourceImage(Properties.Resources.open_arrow, ImageFormat.Png, OpenFileMenuItem); Core.Utility.Main.SetResourceImage(Properties.Resources.save_text, ImageFormat.Png, SaveMenuItem); Core.Utility.Main.SetResourceImage(Properties.Resources.save_text, ImageFormat.Png, SaveAsMenuItem); Core.Controller.Register.MainView(this.MainView); Core.Controller.Register.TabControl(this.tabControl); Core.Controller.Register.EmptyMessage(this.Message_Label); Core.Controller.Register.SaveOptions(this.MainMenu); Core.Controller.Register.Edit(this.Edit); Core.Controller.Register.StatusBar(this.Compiling, this.Line, this.Column); Core.Controller.Register.CompilePanel(this.CompilerPanel); // MainFrame this.Loaded += FrameEvents.MainFrameLoaded; this.Closed += FrameEvents.MainFrameClosed; this.Closing += FrameEvents.MainFrameClosing; // Event for transparency of the SearchFrame this.Activated += FrameEvents.MainFrameActivated; this.Drop += FrameEvents.MainFrameDrop; tabControl.SelectionChanged += TabControllEvents.SelectionChanged; // Data Create_File.Click += MenuEvents.CreateFileClick; Open_File.Click += MenuEvents.OpenFileClick; Close_File.Click += MenuEvents.CloseFileClick; Close_All.Click += MenuEvents.CloseAllClick; Save.Click += MenuEvents.SaveClick; SaveAs.Click += MenuEvents.SaveAsClick; Exit.Click += MenuEvents.ExitClick; RoutedCommand SaveCmd = new RoutedCommand(); SaveCmd.InputGestures.Add(new KeyGesture(Key.S, ModifierKeys.Control)); CommandBindings.Add(new CommandBinding(SaveCmd, MenuEvents.SaveClick)); RoutedCommand NewFileCmd = new RoutedCommand(); NewFileCmd.InputGestures.Add(new KeyGesture(Key.N, ModifierKeys.Control)); CommandBindings.Add(new CommandBinding(NewFileCmd, MenuEvents.CreateFileClick)); // Edit Undo.Click += MenuEvents.UndoClick; Cut.Click += MenuEvents.CutClick; Copy.Click += MenuEvents.CopyClick; Paste.Click += MenuEvents.PasteClick; // Find RoutedCommand FindCmd = new RoutedCommand(); FindCmd.InputGestures.Add(new KeyGesture(Key.F, ModifierKeys.Control)); CommandBindings.Add(new CommandBinding(FindCmd, MenuEvents.Search)); // Find Next RoutedCommand FindNextCmd = new RoutedCommand(); FindNextCmd.InputGestures.Add(new KeyGesture(Key.F3)); CommandBindings.Add(new CommandBinding(FindNextCmd, MenuEvents.FindNext)); // Replace RoutedCommand ReplaceCmd = new RoutedCommand(); ReplaceCmd.InputGestures.Add(new KeyGesture(Key.H, ModifierKeys.Control)); CommandBindings.Add(new CommandBinding(ReplaceCmd, MenuEvents.Replace)); // GoTo RoutedCommand GoToCmd = new RoutedCommand(); GoToCmd.InputGestures.Add(new KeyGesture(Key.G, ModifierKeys.Control)); CommandBindings.Add(new CommandBinding(GoToCmd, MenuEvents.GoTo)); Find.Click += MenuEvents.FindClick; Go_To.Click += MenuEvents.GoToClick; // Compiler RoutedCommand CompileCmd = new RoutedCommand(); CompileCmd.InputGestures.Add(new KeyGesture(Key.F5)); CommandBindings.Add(new CommandBinding(CompileCmd, MenuEvents.Compile)); Core.Controller.Register.CompileMenuItem(this.Compile); Compile.Click += MenuEvents.CompileClick; Compiler_Path.Click += MenuEvents.CompilerPathClick; CompilerCloseBox.MouseLeftButtonDown += MenuEvents.CompilerCloseClick; CompilerCloseBox.MouseEnter += SearchEvents.CloseMouseEnter; CompilerCloseBox.MouseLeave += SearchEvents.CloseMouseLeave; // About RoutedCommand AboutCmd = new RoutedCommand(); AboutCmd.InputGestures.Add(new KeyGesture(Key.F1)); CommandBindings.Add(new CommandBinding(AboutCmd, MenuEvents.AboutClick)); About.Click += MenuEvents.AboutClick; Analysis.Click += MenuEvents.AnalyseClick; }
public Search() { MenuEvents = new EventsManager.MainMenu(); SearchEvents = new EventsManager.SearchFrame(); GoToEvents = new EventsManager.GoToFrame(); InitializeComponent(); // Register Main Core.Controller.Register.SearchControl(SearchControl); Core.Controller.Register.SearchInfo(SearchInfo); // Register Header Core.Controller.Register.MoveHeader(Head); // Register Search Core.Controller.Register.SearchComponents(SearchTabGrid); //Register Replace Core.Controller.Register.ReplaceComponents(ReplaceTabGrid); // Register GoTo Core.Controller.Register.GoToComponents(GoToGrid); // Events Search Cancel.Click += SearchEvents.CancelClick; Do_Search.Click += SearchEvents.SearchClick; Do_Count.Click += SearchEvents.CountClick; // Events Replace Do_Search_Replace.Click += SearchEvents.DoSearchReplaceClick; Do_Replace.Click += SearchEvents.DoReplace; Do_Replace_All.Click += SearchEvents.DoReplaceAll; Cancel_Replace.Click += SearchEvents.CancelClick; MatchCase.Checked += SearchEvents.MatchCaseChecked; MatchCase.Unchecked += SearchEvents.MatchCaseUnchecked; WrapAround.Checked += SearchEvents.WrapAroundChecked; WrapAround.Unchecked += SearchEvents.WrapAroundUnchecked; MatchCase_Replace.Checked += SearchEvents.MatchCaseChecked; MatchCase_Replace.Unchecked += SearchEvents.MatchCaseUnchecked; WrapAround_Replace.Checked += SearchEvents.WrapAroundChecked; WrapAround_Replace.Unchecked += SearchEvents.WrapAroundUnchecked; // Events GoTo Line.Checked += GoToEvents.LineChecked; Offset.Checked += GoToEvents.OffsetChecked; GoToBox.PreviewTextInput += GoToEvents.PreviewTextInput; Button_ToNowhere.Click += GoToEvents.GoNowhereClick; Button_ToGo.Click += GoToEvents.GoToClick; // Events Frame SearchControl.Loaded += SearchEvents.Loaded; this.Closing += SearchEvents.Closing; // Event for transparency this.Activated += SearchEvents.Activated; // Events for the rebuild Header CloseBox.MouseEnter += SearchEvents.CloseMouseEnter; CloseBox.MouseLeave += SearchEvents.CloseMouseLeave; CloseBox.MouseLeftButtonDown += SearchEvents.CloseMouseLeftButtonDown; Head.MouseLeftButtonDown += SearchEvents.HeadMouseLeftButtonDown; // Ctrl + G will switch to GoTo RoutedCommand GoToCmd = new RoutedCommand(); GoToCmd.InputGestures.Add(new KeyGesture(Key.G, ModifierKeys.Control)); CommandBindings.Add(new CommandBinding(GoToCmd, MenuEvents.GoTo)); // Ctrl + G will switch to Search RoutedCommand FindCmd = new RoutedCommand(); FindCmd.InputGestures.Add(new KeyGesture(Key.F, ModifierKeys.Control)); CommandBindings.Add(new CommandBinding(FindCmd, MenuEvents.Search)); // Ctrl + H will switch to Replace RoutedCommand ReplaceCmd = new RoutedCommand(); ReplaceCmd.InputGestures.Add(new KeyGesture(Key.H, ModifierKeys.Control)); CommandBindings.Add(new CommandBinding(ReplaceCmd, MenuEvents.Replace)); }