Esempio n. 1
0
        public override bool OnContextMenuCommand(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, CefMenuCommand commandId, CefEventFlags eventFlags)
        {
            if (base.OnContextMenuCommand(browserControl, browser, frame, parameters, commandId, eventFlags))
            {
                return(true);
            }

            switch ((int)commandId)
            {
            case (int)CefMenuCommand.Reload:
                frame.ExecuteJavaScriptAsync("window.location.href = 'https://tweetdeck.twitter.com'");
                return(true);

            case MenuSettings:
                form.InvokeSafe(form.OpenSettings);
                return(true);

            case MenuAbout:
                form.InvokeSafe(form.OpenAbout);
                return(true);

            case MenuPlugins:
                form.InvokeSafe(form.OpenPlugins);
                return(true);

            case MenuMute:
                form.InvokeSafe(() => {
                    Program.UserConfig.MuteNotifications = !Program.UserConfig.MuteNotifications;
                    Program.UserConfig.Save();
                });

                return(true);

            case MenuOpenTweetUrl:
                BrowserUtils.OpenExternalBrowser(lastHighlightedTweet);
                return(true);

            case MenuCopyTweetUrl:
                SetClipboardText(lastHighlightedTweet);
                return(true);

            case MenuScreenshotTweet:
                form.InvokeSafe(form.TriggerTweetScreenshot);
                return(true);

            case MenuOpenQuotedTweetUrl:
                BrowserUtils.OpenExternalBrowser(lastHighlightedQuotedTweet);
                return(true);

            case MenuCopyQuotedTweetUrl:
                SetClipboardText(lastHighlightedQuotedTweet);
                return(true);
            }

            return(false);
        }
Esempio n. 2
0
        public bool OnFileDialog(IWebBrowser browserControl, IBrowser browser, CefFileDialogMode mode, string title, string defaultFilePath, List <string> acceptFilters, int selectedAcceptFilter, IFileDialogCallback callback)
        {
            if (!string.IsNullOrEmpty(TweetDeckBridge.ClipboardImagePath))
            {
                callback.Continue(selectedAcceptFilter, new List <string> {
                    TweetDeckBridge.ClipboardImagePath
                });

                form.InvokeSafe(() => {
                    TweetDeckBridge.ClipboardImagePath = string.Empty;
                });

                return(true);
            }

            return(false);
        }
Esempio n. 3
0
 public void SetSessionData(string key, string value)
 {
     form.InvokeSafe(() => { // do not use InvokeAsyncSafe, return only after invocation
         SessionData.Add(key, value);
     });
 }
Esempio n. 4
0
 public void LoadFontSizeClass(string fsClass)
 {
     form.InvokeSafe(() => {
         TweetNotification.SetFontSizeClass(fsClass);
     });
 }