private void webBrowser_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e) { if (e.Uri.ToString().StartsWith(_redirectPage)) { OnRedirected?.Invoke(e.Uri); Close(); } }
/// <summary> /// Redirects to the given server. /// </summary> /// <param name="server">Server data</param> public void Redirect(Server server) { if (OnRedirected != null) { OnRedirected.Invoke(server); } if (this.apiConnected) { Disconnect(true); } Connect(server); }
/// <summary>Events</summary> public void Event() { RaiseEvent raiseEvent; while (Events.TryDequeue(out raiseEvent)) { // Raise start event if (raiseEvent.EventType == EventType.Started) { OnStarted?.Invoke(); } // Raise stop event if (raiseEvent.EventType == EventType.Stopped) { OnStopped?.Invoke(); } // Raise link event if (raiseEvent.EventType == EventType.Linked) { OnLinked?.Invoke(raiseEvent.Link); } // Raise redirection event if (raiseEvent.EventType == EventType.Redirect) { OnRedirect?.Invoke(raiseEvent.Link); } // Raise post redirection event if (raiseEvent.EventType == EventType.Redirected) { OnRedirected?.Invoke(raiseEvent.Link); } // Raise approval event if (raiseEvent.EventType == EventType.Approval) { OnApproval?.Invoke(raiseEvent.Link, raiseEvent.Content); } // Raise content event if (raiseEvent.EventType == EventType.Content) { OnContent?.Invoke(raiseEvent.Link, raiseEvent.Content); } // Raise unlink event if (raiseEvent.EventType == EventType.Unlinked) { OnUnlinked?.Invoke(raiseEvent.Link, raiseEvent.Reason); } // Raise failure event if (raiseEvent.EventType == EventType.Failed) { OnFailed?.Invoke(raiseEvent.Link, raiseEvent.Failure); } } }