Beispiel #1
0
 protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
 {
     if (keyData == (Keys.Control | Keys.T))
     {
         InsertTab(TabFactory.CreateTab());
     }
     if (keyData == (Keys.Control | Keys.W))
     {
         tabbedPane.RemoveSelectedTab();
     }
     return(base.ProcessCmdKey(ref msg, keyData));
 }
Beispiel #2
0
        private static void InsertNewTabButton()
        {
            ImageButton newTab = new ImageButton();

            newTab.Icon    = Resources.NewTab;
            newTab.ToolTip = Resources.NewTabButtonTooltip;

            newTab.Click += delegate
            {
                InsertTab(TabFactory.CreateTab());
            };
            tabbedPane.AddTabButton(newTab);
        }
Beispiel #3
0
        public MainForm()
        {
            SetProcessDPIAware();
            InitializeComponent();
            WinFormsUIContext.Instance.Value = WindowsFormsSynchronizationContext.Current;

            InitializeComponent();
            String[] arguments = Environment.GetCommandLineArgs();
            System.Collections.Generic.List <string> switches = new System.Collections.Generic.List <string>();
            foreach (string arg in arguments)
            {
                if (arg != null && arg.ToLower().Contains("enable-file-log"))
                {
                    LoggerProvider.Instance.LoggingEnabled     = true;
                    LoggerProvider.Instance.FileLoggingEnabled = true;
                    Guid   guid    = Guid.NewGuid();
                    string logFile = String.Format("DotNetBrowser-WinForms-{0}.log", guid);
                    LoggerProvider.Instance.OutputFile = System.IO.Path.GetFullPath(logFile);
                }
                if (arg != null && arg.ToLower().Contains("lightweight"))
                {
                    TabFactory.BrowserType = BrowserType.LIGHTWEIGHT;
                }
                if (arg != null && arg.ToLower().Contains("npapi"))
                {
                    switches.Add("--enable-npapi");
                }
                if (arg != null && arg.StartsWith("--remote-debugging-port="))
                {
                    switches.Add(arg);
                }
                if (arg != null && arg.ToLower().Contains("silent-download"))
                {
                    DefaultDownloadHandler.DownloadMode = DownloadMode.Silent;
                }
            }
            if (switches.Count > 0)
            {
                BrowserPreferences.SetChromiumSwitches(switches.ToArray());
            }
            tabbedPane = new TabbedPane();
            InsertTab(TabFactory.CreateFirstTab());
            InsertNewTabButton();
            this.Controls.Add(tabbedPane);


            Application.ApplicationExit += delegate
            {
                tabbedPane.DisposeAllTabs();
            };
        }