Beispiel #1
0
        public void SetWindowActivate(string json)
        {
            BrowserMessage message = JsonConvert.DeserializeObject <BrowserMessage>(json);

            this.Topmost = message.topmost;
            this.Activate();
        }
Beispiel #2
0
        public void SetWindowSize(string json)
        {
            BrowserMessage message = JsonConvert.DeserializeObject <BrowserMessage>(json);

            browser.Width  = message.width;
            browser.Height = message.height;
        }
Beispiel #3
0
        public void CreateWindow(string json)
        {
            BrowserMessage message = JsonConvert.DeserializeObject <BrowserMessage>(json);

            BlankWindow window = new BlankWindow(this);

            window.Show();
        }
Beispiel #4
0
        public void CreateWindow(string json)
        {
            BrowserMessage message = JsonConvert.DeserializeObject <BrowserMessage>(json);

            if (message.url != null)
            {
                BlankWindow win = new BlankWindow(this, json);
                win.SendMessage += new RoutedEventHandler(win_SendMessage);
                win.Show();
            }
        }
Beispiel #5
0
        public void PlaySound(string json)
        {
            BrowserMessage message = JsonConvert.DeserializeObject <BrowserMessage>(json);
            string         path    = message.path;

            if (message.local)
            {
                path = Path.Combine(ExecutionEnvironment.DirectoryOfExecutingAssembly, path);
                path = Path.GetFullPath(path);
            }
            System.Media.SoundPlayer player = new System.Media.SoundPlayer(path);
            player.Play();
        }
Beispiel #6
0
        public void AjaxGet(string json)
        {
            BrowserMessage message = JsonConvert.DeserializeObject <BrowserMessage>(json);
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(message.url);

            request.Method = "GET";

            HttpWebResponse response      = (HttpWebResponse)request.GetResponse();
            Stream          receiveStream = response.GetResponseStream();

            StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);
            string       data       = readStream.ReadToEnd().Replace("'", "\\'");

            JSCall("Eotu.Success('" + data + "');");
        }
Beispiel #7
0
        public void Navigate(string json)
        {
            BrowserMessage message = JsonConvert.DeserializeObject <BrowserMessage>(json);

            string url = message.url;

            if (message.local)
            {
                url = Path.Combine(ExecutionEnvironment.DirectoryOfExecutingAssembly, url);
                url = Path.GetFullPath(url);
            }
            var uri = new Uri(url);

            browser.Navigate(uri.AbsoluteUri);
            browser.WebBrowserFocus.Activate();
        }
Beispiel #8
0
        public void SetResizeMode(string json)
        {
            BrowserMessage message = JsonConvert.DeserializeObject <BrowserMessage>(json);

            switch (message.mode)
            {
            case "CanMinimize":
                this.ResizeMode = ResizeMode.CanMinimize;
                break;

            case "CanResize":
                this.ResizeMode = ResizeMode.CanResize;
                break;

            case "CanResizeWithGrip":
                this.ResizeMode = ResizeMode.CanResizeWithGrip;
                break;
            }
        }
Beispiel #9
0
        private async Task ProcessMessage(BrowserMessage msg)
        {
            try
            {
                using (await _pluginSvcLock.LockAsync())
                {
                    if (PluginSvc == null)
                    {
                        await _host.Write(new RespError(MessageType.ImportTabs, "Plugin not connected"));

                        return;
                    }

                    switch (msg.Type)
                    {
                    case MessageType.ImportTabs:
                        PluginSvc.ImportUrls(msg.GetData <ReqImportUrls>());
                        break;

                    case MessageType.ImportHtml:
                        break;

                    case MessageType.GetTabs:
                        SetBrowserResp(msg);
                        break;

                    default:
                        LogTo.Error($"Received unknown MessageType {msg.Type}");
                        break;
                    }
                }
            }
            catch (ArgumentNullException ex)
            {
                LogTo.Error(ex, "Argument Null Exception caught in ProcessMessage");
            }
            catch (RemotingException) { }
        }
Beispiel #10
0
        public void SetWindowStyle(string json)
        {
            BrowserMessage message = JsonConvert.DeserializeObject <BrowserMessage>(json);

            switch (message.style)
            {
            case "None":
                this.WindowStyle = WindowStyle.None;
                break;

            case "SingleBorderWindow":
                this.WindowStyle = WindowStyle.SingleBorderWindow;
                break;

            case "ThreeDBorderWindow":
                this.WindowStyle = WindowStyle.ThreeDBorderWindow;
                break;

            case "ToolWindow":
                this.WindowStyle = WindowStyle.ToolWindow;
                break;
            }
        }
Beispiel #11
0
        public void Navigate(string json)
        {
            BrowserMessage message = JsonConvert.DeserializeObject <BrowserMessage>(json);

            browser.Navigate(message.url);
        }
Beispiel #12
0
        public void SetWindowTitle(string json)
        {
            BrowserMessage message = JsonConvert.DeserializeObject <BrowserMessage>(json);

            this.Title = message.title;
        }
Beispiel #13
0
        public void ShowMessage(string json)
        {
            BrowserMessage message = JsonConvert.DeserializeObject <BrowserMessage>(json);

            MessageBox.Show(message.message, message.title);
        }
Beispiel #14
0
 private void SetBrowserResp(BrowserMessage msg)
 {
     _result = msg;
     _browserRespLock.Set();
 }