/// <summary> /// Executes the action. /// </summary> /// <param name="sender">The <see cref="System.Object"/> that is passed to the action by the behavior. Generally this is <seealso cref="Microsoft.Xaml.Interactivity.IBehavior.AssociatedObject"/> or a target object.</param> /// <param name="parameter">The value of this parameter is determined by the caller.</param> /// <returns>True if the navigation to the specified page is successful; else false.</returns> public object Execute(object sender, object parameter) { if (string.IsNullOrEmpty(this.TargetPage)) { return(false); } IXamlMetadataProvider metadataProvider = Application.Current as IXamlMetadataProvider; if (metadataProvider == null) { // This will happen if there are no XAML files in the project other than App.xaml. // The markup compiler doesn't bother implementing IXamlMetadataProvider on the app // in that case. return(false); } IXamlType xamlType = metadataProvider.GetXamlType(this.TargetPage); if (xamlType == null) { return(false); } INavigate navigateElement = Window.Current.Content as INavigate; DependencyObject senderObject = sender as DependencyObject; // If the sender wasn't an INavigate, then keep looking up the tree from the // root we were given for another INavigate. while (senderObject != null && navigateElement == null) { navigateElement = senderObject as INavigate; if (navigateElement == null) { senderObject = this._visualTreeHelper.GetParent(senderObject); } } if (navigateElement == null) { return(false); } Frame frame = navigateElement as Frame; if (frame != null) { return(frame.Navigate(xamlType.UnderlyingType, this.Parameter ?? parameter)); } else { return(navigateElement.Navigate(xamlType.UnderlyingType)); } }
/// <summary> /// Executes the action. /// </summary> /// <param name="sender">The <see cref="System.Object"/> that is passed to the action by the behavior. Generally this is <seealso cref="Microsoft.Xaml.Interactivity.IBehavior.AssociatedObject"/> or a target object.</param> /// <param name="parameter">The value of this parameter is determined by the caller.</param> /// <returns>True if the navigation to the specified page is successful; else false.</returns> public object Execute(object sender, object parameter) { if (string.IsNullOrEmpty(this.TargetPage)) { return(false); } IXamlMetadataProvider metadataProvider = (IXamlMetadataProvider)Application.Current; IXamlType xamlType = metadataProvider.GetXamlType(this.TargetPage); if (xamlType == null) { return(false); } INavigate navigateElement = Window.Current.Content as INavigate; DependencyObject senderObject = sender as DependencyObject; // If the sender wasn't an INavigate, then keep looking up the tree from the // root we were given for another INavigate. while (senderObject != null && navigateElement == null) { navigateElement = sender as INavigate; if (navigateElement == null) { senderObject = VisualTreeHelper.GetParent(senderObject); } } if (navigateElement == null) { return(false); } Frame frame = navigateElement as Frame; if (frame != null) { return(frame.Navigate(xamlType.UnderlyingType, this.Parameter ?? parameter)); } else { return(navigateElement.Navigate(xamlType.UnderlyingType)); } }
private async void LoginBtn_Click(object sender, RoutedEventArgs e) { if ((passwordBox.Password == "") || (usernameBox.Text == "")) { MessageDialog message = new MessageDialog("Please Enter an username and a password!", "Attention!"); await message.ShowAsync(); } logicsData.LoginUser(usernameBox.Text, passwordBox.Password); if (logicsData.IsLoggedIn()) { INavigate rootFrame = Window.Current.Content as INavigate; rootFrame.Navigate(typeof(MenuAdmin)); } else { await new MessageDialog("This user does not exist").ShowAsync(); } }
public void pozoviDodavanjeUposlenika() { unosUposlenika.Navigate(typeof(DodavanjeUposlenika)); }
public void Navigate() { _navigate.Navigate(); }
public void pozoviDodavanjeUposlenika() { azuriranjeUposlnika.Navigate(typeof(AzuriranjeUposlenika)); }
public static void Switch(UserControl page) { ContentArea.Navigate(page); }