protected override void OnStartup(StartupEventArgs e) { _ = new Setup(); _ = new AppDbContext(); var splashScreen = new UI.Controls.SplashScreen(); splashScreen.Show(); base.OnStartup(e); ApplicationSetup(); ViewModelApplication.GoToPage(ApplicationPage.DesktopWallpapers); Current.MainWindow = new MainWindow(); Current.MainWindow.Loaded += (s, e) => { splashScreen.Close(); }; Current.MainWindow.DataContext = new WindowViewModel(Current.MainWindow); Current.MainWindow.Show(); }
/// <summary> /// Custom startup so we load our IoC immediately before anything else /// </summary> /// <param name="e"></param> protected override async void OnStartup(StartupEventArgs e) { // Let the base application do what it needs base.OnStartup(e); // Setup the main application await ApplicationSetupAsync(); // Log it Logger.LogDebugSource("Application starting..."); // Setup the application view model based on if we are logged in ViewModelApplication.GoToPage( // If we are logged in... await ClientDataStore.HasCredentialsAsync() ? // Go to chat page ApplicationPage.Analysis : // Otherwise, go to login page ApplicationPage.Login); // Show the main window Current.MainWindow = new MainWindow(); Current.MainWindow.Show(); }
public void GoTo(object sender) { if (sender == null || !(sender is ToggleButton toggleButtonbutton)) { return; } if (!(toggleButtonbutton.DataContext is NavbarItem navbarItem)) { return; } foreach (var item in NavbarItems) { item.IsChecked = false; } navbarItem.IsChecked = true; if (ViewModelApplication.CurrentPage != navbarItem.ApplicationPage) { ViewModelApplication.GoToPage(navbarItem.ApplicationPage); } }
private void OpenMessage() { ViewModelApplication.GoToPage(ApplicationPage.Chat, new ChatMessageListViewModel { DisplayTitle = "Parnell, Me", Items = new ObservableCollection <ChatMessageListItemViewModel> { new ChatMessageListItemViewModel { Message = Message, Initials = Initials, MessageSentTime = DateTime.UtcNow, ProfilePictureRGB = "FF00FF", SenderName = "Luke", SendByMe = true }, new ChatMessageListItemViewModel { Message = "A recevied message", Initials = Initials, MessageSentTime = DateTime.UtcNow, ProfilePictureRGB = "FF0000", SenderName = "Parenel", SendByMe = false }, new ChatMessageListItemViewModel { Message = "A recevied message", Initials = Initials, MessageSentTime = DateTime.UtcNow, ProfilePictureRGB = "FF0000", SenderName = "Parenel", SendByMe = false }, new ChatMessageListItemViewModel { Message = Message, Initials = Initials, MessageSentTime = DateTime.UtcNow, ProfilePictureRGB = "FF00FF", SenderName = "Luke", SendByMe = true }, new ChatMessageListItemViewModel { Message = "A recevied message", Initials = Initials, MessageSentTime = DateTime.UtcNow, ProfilePictureRGB = "FF0000", SenderName = "Parenel", SendByMe = false }, new ChatMessageListItemViewModel { Message = "A recevied message", ImageAttachment = new ChatMessageListItemImageAttachmentViewModel { ThumbnailUrl = "http://anywhere" }, Initials = Initials, MessageSentTime = DateTime.UtcNow, ProfilePictureRGB = "FF0000", SenderName = "Parenel", SendByMe = false } } }); }
public void GoToSettings() { ViewModelApplication.GoToPage(ApplicationPage.Settings); }
/// <summary> /// Go to previous app page /// </summary> public void GoToPreviousPage() { SetIsChecked(ViewModelApplication.PreviousPage); ViewModelApplication.GoToPage(ViewModelApplication.PreviousPage); }
public void OpenMessage() { if (Name == "Jesse") { ViewModelApplication.GoToPage(ApplicationPage.Login, new LoginViewModel { Email = "*****@*****.**" }); return; } ViewModelApplication.GoToPage(ApplicationPage.Chat, new ChatMessageListViewModel { DisplayTitle = "Parnell, Me", Items = new ObservableCollection <ChatMessageListItemViewModel> { new ChatMessageListItemViewModel { Message = this.Message, Initials = this.Initials, MessageSentTime = DateTime.UtcNow, ProfilePictureRGB = "FF00FF", SenderName = "Luke", SentByMe = true, }, new ChatMessageListItemViewModel { Message = "A received message", Initials = this.Initials, MessageSentTime = DateTime.UtcNow, ProfilePictureRGB = "FF0000", SenderName = "Parnell", SentByMe = false, }, new ChatMessageListItemViewModel { Message = this.Message, Initials = this.Initials, MessageSentTime = DateTime.UtcNow, ProfilePictureRGB = "FF00FF", SenderName = "Luke", SentByMe = true, }, new ChatMessageListItemViewModel { Message = "A received message", Initials = this.Initials, MessageSentTime = DateTime.UtcNow, ProfilePictureRGB = "FF0000", SenderName = "Parnell", SentByMe = false, }, new ChatMessageListItemViewModel { Message = this.Message, Initials = this.Initials, MessageSentTime = DateTime.UtcNow, ProfilePictureRGB = "FF00FF", SenderName = "Luke", SentByMe = true, }, new ChatMessageListItemViewModel { Message = "A received message", Initials = this.Initials, MessageSentTime = DateTime.UtcNow, ProfilePictureRGB = "FF0000", SenderName = "Parnell", SentByMe = false, }, new ChatMessageListItemViewModel { Message = this.Message, Initials = this.Initials, MessageSentTime = DateTime.UtcNow, ProfilePictureRGB = "FF00FF", SenderName = "Luke", SentByMe = true, }, new ChatMessageListItemViewModel { Message = "A received message", ImageAttachment = new ChatMessageListItemImageAttachmentViewModel { ThumbnailUrl = "http://anywhere" }, Initials = this.Initials, MessageSentTime = DateTime.UtcNow, ProfilePictureRGB = "FF0000", SenderName = "Parnell", SentByMe = false, } } }); }