예제 #1
0
        public FormBrowser(UpdaterSettings updaterSettings)
        {
            InitializeComponent();

            Text = Program.BrandName;

            this.plugins           = new PluginManager(Program.PluginPath, Program.PluginConfigFilePath);
            this.plugins.Reloaded += plugins_Reloaded;
            this.plugins.Executed += plugins_Executed;
            this.plugins.Reload();

            this.notification = new FormNotificationTweet(this, plugins);
            this.notification.Show();

            this.browser             = new TweetDeckBrowser(this, plugins, new TweetDeckBridge(this, notification));
            this.browser.PageLoaded += browser_PageLoaded;

            this.contextMenu = ContextMenuBrowser.CreateMenu(this);

            Controls.Add(new MenuStrip {
                Visible = false
            });                                             // fixes Alt freezing the program in Win 10 Anniversary Update

            Disposed += (sender, args) => {
                Config.MuteToggled         -= Config_MuteToggled;
                Config.TrayBehaviorChanged -= Config_TrayBehaviorChanged;

                browser.Dispose();
                contextMenu.Dispose();

                notificationScreenshotManager?.Dispose();
                soundNotification?.Dispose();
                videoPlayer?.Dispose();
                analytics?.Dispose();
            };

            Config.MuteToggled += Config_MuteToggled;

            this.trayIcon.ClickRestore += trayIcon_ClickRestore;
            this.trayIcon.ClickClose   += trayIcon_ClickClose;
            Config.TrayBehaviorChanged += Config_TrayBehaviorChanged;

            UpdateTrayIcon();

            this.updates = browser.CreateUpdateHandler(updaterSettings);
            this.updates.UpdateAccepted  += updates_UpdateAccepted;
            this.updates.UpdateDismissed += updates_UpdateDismissed;

            RestoreWindow();
        }
예제 #2
0
        public FormBrowser()
        {
            InitializeComponent();

            Text = Program.BrandName;

            this.plugins           = new PluginManager(Program.Config.Plugins, Program.PluginPath);
            this.plugins.Reloaded += plugins_Reloaded;
            this.plugins.Executed += plugins_Executed;
            this.plugins.Reload();

            this.notification = new FormNotificationTweet(this, plugins);
            this.notification.Show();

            this.updates = new UpdateHandler(Program.InstallerPath);
            this.updates.CheckFinished += updates_CheckFinished;

            this.updateBridge = new UpdateBridge(updates, this);
            this.updateBridge.UpdateAccepted  += updateBridge_UpdateAccepted;
            this.updateBridge.UpdateDelayed   += updateBridge_UpdateDelayed;
            this.updateBridge.UpdateDismissed += updateBridge_UpdateDismissed;

            this.browser     = new TweetDeckBrowser(this, plugins, new TweetDeckBridge.Browser(this, notification), updateBridge);
            this.contextMenu = ContextMenuBrowser.CreateMenu(this);

            Controls.Add(new MenuStrip {
                Visible = false
            });                                             // fixes Alt freezing the program in Win 10 Anniversary Update

            Disposed += (sender, args) => {
                Config.MuteToggled         -= Config_MuteToggled;
                Config.TrayBehaviorChanged -= Config_TrayBehaviorChanged;

                browser.Dispose();
                updates.Dispose();
                contextMenu.Dispose();

                notificationScreenshotManager?.Dispose();
                videoPlayer?.Dispose();
                analytics?.Dispose();
            };

            Config.MuteToggled += Config_MuteToggled;

            this.trayIcon.ClickRestore += trayIcon_ClickRestore;
            this.trayIcon.ClickClose   += trayIcon_ClickClose;
            Config.TrayBehaviorChanged += Config_TrayBehaviorChanged;

            UpdateTray();

            if (Config.MuteNotifications)
            {
                UpdateFormIcon();
            }

            if (Config.AllowDataCollection)
            {
                analytics = new AnalyticsManager(this, plugins, Program.AnalyticsFilePath);
            }

            RestoreWindow();
        }