private async void Send_Clicked() { //await PostDatabase.Instance.UpdateItemData(PostContent); await NavigationMethod.GoBackAsync(); EventAggregator.GetEvent <SendMessageEvent>().Publish(PostContent); }
/// <summary> /// Sets the currently focused element in the specified scope. /// </summary> /// <param name="scope">The focus scope.</param> /// <param name="element">The element to focus. May be null.</param> /// <param name="method">The method by which focus was changed.</param> /// <param name="keyModifiers">Any key modifiers active at the time of focus.</param> /// <remarks> /// If the specified scope is the current <see cref="Scope"/> then the keyboard focus /// will change. /// </remarks> public void SetFocusedElement( IFocusScope scope, IInputElement?element, NavigationMethod method = NavigationMethod.Unspecified, KeyModifiers keyModifiers = KeyModifiers.None) { scope = scope ?? throw new ArgumentNullException(nameof(scope)); if (_focusScopes.TryGetValue(scope, out var existingElement)) { if (element != existingElement) { _focusScopes.Remove(scope); _focusScopes.Add(scope, element); } } else { _focusScopes.Add(scope, element); } if (Scope == scope) { KeyboardDevice.Instance?.SetFocusedElement(element, method, keyModifiers); } }
/// <summary> /// Focuses a control. /// </summary> /// <param name="control">The control to focus.</param> /// <param name="method">The method by which focus was changed.</param> /// <param name="modifiers">Any input modifiers active at the time of focus.</param> public void Focus( IInputElement control, NavigationMethod method = NavigationMethod.Unspecified, InputModifiers modifiers = InputModifiers.None) { if (control != null) { var scope = GetFocusScopeAncestors(control) .FirstOrDefault(); if (scope != null) { Scope = scope; SetFocusedElement(scope, control, method, modifiers); } } else if (Current != null) { // If control is null, set focus to the topmost focus scope. foreach (var scope in GetFocusScopeAncestors(Current).Reverse().ToList()) { IInputElement element; if (_focusScopes.TryGetValue(scope, out element)) { Focus(element, method); break; } } } }
public void SetFocusedElement( IInputElement element, NavigationMethod method, InputModifiers modifiers) { if (element != FocusedElement) { var interactive = FocusedElement as IInteractive; interactive?.RaiseEvent(new RoutedEventArgs { RoutedEvent = InputElement.LostFocusEvent, }); FocusedElement = element; interactive = element as IInteractive; interactive?.RaiseEvent(new GotFocusEventArgs { RoutedEvent = InputElement.GotFocusEvent, NavigationMethod = method, InputModifiers = modifiers, }); } }
public static bool HasAccessToDestinationPage(SubSystem subsystem, NavigationMethod mode) { var access = UserData.CurrentAccessRight; bool canRead = false, canEdit = false, canDelete = false, canConfirm = false, canLog = false; switch (subsystem) { case SubSystem.Contract: canRead = true; //(bool)UserData.CurrentUser.ManagingPaymentDraft || (bool)access.ContractPermanentWrite || (bool)access.ContractRead || (bool)UserData.CurrentUser.PaymentDraftCommittee ; canEdit = true; //(bool)access.ContractWrite || (bool)UserData.CurrentUser.ManagingPaymentDraft; canDelete = true; //(bool)access.ContractDelete; canConfirm = true; //(bool)access.ContractPermanentWrite; canLog = (bool)access.ContractLog; break; case SubSystem.Regulation: canRead = (bool)access.RegulationRead; canEdit = (bool)access.RegulationWrite; canDelete = (bool)access.RegulationDelete; canConfirm = (bool)access.RegulationPermanentWrite; canLog = (bool)access.RegulationLog; break; case SubSystem.Tendering: canRead = (bool)access.TenderingRead; canEdit = (bool)access.TenderingWrite; canDelete = (bool)access.TenderingDelete; canConfirm = (bool)access.TenderingPermanentWrite; canLog = (bool)access.TenderingLog; break; case SubSystem.TenderingArchive: canRead = (bool)access.TenderingArchiveRead; canEdit = (bool)access.TenderingArchiveWrite; canDelete = (bool)access.TenderingArchiveDelete; canLog = (bool)access.TenderingArchiveLog; break; } if (subsystem == SubSystem.UserManagement) { if (UserData.CurrentAccessRight.CreatingUser == true) { return(true); } else { return(false); } } if (mode == NavigationMethod.NewMode || mode == NavigationMethod.EditMode) { return(canEdit); } if (mode == NavigationMethod.ViewMode) { return(canRead); } return(true); }
private async void Button_Clicked() { bool loggedIn = false; Settings.RememberMe = _rememberMe; if (_rememberMe) { Settings.Username = _username; if (Settings.Password == Settings.DefaultPassword) { Settings.Password = _password; } } else { Settings.Username = _username; if (Settings.Password == _password) { Settings.Password = Settings.DefaultPassword; loggedIn = true; } Settings.Username = string.Empty; } if (loggedIn || (Settings.Password == _password)) { await NavigationMethod.NavigateAsync(nameof(Home)); } else { await DialogService.DisplayAlertAsync("Alert", "Invalid Password", "OK"); } }
/// <summary> /// Sets the currently focused element in the specified scope. /// </summary> /// <param name="scope">The focus scope.</param> /// <param name="element">The element to focus. May be null.</param> /// <param name="method">The method by which focus was changed.</param> /// <param name="keyModifiers">Any key modifiers active at the time of focus.</param> /// <remarks> /// If the specified scope is the current <see cref="Scope"/> then the keyboard focus /// will change. /// </remarks> public void SetFocusedElement( IFocusScope scope, IInputElement element, NavigationMethod method = NavigationMethod.Unspecified, KeyModifiers keyModifiers = KeyModifiers.None) { Contract.Requires <ArgumentNullException>(scope != null); if (_focusScopes.TryGetValue(scope, out IInputElement existingElement)) { if (element != existingElement) { _focusScopes.Remove(scope); _focusScopes.Add(scope, element); } } else { _focusScopes.Add(scope, element); } if (Scope == scope) { KeyboardDevice.Instance?.SetFocusedElement(element, method, keyModifiers); } }
/// <summary> /// Focuses a control. /// </summary> /// <param name="control">The control to focus.</param> /// <param name="method">The method by which focus was changed.</param> /// <param name="keyModifiers">Any key modifiers active at the time of focus.</param> public void Focus( IInputElement control, NavigationMethod method = NavigationMethod.Unspecified, KeyModifiers keyModifiers = KeyModifiers.None) { if (control != null) { var scope = GetFocusScopeAncestors(control) .FirstOrDefault(); if (scope != null) { Scope = scope; SetFocusedElement(scope, control, method, keyModifiers); } } else if (Current != null) { // If control is null, set focus to the topmost focus scope. foreach (var scope in GetFocusScopeAncestors(Current).Reverse().ToList()) { IInputElement element; if (_focusScopes.TryGetValue(scope, out element) && element != null) { Focus(element, method); return; } } // Couldn't find a focus scope, clear focus. SetFocusedElement(Scope, null); } }
public void SetFocusedElement(IInputElement element, NavigationMethod method) { if (element != FocusedElement) { var interactive = FocusedElement as IInteractive; if (interactive != null) { interactive.RaiseEvent(new RoutedEventArgs { RoutedEvent = InputElement.LostFocusEvent, }); } FocusedElement = element; interactive = element as IInteractive; if (interactive != null) { interactive.RaiseEvent(new GotFocusEventArgs { RoutedEvent = InputElement.GotFocusEvent, NavigationMethod = method, }); } } }
public void SetFocusedElement( IInputElement element, NavigationMethod method, InputModifiers modifiers) { if (element != FocusedElement) { var interactive = FocusedElement as IInteractive; if (interactive != null) { interactive.RaiseEvent(new RoutedEventArgs { RoutedEvent = InputElement.LostFocusEvent, }); } FocusedElement = element; interactive = element as IInteractive; if (interactive != null) { interactive.RaiseEvent(new GotFocusEventArgs { RoutedEvent = InputElement.GotFocusEvent, NavigationMethod = method, InputModifiers = modifiers, }); } } }
public void SetFocusedElement( IInputElement element, NavigationMethod method, KeyModifiers keyModifiers) { if (element != FocusedElement) { var interactive = FocusedElement as IInteractive; FocusedElement = element; interactive?.RaiseEvent(new RoutedEventArgs { RoutedEvent = InputElement.LostFocusEvent, }); interactive = element as IInteractive; interactive?.RaiseEvent(new GotFocusEventArgs { RoutedEvent = InputElement.GotFocusEvent, NavigationMethod = method, KeyModifiers = keyModifiers, }); } }
private async void Button_Clicked() { await NavigationMethod.NavigateAsync(nameof(ChooseGamePage)); Players[_turn].Turn = true; EventAggregator.GetEvent <MessageSentEvent>().Publish(Players); }
private async void ChangeColor_Clicked() { await NavigationMethod.GoBackAsync(); if (BackgroundColor != null) { EventAggregator.GetEvent <SendMessageEvent>().Publish(BackgroundColor); } }
public void PushAndGo(NavigationMethod method, string page) { if (page == null) { throw new ArgumentNullException("page"); } if (path.Count == 0 || !Request.Url.Equals(path.Peek())) { path.Push(Request.Url); } Navigate(method, page); }
/// <summary> /// Sets the currently focused element in the specified scope. /// </summary> /// <param name="scope">The focus scope.</param> /// <param name="element">The element to focus. May be null.</param> /// <param name="method">The method by which focus was changed.</param> /// <remarks> /// If the specified scope is the current <see cref="Scope"/> then the keyboard focus /// will change. /// </remarks> public void SetFocusedElement( IFocusScope scope, IInputElement element, NavigationMethod method = NavigationMethod.Unspecified) { Contract.Requires <ArgumentNullException>(scope != null); _focusScopes[scope] = element; if (Scope == scope) { KeyboardDevice.Instance.SetFocusedElement(element, method); } }
private void PerformPop(NavigationMethod method, int count, string message) { try { if (count <= 0) { throw new ArgumentException("Must be greater than zero", "count"); } string url = null; while (count-- >= 0 && path.Count > 0) { url = Convert.ToString(path.Pop()); } if (String.IsNullOrEmpty(url)) { if (!String.IsNullOrEmpty(nextPopFallback)) { Navigate(method, nextPopFallback, message); } else { GoHome(method, message); } } else { Navigate(method, url, message); } } catch (Exception ex) { if (ex is ThreadAbortException) { throw; } else { throw new NavigationException(); } } finally { nextPopFallback = null; } }
public void Navigate(NavigationMethod method, string page, string message) { switch (method) { case NavigationMethod.Redirect: Response.Redirect(page); break; case NavigationMethod.RedirectJS: WebUtil.JavascriptRedirect(page, message); break; case NavigationMethod.Transfer: Server.Transfer(page); break; } }
private async void Next_Page(object obj) { string[] preferences = new string[4]; if (LikeXamarin == true) { preferences[0] = FavColor; preferences[0] = FavBand; preferences[0] = "true"; } else { preferences[0] = FavColor; preferences[0] = FavBand; preferences[0] = "false"; } await NavigationMethod.NavigateAsync(nameof(MainPage)); EventAggregator.GetEvent <SendMessageEvent>().Publish(preferences); }
public void SetFocusedElement( IInputElement?element, NavigationMethod method, KeyModifiers keyModifiers) { if (element != FocusedElement) { var interactive = FocusedElement as IInteractive; if (FocusedElement != null && (!FocusedElement.IsAttachedToVisualTree || _focusedRoot != element?.VisualRoot as IInputRoot) && _focusedRoot != null) { ClearChildrenFocusWithin(_focusedRoot, true); } SetIsFocusWithin(FocusedElement, element); _focusedElement = element; _focusedRoot = _focusedElement?.VisualRoot as IInputRoot; interactive?.RaiseEvent(new RoutedEventArgs { RoutedEvent = InputElement.LostFocusEvent, }); interactive = element as IInteractive; interactive?.RaiseEvent(new GotFocusEventArgs { RoutedEvent = InputElement.GotFocusEvent, NavigationMethod = method, KeyModifiers = keyModifiers, }); _textInputManager.SetFocusedElement(element); RaisePropertyChanged(nameof(FocusedElement)); } }
public void SetFocusedElement(IInputElement element, NavigationMethod method, InputModifiers modifiers) { throw new System.NotImplementedException(); }
public void PushAndGo(NavigationMethod method, string page) { if (page == null) throw new ArgumentNullException("page"); if (path.Count == 0 || !Request.Url.Equals(path.Peek())) path.Push(Request.Url); Navigate(method, page); }
private void PerformPop(NavigationMethod method, int count, string message) { try { if (count <= 0) throw new ArgumentException("Must be greater than zero", "count"); string url = null; while (count-- >= 0 && path.Count > 0) url = Convert.ToString(path.Pop()); if (String.IsNullOrEmpty(url)) { if (!String.IsNullOrEmpty(nextPopFallback)) Navigate(method, nextPopFallback, message); else GoHome(method, message); } else Navigate(method, url, message); } catch (Exception ex) { if (ex is ThreadAbortException) throw; else throw new NavigationException(); } finally { nextPopFallback = null; } }
public void GoHome(NavigationMethod method, string message) { Navigate(method, home ?? cfg.DefaultHome, message); }
/// <summary> /// Sets focus on either the previous tab stop or the next tab stop of the sink. /// </summary> /// <param name="navigationMethod"> /// Specifies whether the focus should be set no the previous or the next /// tab stop relative to this one. /// </param> protected virtual void TabOutCore(NavigationMethod navigationMethod) { }
public void Navigate(NavigationMethod method, string page) { Navigate(method, page, null); }
/// <summary> /// Sets focus on either the first tab stop or the last tab stop of the sink. /// </summary> /// <param name="navigationMethod"> /// Specifies whether focus should be set to the first or the last tab stop. /// </param> /// <returns> /// <b>True</b> if the focus has been set as requested. /// <b>False</b>, if there are no tab stops. /// </returns> /// <remarks> /// You can get <see cref="FocusNavigationDirection.Previous"/> for /// the last native control (means Shift+Tab was pressed), or /// <see cref="FocusNavigationDirection.Next"/> for the first /// native control (means Tab was pressed). /// </remarks> protected virtual bool TabIntoCore(NavigationMethod navigationMethod) { return(false); }
public void GoHome(NavigationMethod method) { GoHome(method, null); }
public void GoLogin(NavigationMethod method, string message) { Navigate(method, cfg.Login, message); }
public void Pop(NavigationMethod method) { Pop(method, 1); }
public static void NavigateToPageWithMode(Page currentPage, Page destination, NavigationMethod mode, SubSystem subSystem, bool keepCurrentAlive = false) { currentPage.KeepAlive = keepCurrentAlive; if (!HasAccessToDestinationPage(subSystem, mode)) { ErrorHandler.ShowErrorMessage("در حال حاضر دسترسی به این صفحه امکان پذیر نیست"); return; } try { switch (mode) { case NavigationMethod.ViewMode: destination.Loaded += new RoutedEventHandler(destination_Loaded_View); break; case NavigationMethod.EditMode: destination.Loaded += new RoutedEventHandler(destination_Loaded_Edit); break; case NavigationMethod.NewMode: destination.Loaded += new RoutedEventHandler(destination_Loaded_New); break; } currentPage.Dispatcher.BeginInvoke((Action) delegate { currentPage.NavigationService.Navigate(destination); }, DispatcherPriority.Normal); } catch (System.Exception ex) { MessageBox.Show("System encountered problem during navigation\n" + ex.Message); } }
bool IKeyboardInputSink.TabInto(NavigationMethod navigationMethod) { return(TabIntoCore(navigationMethod)); }
/// <summary> /// Sets the currently focused element in the specified scope. /// </summary> /// <param name="scope">The focus scope.</param> /// <param name="element">The element to focus. May be null.</param> /// <param name="method">The method by which focus was changed.</param> /// <param name="modifiers">Any input modifiers active at the time of focus.</param> /// <remarks> /// If the specified scope is the current <see cref="Scope"/> then the keyboard focus /// will change. /// </remarks> public void SetFocusedElement( IFocusScope scope, IInputElement element, NavigationMethod method = NavigationMethod.Unspecified, InputModifiers modifiers = InputModifiers.None) { Contract.Requires<ArgumentNullException>(scope != null); _focusScopes[scope] = element; if (Scope == scope) { KeyboardDevice.Instance.SetFocusedElement(element, method, modifiers); } }
void IKeyboardInputSink.TabOut(NavigationMethod navigationMethod) { TabOutCore(navigationMethod); }
public void GoLogin(NavigationMethod method) { GoLogin(method, null); }
/// <summary> /// Instantiates a new NavigationInfo with the given parameters. /// </summary> /// <param name="method">Navigation method.</param> /// <param name="itemId">Season/Tune/Type id based on navigation method.</param> public NavigationInfo(NavigationMethod method, int itemId) { Method = method; ItemId = itemId; }
private async void ImageButton_Clicked() { await NavigationMethod.NavigateAsync(nameof(Post)); }
public void Pop(NavigationMethod method, int count) { PerformPop(method, count, null); }
/// <summary> /// Sets the currently focused element in the specified scope. /// </summary> /// <param name="scope">The focus scope.</param> /// <param name="element">The element to focus. May be null.</param> /// <param name="method">The method by which focus was changed.</param> /// <remarks> /// If the specified scope is the current <see cref="Scope"/> then the keyboard focus /// will change. /// </remarks> public void SetFocusedElement( IFocusScope scope, IInputElement element, NavigationMethod method = NavigationMethod.Unspecified) { Contract.Requires<ArgumentNullException>(scope != null); this.focusScopes[scope] = element; if (this.Scope == scope) { KeyboardDevice.Instance.SetFocusedElement(element, method); } }