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

            // Initialize collections.
            tabViews = new TabViewCollection();
            this.SetValue(MainWindow.ViewsPropertyKey, tabViews);
            this.SetValue(MainWindow.DownloadsPropertyKey, WebCore.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));

            // Perform lazy initialization of the WebCore.
            this.InitializeCore();
        }
Beispiel #2
0
        public MainWindow(string[] args)
        {
            InitializeComponent();

            // Load theme.
            ThemeManager.ChangeTheme(Application.Current, ThemeManager.DefaultAccents[Settings.Default.CurrentAccent], (Theme)Settings.Default.CurrentTheme);
            this.MetroDialogOptions.ColorScheme = MahApps.Metro.Controls.Dialogs.MetroDialogColorScheme.Accented;

            // Keep this for comparison.
            // If we change preferences, we need to restart
            // the application for the changes to be applied.
            initialPreferences = Settings.Default.WebPreferences;

            // Keep this. We will use it when we load.
            initialUrls = args;

            // Initialize collections.
            tabViews = new TabViewCollection();
            this.SetValue(MainWindow.ViewsPropertyKey, tabViews);
            this.SetValue(MainWindow.DownloadsPropertyKey, WebCore.Downloads);
            this.SetValue(MainWindow.AccentsPropertyKey,
                          ThemeManager.DefaultAccents.Select(
                              a => new AccentColorMenuData()
            {
                Name       = a.Name,
                ColorBrush = a.Resources["AccentColorBrush"] as Brush
            }).ToList());

            // 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(MainWindow.CloseSettings, OnCloseSettings));
            this.CommandBindings.Add(new CommandBinding(MainWindow.UpdateHomeURL, OnUpdateHomeURL));
            this.CommandBindings.Add(new CommandBinding(MainWindow.Search, OnSearch));
            this.CommandBindings.Add(new CommandBinding(MainWindow.RestartApplication, OnRestartApplication));
            this.CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, OnClose));

            // Perform lazy initialization of the WebCore.
            this.InitializeCore();
        }