/* ================================== * INTERNAL METHODS * ==================================*/ /// <summary> /// Handles to user's request to test an URL /// Will validate said URL and update the view in consequence /// </summary> /// <param name="sender">Not important</param> /// <param name="e">Contains the URL to test</param> public void UrlSentEventHandler(object sender, UrlSentEventArgs e) { if (HttpUriHelper.TryCreateHttpUri(e.Url, out Uri uri)) { this.view.UpdateUrl(uri.AbsoluteUri); this.view.SetUrlFeedback("The URL has been sucessfully verified !"); } else { this.view.SetUrlFeedback("Please input a valid URL."); } }
/// <summary> /// Asks to load a page /// Will sanitize the provided URI before calling the next method /// </summary> /// <param name="sender">Arguments containing the target URL</param> /// <param name="e">Empty</param> private async void UrlQueriedEventHandlerAsync(object sender, UrlSentEventArgs e) { if (HttpUriHelper.TryCreateHttpUri(e.Url, out Uri uri)) { HttpQuery query = new HttpQuery(uri); this.AddToHistory(query); await Task.Factory.StartNew(() => this.LoadPageAsync(query)); } else { this.view.ErrorDialog("Invalid URL"); } }
/// <summary> /// Handles the <see cref="IInputHomeUrlPresenter"/> closure by home URL submission /// Updates the home URL /// Gives back the focus to <see cref="IMainPresenter"/> /// </summary> /// <param name="sender">Not important</param> /// <param name="e">Emtpy</param> private void HomeUrlSubmittedEventHandler(object sender, UrlSentEventArgs e) { this.User.HomePage = e.Uri; this.mainController.UpdateHomeUrl(); this.mainController.ShouldBeEnabled(true); }