Example #1
0
        public MainForm()
        {
            Title = "Krofiler";
            //TODO: Store in xml location/size and load here
            ClientSize = new Size(1500, 1000);
            var quitCommand = new Command {
                MenuText = "Quit",
                Shortcut = Application.Instance.CommonModifier | Keys.Q
            };

            quitCommand.Executed += delegate { Application.Instance.Quit(); };

            var aboutCommand = new Command {
                MenuText = "About..."
            };

            aboutCommand.Executed += delegate { MessageBox.Show(this, "Created by David Karlaš"); };

            // create menu
            Menu = new MenuBar {
                Items =
                {
                    new ButtonMenuItem {
                        Text = "&File"
                    },
                },
                ApplicationItems =
                {
                    // application (OS X) or file menu (others)
                    new ButtonMenuItem {
                        Text    = "&Preferences...",
                        Command = new Command(Preferences)
                    }
                },
                QuitItem  = quitCommand,
                AboutItem = aboutCommand,
                HelpItems =
                {
                    new ButtonMenuItem {
                        Text = "Profile for 5 seconds", Command = new Command(delegate{
                            UIThreadMonitor.Profile(5);
                        })
                    }
                }
            };

            var mainTabControl = new TabControl();

            mainTabControl.Pages.Add(new TabPage(new HomePage())
            {
                Text = "Home"
            });
            Content = mainTabControl;
        }
Example #2
0
        void StartFromFile(string fileName)
        {
            Settings.Instance.RecentlyOpenedFiles.Remove(fileName);
            Settings.Instance.RecentlyOpenedFiles.Insert(0, fileName);
            Settings.Instance.Save();

            StartProfiling(new StartProfilingFromFileInfo()
            {
                MlpdFilePath = fileName
            });
            Task.Delay(1000).ContinueWith(delegate {
                UIThreadMonitor.Profile(10);
            });
        }