예제 #1
0
        public FormBrowser(PluginSchemeFactory pluginScheme)
        {
            InitializeComponent();

            Text = Program.BrandName;

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

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

            this.updates = new UpdateHandler(new UpdateCheckClient(Program.InstallerPath), TaskScheduler.FromCurrentSynchronizationContext());
            this.updates.CheckFinished += updates_CheckFinished;

            this.updateBridge = new UpdateBridge(updates, this);
            this.updateBridge.UpdateAccepted  += updateBridge_UpdateAccepted;
            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();
            };

            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();
        }
예제 #2
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();
        }
예제 #3
0
        public FormBrowser(ResourceCache resourceCache, PluginManager pluginManager, IUpdateCheckClient updateCheckClient, uint windowRestoreMessage)
        {
            InitializeComponent();

            Text = Program.BrandName;

            this.resourceCache = resourceCache;

            this.plugins = pluginManager;

            this.tweetDeckInterface = new TweetDeckInterfaceImpl(this);

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

            this.updates = new UpdateChecker(updateCheckClient, TaskScheduler.FromCurrentSynchronizationContext());
            this.updates.InteractionManager.UpdateAccepted  += updateInteractionManager_UpdateAccepted;
            this.updates.InteractionManager.UpdateDismissed += updateInteractionManager_UpdateDismissed;

            this.browser     = new TweetDeckBrowser(this, plugins, tweetDeckInterface, updates);
            this.contextMenu = ContextMenuBrowser.CreateMenu(this);

            this.windowRestoreMessage = windowRestoreMessage;

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

            Config.MuteToggled         += Config_MuteToggled;
            Config.TrayBehaviorChanged += Config_TrayBehaviorChanged;

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

            this.trayIcon.ClickRestore += trayIcon_ClickRestore;
            this.trayIcon.ClickClose   += trayIcon_ClickClose;

            UpdateTray();

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

            RestoreWindow();
        }
예제 #4
0
        public FormBrowser(PluginManager pluginManager, UpdaterSettings updaterSettings)
        {
            InitializeComponent();

            Text = Program.BrandName;

            this.plugins                     = pluginManager;
            this.plugins.Reloaded           += plugins_Reloaded;
            this.plugins.PluginChangedState += plugins_PluginChangedState;

            this.contextMenu = ContextMenuBrowser.CreateMenu(this);

            this.notification = new FormNotificationTweet(this, plugins)
            {
                #if DEBUG
                CanMoveWindow = () => (ModifierKeys & Keys.Alt) == Keys.Alt
                #else
                CanMoveWindow = () => false
                #endif
            };

            this.notification.Show();

            this.browser = new ChromiumWebBrowser("https://tweetdeck.twitter.com/")
            {
                MenuHandler     = new ContextMenuBrowser(this),
                JsDialogHandler = new JavaScriptDialogHandler(),
                LifeSpanHandler = new LifeSpanHandler()
            };

            #if DEBUG
            this.browser.ConsoleMessage += BrowserUtils.HandleConsoleMessage;
            #endif

            this.browser.LoadingStateChanged += browser_LoadingStateChanged;
            this.browser.FrameLoadStart      += browser_FrameLoadStart;
            this.browser.FrameLoadEnd        += browser_FrameLoadEnd;
            this.browser.LoadError           += browser_LoadError;
            this.browser.RegisterAsyncJsObject("$TD", new TweetDeckBridge(this, notification));
            this.browser.RegisterAsyncJsObject("$TDP", plugins.Bridge);

            browser.BrowserSettings.BackgroundColor = (uint)BrowserUtils.BackgroundColor.ToArgb();
            browser.Dock     = DockStyle.None;
            browser.Location = ControlExtensions.InvisibleLocation;
            Controls.Add(browser);

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

            Disposed += (sender, args) => {
                browser.Dispose();
                contextMenu.Dispose();

                if (notificationScreenshotManager != null)
                {
                    notificationScreenshotManager.Dispose();
                }

                if (soundNotification != null)
                {
                    soundNotification.Dispose();
                }
            };

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

            UpdateTrayIcon();

            Config.MuteToggled += Config_MuteToggled;

            this.updates = new UpdateHandler(browser, this, updaterSettings);
            this.updates.UpdateAccepted  += updates_UpdateAccepted;
            this.updates.UpdateDismissed += updates_UpdateDismissed;

            RestoreWindow();
        }