Beispiel #1
0
        private void InitializeSmartEvent()
        {
            // focus dummy
            _focusIn  = new SmartEvent(this, "focused");
            _focusOut = new SmartEvent(this, "unfocused");

            _focusIn.On  += (s, e) => { ((WebView)s).SetFocus(true); };
            _focusOut.On += (s, e) => { ((WebView)s).SetFocus(false); };

            _loadStarted             = new SmartEvent(this, _realHandle, "load,started");
            _loadFinished            = new SmartEvent(this, _realHandle, "load,finished");
            _loadError               = new SmartEvent <SmartCallbackLoadErrorArgs>(this, _realHandle, "load,error", SmartCallbackLoadErrorArgs.CreateFromSmartEvent);
            _titleChanged            = new SmartEvent <SmartCallbackArgs>(this, _realHandle, "title,changed", SmartCallbackArgs.CreateFromSmartEvent);
            _urlChanged              = new SmartEvent <SmartCallbackArgs>(this, _realHandle, "url,changed", SmartCallbackArgs.CreateFromSmartEvent);
            _contextMenuCustomize    = new SmartEvent <ContextMenuCustomizeEventArgs>(this, _realHandle, "contextmenu,customize", ContextMenuCustomizeEventArgs.CreateFromSmartEvent);
            _contextMenuItemSelected = new SmartEvent <ContextMenuItemEventArgs>(this, _realHandle, "contextmenu,selected", ContextMenuItemEventArgs.CreateFromSmartEvent);
            _policyNavigationDecide  = new SmartEvent <NavigationPolicyEventArgs>(this, _realHandle, "policy,navigation,decide", NavigationPolicyEventArgs.CreateFromSmartEvent);
            _policyNewWindowDecide   = new SmartEvent <NewWindowPolicyEventArgs>(this, _realHandle, "policy,newwindow,decide", NewWindowPolicyEventArgs.CreateFromSmartEvent);
            _policyResponseDecide    = new SmartEvent <ResponsePolicyEventArgs>(this, _realHandle, "policy,response,decide", ResponsePolicyEventArgs.CreateFromSmartEvent);

            _loadStarted.On             += (s, e) => { LoadStarted?.Invoke(this, EventArgs.Empty); };
            _loadFinished.On            += (s, e) => { LoadFinished?.Invoke(this, EventArgs.Empty); };
            _loadError.On               += (s, e) => { LoadError?.Invoke(this, e); };
            _titleChanged.On            += (s, e) => { TitleChanged?.Invoke(this, e); };
            _urlChanged.On              += (s, e) => { UrlChanged?.Invoke(this, e); };
            _policyNavigationDecide.On  += (s, e) => { NavigationPolicyDecideRequested?.Invoke(this, e); };
            _policyNewWindowDecide.On   += (s, e) => { NewWindowPolicyDecideRequested?.Invoke(this, e); };
            _policyResponseDecide.On    += (s, e) => { ResponsePolicyDecideRequested?.Invoke(this, e); };
            _contextMenuItemSelected.On += (s, e) => { ContextMenuItemSelected?.Invoke(this, e); };
            _contextMenuCustomize.On    += (s, e) => { _contextMenuCustomizeDelegate?.Invoke(e.Menu); };
        }
        //Обработчик события конца загрузки документа
        private void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e)
        {
            var url = e.Url;

            if (url != "data:text/html,chromewebdata")
            {
                lock (locker) {
                    pageLoadFinished = true;
                }
            }
            try {
                Application.Current.Dispatcher.Invoke(() => {
                    if (ReloadingMessageVisible)
                    {
                        ReloadingMessageVisible = false;
                    }
                    if (url.ToLower().Contains("login"))
                    {
                        LoadErrorVisible = false;
                    }
                    if (pageLoadFinished)
                    {
                        PokeWatchdog();
                    }
                });
            } catch { }
            RaisePropertyChanged(nameof(CurrentUrl));
            RaisePropertyChanged("SelectedTab.CurrentUrl");
            UrlChanged?.Invoke(this, new StringMessageEventArgs {
                Message = Url
            });
        }
 public void Remove(IEnumerable <UriItem> urls)
 {
     foreach (var item in urls)
     {
         Items.Remove(item);
     }
     UrlChanged?.Invoke(null, true);
 }
 public void Remove(string url)
 {
     for (int i = Items.Count - 1; i >= 0; i--)
     {
         if (Items[i].Source == url)
         {
             Items.RemoveAt(i);
         }
     }
     UrlChanged?.Invoke(null, true);
 }
 public void Remove(UriStatus status)
 {
     for (int i = Items.Count - 1; i >= 0; i--)
     {
         if (Items[i].Status == status)
         {
             Items.RemoveAt(i);
         }
     }
     UrlChanged?.Invoke(null, true);
 }
        public void Add(string url, UriType uriType, UriStatus status)
        {
            if (Contains(url))
            {
                return;
            }
            var item = new UriItem()
            {
                Source = url, Type = uriType, Status = status
            };

            Items.Add(item);
            UrlChanged?.Invoke(item, true);
        }
 void UpdateUrl()
 {
     updating = true;
     repositoryUrlEntry.Text = repo.Url;
     if (repo.Uri != null && repo.Name == repositoryServerEntry.Text)
     {
         if (repo.Uri.IsAbsoluteUri)
         {
             repo.Name = repo.Uri.Host;
         }
     }
     updating = false;
     UrlChanged?.Invoke(this, EventArgs.Empty);
 }
