Beispiel #1
0
        public void MapCtrl_MethodsWithNoUserInteraction()
        {
            var focus = false;

            System.Threading.Thread t = new System.Threading.Thread(() =>
            {
                var sut = new MainCtrl();
                var form = new MainForm();
                sut.InitMindMate(form);
                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.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);
                };
                Timer timer = new Timer { Interval = 50 }; //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);
        }
Beispiel #2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            EnableLogListeners();
            //MyWebMind.Debug.IconListCreator.GenerateIconXML();
            MainCtrl mainCtrl = new MainCtrl();
            MainForm form     = new MainForm();

            mainCtrl.InitMindMate(form, new DialogManager());
            MainMenuCtrl mainMenuCtrl = new MainMenuCtrl(form.MainMenu, mainCtrl);

            form.MainMenuCtrl            = mainMenuCtrl;
            Application.ThreadException += Application_ThreadException;
            Application.Run(form);
            CloseLogListeners();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            ProgramMainHelper.EnableLogListeners();
            //MyWebMind.Debug.IconListCreator.GenerateIconXML();
            MainCtrl mainCtrl = new MainCtrl();
            MainForm form     = new MainForm();

            ProgramMainHelper.SetFileToOpenFromAppArguments(args, form);
            mainCtrl.InitMindMate(form, new DialogManager());

            // specific to WinXP
            MainMenuCtrl mainMenuCtrl = new MainMenuCtrl(form.MainMenu, mainCtrl);

            form.MainMenuCtrl = mainMenuCtrl;

            // specific to WinXP

            Application.ThreadException += ProgramMainHelper.Application_ThreadException;
            Application.Run(form);
            ProgramMainHelper.CloseLogListeners();
        }
Beispiel #4
0
 public void RefreshRecentFilesMenuItems()
 {
     MainMenuCtrl.RefreshRecentFilesMenuItems();
 }
Beispiel #5
0
 public void InsertMenuItems(MainMenuItem[] menuItems)
 {
     MainMenuCtrl.InsertMenuItems(menuItems);
 }