private static void ShowChildPage(CoreConstants.UserInterface userinterface, object[] parameter) { if (AppCache.ContentFrame != null) { AppCache.ContentFrame.ContentLoader = new MUIContentLoader(userinterface, parameter); AppCache.ContentFrame.Source = userinterface.Uri; } }
public static CoreConstants.UserInterface GetParent(CoreConstants.UserInterface childUI) { CoreConstants.UserInterface userinterface = null; foreach (var item in Items.FindAll(x => x.LinkUI != null)) { if (item.LinkUI.Id == childUI.Id) { userinterface = item; break; } } return(userinterface); }
public static CoreConstants.UserInterface FindByName(string name) { CoreConstants.UserInterface userinterface = null; foreach (var item in Items) { if (item.Name == name) { userinterface = item; break; } } return(userinterface); }
public static CoreConstants.UserInterface FindById(int id) { CoreConstants.UserInterface userinterface = null; foreach (var item in Items) { if (item.Id == id) { userinterface = item; break; } } return(userinterface); }
public static void Show(CoreConstants.UserInterface userinterface, object[] parameter) { if (userinterface.PageType == CoreConstants.PageType.Page) { ShowPage(userinterface, parameter); } else if (userinterface.PageType == CoreConstants.PageType.ContentPage) { ShowChildPage(userinterface, parameter); } else if (userinterface.PageType == CoreConstants.PageType.Dialog) { ShowDialog(userinterface, parameter); } }
private static void ShowDialog(CoreConstants.UserInterface userinterface, object[] parameter) { var type = Type.GetType(userinterface.Assembly); //Create instance of view var page = type.Assembly.CreateInstance(userinterface.Page); //Assign the view model ModernDialog dialog = page as ModernDialog; //Mary the ViewModel to View var viewmodel = dialog.Resources["ViewModel"]; if (viewmodel != null) { dialog.DataContext = viewmodel; } Type viewmodelType = viewmodel.GetType(); // Set the UserInterface property PropertyInfo userinterfaceProperty = viewmodelType.GetProperty("UserInterface"); if (userinterfaceProperty != null) { userinterfaceProperty.SetValue(viewmodel, userinterface, null); } // Set the View property PropertyInfo viewProperty = viewmodelType.GetProperty("View"); if (viewProperty != null) { viewProperty.SetValue(viewmodel, dialog, null); } //Pass parameter to VM's Initialise viewmodelType.InvokeMember("Initialise", System.Reflection.BindingFlags.InvokeMethod, null, viewmodel, parameter); //Show the dialog dialog.Owner = AppCache.MainWindow; dialog.Buttons = null; dialog.ShowDialog(); }
public static void Show(CoreConstants.UserInterface userinterface) { Show(userinterface, null); }
public MUIContentLoader(CoreConstants.UserInterface userInterface, object[] parameter) { this.UserInterface = userInterface; this.Parameters = parameter; }