Beispiel #8
0
 private void ChromiumBrowserHost_Initialized(object sender, EventArgs e)
 {
     if (_loaded)
     {
         return;
     }
     if (_disposed)
     {
         return;
     }
     _loaded = true;
     Url     = "about:blank";
     UrlChanged?.Invoke(this, "about:blank");
 }
 private void SwitchMirror()
 {
     if (Mirrors.Count == 0)
     {
         return;
     }
     activeMirror++;
     if (activeMirror > Mirrors.Count - 1)
     {
         activeMirror = 0;
     }
     Url = Mirrors[activeMirror];
     PlayWarningSound();
     UrlChanged?.Invoke(this, new StringMessageEventArgs {
         Message = Url
     });
 }
        bool ParseSSHUrl(string url)
        {
            if (!url.Contains(':'))
            {
                return(false);
            }

            var tokens = url.Split(new [] { ':' }, 2);

            if (tokens.Length < 2)
            {
                return(false);
            }

            if (!Uri.IsWellFormedUriString(tokens [0], UriKind.RelativeOrAbsolute) ||
                !Uri.IsWellFormedUriString(tokens [1], UriKind.RelativeOrAbsolute))
            {
                return(false);
            }

            var userAndHost = tokens [0].Split(new [] { '@' }, 2);

            if (userAndHost.Length < 2)
            {
                return(false);
            }

            repositoryUserEntry.Text   = userAndHost [0];
            repositoryServerEntry.Text = userAndHost [1];
            repositoryPortSpin.Value   = 22;
            string path = tokens [1];

            if (!path.StartsWith("/", StringComparison.Ordinal))
            {
                path = "/" + path;
            }
            repositoryPathEntry.Text = path;
            comboProtocol.Active     = protocols.IndexOf("ssh");
            comboProtocol.Sensitive  = false;
            PathChanged?.Invoke(this, EventArgs.Empty);
            UrlChanged?.Invoke(this, EventArgs.Empty);
            return(true);
        }
Beispiel #11
0
        private void InitializeSmartEvent()
        {
            // focus dummy
            _focusIn  = new SmartEvent(this, "focused");
            _focusOut = new SmartEvent(this, "unfocused");

            _focusIn.On  += (s, e) => { ((WebView)s).SetFocus(true); };
            _focusOut.On += (s, e) => { ((WebView)s).SetFocus(false); };

            _loadStarted  = new SmartEvent(this, _realHandle, "load,started");
            _loadFinished = new SmartEvent(this, _realHandle, "load,finished");
            _loadError    = new SmartEvent <SmartCallbackLoadErrorArgs>(this, _realHandle, "load,error", SmartCallbackLoadErrorArgs.CreateFromSmartEvent);
            _titleChanged = new SmartEvent <SmartCallbackArgs>(this, _realHandle, "title,changed", SmartCallbackArgs.CreateFromSmartEvent);
            _urlChanged   = new SmartEvent <SmartCallbackArgs>(this, _realHandle, "url,changed", SmartCallbackArgs.CreateFromSmartEvent);

            _loadStarted.On  += (s, e) => { LoadStarted?.Invoke(this, EventArgs.Empty); };
            _loadFinished.On += (s, e) => { LoadFinished?.Invoke(this, EventArgs.Empty); };
            _loadError.On    += (s, e) => { LoadError?.Invoke(this, e); };
            _titleChanged.On += (s, e) => { TitleChanged?.Invoke(this, e); };
            _urlChanged.On   += (s, e) => { UrlChanged?.Invoke(this, e); };
        }
 public void UpdateItem(UriItem item)
 {
     UrlChanged?.Invoke(item, false);
 }
 public void Clear()
 {
     Items.Clear();
     UrlChanged?.Invoke(null, true);
 }
 private void txtURL_TextChanged(object sender, EventArgs e)
 {
     UrlChanged?.Invoke(this, EventArgs.Empty);
 }
Beispiel #15
0
 private void OnUrlChanged()
 => UrlChanged?.Invoke(this, EventArgs.Empty);