void mCut_Click(object sender, EventArgs e) { mainCtrl.Cut(); }
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if ((keyData & Keys.Control) == Keys.Control) { switch (keyData) { case (Keys.Control | Keys.N): mainCtrl.NewMap(); return(true); case (Keys.Control | Keys.O): mainCtrl.OpenMap(); return(true); case (Keys.Control | Keys.S): mainCtrl.SaveCurrentMap(); return(true); case (Keys.Control | Keys.Shift | Keys.S): mainCtrl.SaveAll(); return(true); case (Keys.Control | Keys.Z): mainCtrl.Undo(); return(true); case (Keys.Control | Keys.Y): mainCtrl.Redo(); return(true); case (Keys.Control | Keys.C): mainCtrl.Copy(); return(true); case (Keys.Control | Keys.V): mainCtrl.Paste(); return(true); case (Keys.Control | Keys.X): mainCtrl.Cut(); return(true); case (Keys.Control | Keys.B): mainCtrl.CurrentMapCtrl.ToggleBold(); return(true); case (Keys.Control | Keys.I): mainCtrl.CurrentMapCtrl.ToggleItalic(); return(true); case (Keys.Control | Keys.D): mainCtrl.CurrentMapCtrl.ChangeFont(); return(true); } } else if ((keyData & Keys.Alt) == Keys.Alt) { switch (keyData) { case (Keys.Alt | Keys.I): mainCtrl.CurrentMapCtrl.AppendIconFromIconSelectorExt(); return(true); } } return(base.ProcessCmdKey(ref msg, keyData)); }
public void MapCtrl_MethodsWithNoUserInteraction() { var focus = false; System.Threading.Thread t = new System.Threading.Thread(() => { MetaModel.MetaModel.Initialize(); var sut = new MainCtrl(); var form = new MainForm(); sut.InitMindMate(form, A.Fake <DialogManager>()); MainMenuCtrl mainMenuCtrl = new MainMenuCtrl(form.MainMenu, sut); form.MainMenuCtrl = mainMenuCtrl; form.Shown += (sender, args) => { sut.ReturnFocusToMapView(); sut.Bold(true); focus = sut.CurrentMapCtrl.MapView.Tree.RootNode.Bold; sut.ClearSelectionFormatting(); sut.Copy(); sut.Cut(); sut.Paste(); sut.SetBackColor(Color.White); sut.SetFontFamily("Arial"); sut.SetFontSize(15); sut.SetForeColor(Color.Blue); sut.SetMapViewBackColor(Color.White); sut.Strikethrough(true); sut.Subscript(); sut.Superscript(); sut.Underline(true); sut.PersistenceManager.NewTree(); sut.PersistenceManager.CloseCurerntTree(); }; Timer timer = new Timer { Interval = 5 }; //timer is used because the Dirty property is updated in the next event of GUI thread. timer.Tick += delegate { if (timer.Tag == null) { timer.Tag = "First Event Fired"; } else if (timer.Tag.Equals("First Event Fired")) { timer.Tag = "Second Event Fired"; } else { foreach (var f in sut.PersistenceManager) { f.IsDirty = false; //to avoid save warning dialog } form.Close(); } }; timer.Start(); form.ShowDialog(); timer.Stop(); }); t.SetApartmentState(System.Threading.ApartmentState.STA); t.Start(); t.Join(); Assert.IsTrue(focus); }