コード例 #1
0
        public MainWindow(string[] args)
        {
            // Keep this. We will use it when we load.
            initialUrls = args;

            // Initialize collections.
            tabViews = new ObservableCollection <TabView>();
            this.SetValue(MainWindow.ViewsPropertyKey, tabViews);
            downloads = new ObservableCollection <Download>();
            this.SetValue(MainWindow.DownloadsPropertyKey, downloads);

            // Assign event handlers.
            this.Loaded += OnLoaded;

            // Assign command handlers.
            this.CommandBindings.Add(new CommandBinding(MainWindow.OpenInTab, OnOpenTab, CanOpen));
            this.CommandBindings.Add(new CommandBinding(MainWindow.OpenInWindow, OnOpenWindow, CanOpen));
            this.CommandBindings.Add(new CommandBinding(MainWindow.OpenSource, OnOpenSource, CanOpenSource));
            this.CommandBindings.Add(new CommandBinding(MainWindow.CloseTab, OnCloseTab));
            this.CommandBindings.Add(new CommandBinding(MainWindow.NewTab, OnNewTab));
            this.CommandBindings.Add(new CommandBinding(MainWindow.ShowDownloads, OnShowDownloads));
            this.CommandBindings.Add(new CommandBinding(MainWindow.ShowSettings, OnShowSettings));
            this.CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, OnClose));

            // Initialize (but DO NOT Start) the WebCore.
            MainWindow.InitializeCore();
        }