/// <summary> /// Dialog opened from: /// - Open Url button in menu /// - Open Url button on center of screen /// </summary> public void OpenUrl() { Execute.OnUIThread(() => IsFileSelected = false); string uri = OpenUrlViewModel.GetURI(); if (uri == null) { LoggerManager.Info("User cancelled OpenURI window."); return; } OpenURI(uri); }
/// <summary> /// Executes OpenUrlViewModel window and returns an URL that the user passed, or null if the user cancelled. /// Doesn't check validity /// </summary> public static string GetURI(string defaultUrl = "") { OpenUrlViewModel ouvm = new OpenUrlViewModel(defaultUrl); WindowManager windowManager = new WindowManager(); bool? success = windowManager.ShowDialog(ouvm); // return null if user cancelled if (!success.GetValueOrDefault(false)) { return(null); } // return a string is open was pressed - even the url is in valid or is empty return(ouvm._url ?? ""); }