コード例 #1
0
ファイル: RegisterViewModel.cs プロジェクト: asge4900/Fasetto
        /// <summary>
        /// Takes the user to the login page
        /// </summary>
        /// <returns></returns>
        public async Task LoginAsync()
        {
            //Go to register page
            ViewModelApplication.GoToPage(ApplicationPage.Login);

            await Task.Delay(1);
        }
コード例 #2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            ApplicationSetup();

            ViewModelApplication.GoToPage(ApplicationPage.Notebook);

            Current.MainWindow = new MainWindow();
            var windowViewModel = new WindowViewModel(Current.MainWindow);


            using var db = new AppDbContext();

            //var _top = db.AppSettings.FirstOrDefault(x => x.SettingName == "WindowTop");
            //double.TryParse(_top.Value ?? _top.DefaultValue, out var top);
            //var _left = db.AppSettings.FirstOrDefault(x => x.SettingName == "WindowLeft");
            //double.TryParse(_left.Value ?? _left.DefaultValue, out var left);
            //var _height = db.AppSettings.FirstOrDefault(x => x.SettingName == "WindowHeight");
            //double.TryParse(_height.Value ?? _height.DefaultValue, out var height);
            //var _width = db.AppSettings.FirstOrDefault(x => x.SettingName == "WindowWidth");
            //double.TryParse(_width.Value ?? _width.DefaultValue, out var width);

            //windowViewModel.SetWindowSizeAndPosition(top, left, height, width);
            Current.MainWindow.DataContext = windowViewModel;

            Current.MainWindow.Show();
        }
コード例 #3
0
        /// <summary>
        /// Logs the user out
        /// </summary>
        public async Task LogoutAsync()
        {
            // Lock this command to ignore any other requests while processing
            await RunCommandAsync(() => LoggingOut, async() =>
            {
                //Hide the popup
                ShowLoginDetails = false;

                // TODO: Confirm the user wants to logout

                // Clear any user data/cache
                await ClientDataStore.ClearAllLoginCredentialsAsync();

                //Remove all opened application tabs
                ViewModelApplication.ApplicationTabs.Clear();

                // Clean all application level view models that contain
                // any information about the current user

                ClearUserData();

                ViewModelApplication.LoginDetailsVisible = false;

                // Go to login page
                ViewModelApplication.GoToPage(ApplicationPage.Login);
            });
        }
コード例 #4
0
        /// <summary>
        /// Takes the user to the register page
        /// </summary>
        /// <returns></returns>
        public async Task RegisterAsync()
        {
            // Go to register page?
            ViewModelApplication.GoToPage(ApplicationPage.Register);

            await Task.Delay(1);
        }
コード例 #5
0
 public void GoToSettings()
 {
     if (ViewModelApplication.CurrentPage != ApplicationPage.AppSettings)
     {
         ViewModelApplication.GoToPage(ApplicationPage.AppSettings);
     }
 }
コード例 #6
0
 public MainWindow()
 {
     InitializeComponent();
     this.viewModel   = new MainViewModel();
     this.DataContext = viewModel;
     viewModel.ViewLoaded();
     ViewModelApplication.GoToPage(ApplicationPage.MainPos);
 }
コード例 #7
0
        /// <summary>
        /// When the content list item is clicked, anlaysiswork page is update
        /// </summary>
        /// <param name="parameter">Analysis content</param>
        public void BaseContentClick(object parameter)
        {
            if (parameter == null)
            {
                return;
            }

            var baseparameter = (SignUpPageItemViewModel)parameter;

            var baseviewmodel = new BaseViewModel
            {
                //TitleName = analysisparameter.AnalysisName,
                //AnalysisSubListVisible = true,
                //CurrentContent = analysisparameter.Contents,
                //Items = new List<AnalysisSubListItemViewModel>
                //        {
                //            new AnalysisSubListItemViewModel
                //            {
                //                AnalysisName = analysisparameter.AnalysisName,
                //                Name = analysisparameter.AnalysisName,
                //                Contents = AnalysisContent.Unit,
                //                IsSelected = analysisparameter.Contents == AnalysisContent.Unit
                //            },
                //            new AnalysisSubListItemViewModel
                //            {
                //                AnalysisName = analysisparameter.AnalysisName,
                //                Name = "Geometry",
                //                Contents = AnalysisContent.Geometry,
                //                IsSelected = analysisparameter.Contents == AnalysisContent.Geometry
                //            },
                //            new AnalysisSubListItemViewModel
                //            {
                //                AnalysisName = analysisparameter.AnalysisName,
                //                Name = "Loads",
                //                Contents = AnalysisContent.Loads,
                //                IsSelected = analysisparameter.Contents == AnalysisContent.Loads
                //            },
                //            new AnalysisSubListItemViewModel
                //            {
                //                AnalysisName = analysisparameter.AnalysisName,
                //                Name = "Analysis",
                //                Contents = AnalysisContent.parameter,
                //                IsSelected = analysisparameter.Contents == AnalysisContent.parameter
                //            },
                //            new AnalysisSubListItemViewModel
                //            {
                //                AnalysisName = analysisparameter.AnalysisName,
                //                Name = "Result",
                //                Contents = AnalysisContent.Result,
                //                IsSelected = analysisparameter.Contents == AnalysisContent.Result
                //            },
                //        },
            };

            // Get analysis content List and data
            ViewModelApplication.GoToPage(ApplicationPage.Analysis, baseviewmodel);
        }
コード例 #8
0
        /// <summary>
        /// Takes the user to the login page
        /// </summary>
        /// <returns></returns>
        private async Task LoginAsync()
        {
            //  Go to login page?
            ViewModelApplication.GoToPage(ApplicationPage.Login);

            //((WindowViewModel)((MainWindow)Application.Current.MainWindow).DataContext).CurrentPage = ApplicationPage.Register;

            await Task.Delay(1);
        }
コード例 #9
0
        /// <summary>
        /// When the content list item is clicked, anlaysiswork page is update
        /// </summary>
        /// <param name="parameter">Analysis content</param>
        public void AnalysisContentClick(object parameter)
        {
            if (parameter == null)
            {
                return;
            }

            var analysisparameter = (AnalysisSubListItemViewModel)parameter;

            var analysisviewmodel = new AnalysisViewModel
            {
                TitleName = analysisparameter.AnalysisName,
                AnalysisSubListVisible = true,
                CurrentContent         = analysisparameter.Contents,
                Items = new List <AnalysisSubListItemViewModel>
                {
                    new AnalysisSubListItemViewModel
                    {
                        AnalysisName = analysisparameter.AnalysisName,
                        Name         = analysisparameter.AnalysisName,
                        Contents     = AnalysisContent.Unit,
                        IsSelected   = analysisparameter.Contents == AnalysisContent.Unit
                    },
                    new AnalysisSubListItemViewModel
                    {
                        AnalysisName = analysisparameter.AnalysisName,
                        Name         = "Geometry",
                        Contents     = AnalysisContent.Geometry,
                        IsSelected   = analysisparameter.Contents == AnalysisContent.Geometry
                    },
                    new AnalysisSubListItemViewModel
                    {
                        AnalysisName = analysisparameter.AnalysisName,
                        Name         = "Loads",
                        Contents     = AnalysisContent.Loads,
                        IsSelected   = analysisparameter.Contents == AnalysisContent.Loads
                    },
                    new AnalysisSubListItemViewModel
                    {
                        AnalysisName = analysisparameter.AnalysisName,
                        Name         = "Analysis",
                        Contents     = AnalysisContent.parameter,
                        IsSelected   = analysisparameter.Contents == AnalysisContent.parameter
                    },
                    new AnalysisSubListItemViewModel
                    {
                        AnalysisName = analysisparameter.AnalysisName,
                        Name         = "Result",
                        Contents     = AnalysisContent.Result,
                        IsSelected   = analysisparameter.Contents == AnalysisContent.Result
                    },
                },
            };

            // Get analysis content List and data
            ViewModelApplication.GoToPage(ApplicationPage.Analysis, analysisviewmodel);
        }
コード例 #10
0
        /// <summary>
        /// Takes the user to the register page
        /// </summary>
        /// <returns></returns>
        public async Task RegisterAsync()
        {
            //IoC.Get<ApplicationViewModel>().SideMenuVisible ^= true;

            //return;

            // Go to register page
            ViewModelApplication.GoToPage(ApplicationPage.Register);

            await Task.Delay(1);
        }
コード例 #11
0
        /// <summary>
        /// Takes the user to the lgin page
        /// </summary>
        /// <returns></returns>
        public async Task LoginAsync()
        {
            //IoC.Get<ApplicationViewModel>().SideMenuVisible ^= true;

            //return;

            // Go to login page
            ViewModelApplication.GoToPage(ApplicationPage.Login);

            await Task.Delay(1);
        }
コード例 #12
0
        /// <summary>
        /// Go to app page
        /// </summary>
        /// <param name="sender"></param>
        public void GoTo(object sender)
        {
            var navbarItem = (NavbarItem)sender;

            if (ViewModelApplication.CurrentPage != navbarItem.ApplicationPage)
            {
                ViewModelApplication.BackToButtonVisibility = Visibility.Hidden;

                SetIsChecked(navbarItem.ApplicationPage);
                ViewModelApplication.GoToPage(navbarItem.ApplicationPage);
            }
        }
コード例 #13
0
        /// <summary>
        /// Logout of the application
        /// </summary>
        public void Logout()
        {
            // TODO: Confirm if user wants to logout

            // TODO: Clear any user data/cache

            // Clean all application level viewmodels that contain any information about the current user
            ClearUserData();

            // Bring user to login page
            ViewModelApplication.GoToPage(ApplicationPage.Login);
        }
コード例 #14
0
        /// <summary>
        /// Show wallpaper with orginal size
        /// </summary>
        /// <param name="sender"></param>
        public void ShowWallpaper(object sender)
        {
            var wallpaper = (Models.Wallpaper.Entities.Wallpaper)sender;

            ViewModelApplication.SelectedWallpaper = wallpaper;
            //ViewModelApplication.TempWallpapers = Wallpapers;
            //ViewModelApplication.TempPagination = DesktopPagination;
            ViewModelApplication.BackToButtonVisibility = Visibility.Visible;
            ViewModelApplication.PreviousPage           = ApplicationPage.MyWallpapers;

            ViewModelApplication.GoToPage(ApplicationPage.Wallpaper);
        }
コード例 #15
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            _ = new AppDbContext();

            ApplicationSetup();

            ViewModelApplication.GoToPage(ApplicationPage.WelcomePage);

            Current.MainWindow             = new MainWindow();
            Current.MainWindow.DataContext = new WindowViewModel(Current.MainWindow);
            Current.MainWindow.Show();
        }
コード例 #16
0
        /// <summary>
        /// Logs the user out
        /// </summary>
        public async Task LogoutAsync()
        {
            // TODO: Confirm the user wants to logout

            // Clear any user data/cache
            await ClientDataStore.ClearAllLoginCredentialsAsync();

            // Clean all application level view models that contain
            // any information about the current user
            ClearUserData();

            // Go to login page
            ViewModelApplication.GoToPage(ApplicationPage.Login);
        }
コード例 #17
0
        /// <summary>
        /// Handles what happens when we have successfully logged in
        /// </summary>
        /// <param name="loginResult">The results from the successful login</param>
        public async Task HandleSuccessfulLoginAsync(UserProfileDetailsApiModel loginResult)
        {
            // Store this in the client data store
            await ClientDataStore.SaveLoginCredentialsAsync(loginResult.ToLoginCredentialsDataModel());

            //Show Login Details
            LoginDetailsVisible = true;

            // Load new settings
            await ViewModelSettings.LoadAsync();



            // Go to home page
            ViewModelApplication.GoToPage(ApplicationPage.Home);
        }
コード例 #18
0
        /// <summary>
        /// Logs the user out
        /// </summary>
        public async Task LogoutAsync()
        {
            // Lock this command to ignore any other requests while processing
            await RunCommandAsync(() => LoggingOut, async() =>
            {
                // Clear any user data/cache
                ClientDataStore.ClearAllLoginCredentials();

                // Clean all application level view models that contain
                // any information about the current user
                ClearUserData();

                await Task.Delay(1000);
                // Go to login page
                ViewModelApplication.GoToPage(ApplicationPage.Login);
            });
        }
コード例 #19
0
        public void GoTo(object sender)
        {
            if (sender == null || !(sender is ToggleButton toggleButton))
            {
                return;
            }

            if (!(toggleButton.DataContext is NavbarItem item))
            {
                return;
            }

            if (ViewModelApplication.CurrentPage != item.ApplicationPage)
            {
                ViewModelApplication.GoToPage(item.ApplicationPage);
            }
        }
コード例 #20
0
        /// <summary>
        /// Custom startup so we load our IoC immediately before anything else
        /// </summary>
        /// <param name="e"></param>
        protected override void OnStartup(StartupEventArgs e)
        {
            // Let the base application do what it needs
            base.OnStartup(e);

            // Setup the Dna Fraimwork
            Framework.Construct <DefaultFrameworkConstruction>()
            .AddFileLogger()
            .AddChatHostViewModels()
            .AddChatClientHostServices()
            .Build();

            // Log it
            Logger.LogDebugSource("Application starting...");

            ViewModelApplication.GoToPage(ApplicationPage.Login);
        }
コード例 #21
0
        public void GoTo(object sender)
        {
            if (sender == null || !(sender is Button button))
            {
                return;
            }

            if (!(button.DataContext is QuickInfo item))
            {
                return;
            }

            if (ViewModelApplication.CurrentPage != item.ApplicationPage)
            {
                ViewModelApplication.GoToPage(item.ApplicationPage);
            }
        }
コード例 #22
0
        /// <summary>
        /// If click the analysis data, open sub lists <see cref="AnalysisSubListItemViewModel"/>
        /// </summary>
        /// <param name="parameter"></param>
        public void OpenContentsList(AnalysisViewModel parameter)
        {
            if (parameter == null)
            {
                return;
            }

            var analysisviewmodel = parameter;

            AnalysisSubListVisible = parameter.AnalysisSubListVisible;
            CurrentAction          = parameter.CurrentAction;
            CurrentContent         = parameter.CurrentContent;

            Items = parameter.Items;

            // Get analysis contents list and data
            ViewModelApplication.GoToPage(ApplicationPage.Analysis, analysisviewmodel);
        }
コード例 #23
0
        /// <summary>
        /// Handles what happens when we have successfully logged in
        /// </summary>
        /// <param name="loginResult">The results from the successful login</param>
        public async Task HandleSuccessfulLoginAsync(LoginResultApiModel loginResult)
        {
            // Store this in the client data store
            await ClientDataStore.SaveLoginCredentialsAsync(new LoginCredentialsDataModel
            {
                Email     = loginResult.Email,
                FirstName = loginResult.FirstName,
                LastName  = loginResult.LastName,
                Username  = loginResult.Username,
                Token     = loginResult.Token
            });

            // Load new settings
            await ViewModelSettings.LoadAsync();

            // Go to chat page
            ViewModelApplication.GoToPage(ApplicationPage.Chat);
        }
コード例 #24
0
        /// <summary>
        /// Show wallpaper with orginal size
        /// </summary>
        /// <param name="sender"></param>
        public void ShowWallpaper(object sender)
        {
            var wallpaper = (Models.Wallpaper.Entities.Wallpaper)sender;

            ViewModelApplication.SelectedWallpaper      = wallpaper;
            ViewModelApplication.BackToButtonVisibility = Visibility.Visible;

            if (WallpapersType == WallpaperType.Desktop)
            {
                ViewModelApplication.PreviousPage = ApplicationPage.DesktopWallpapers;
            }
            else if (WallpapersType == WallpaperType.Mobile)
            {
                ViewModelApplication.PreviousPage = ApplicationPage.MobileWallpapers;
            }

            ViewModelApplication.GoToPage(ApplicationPage.Wallpaper);
        }
コード例 #25
0
        /// <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
            // If we are logged in... go to chat page... otherwise go to login page
            ViewModelApplication.GoToPage(await ClientDataStore.HasCredentialsAsync() ? ApplicationPage.Chat : ApplicationPage.Login);

            // Show the main window
            Current.MainWindow = new MainWindow();
            Current.MainWindow.Show();
        }
コード例 #26
0
        /// <summary>
        /// Configures our application ready for use
        /// </summary>
        private async Task ApplicationSetupAsync()
        {
            // Setup the Dna Framework
            Framework.Construct <DefaultFrameworkConstruction>()
            .AddFileLogger()
            .AddClientDataStore()
            .AddClientServices()
            .AddViewModels()
            .Build();

            // Ensure the client data store
            await ClientDataStore.EnsureDataStoreAsync();


            ViewModelApplication.GoToPage(ApplicationPage.Server);

            // Show the main window
            Current.MainWindow = new MainWindow();
            Current.MainWindow.Show();
        }
コード例 #27
0
ファイル: App.xaml.cs プロジェクト: mdnm/husources-hrm
        /// <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();

            // Setup the application view model based on if we are logged in
            ViewModelApplication.GoToPage(
                // If we are logged in...
                ClientDataStore.HasCredentials() ?
                // Go to nulls page
                ApplicationPage.NullPage :
                // Otherwise, go to login page
                ApplicationPage.Login);

            // Show the main window
            Current.MainWindow = new MainWindow();
            Current.MainWindow.Show();
        }
コード例 #28
0
ファイル: App.xaml.cs プロジェクト: NO1225/Epub-Reader-TTS
        /// <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);

            var win = new Epub_Reader_TTS.SplashScreen();

            win.Show();

            // Setup the main application 
            await ApplicationSetupAsync();

            // Log it
            Logger.LogDebugSource("Application starting...");

            Book book = null;

            foreach (string file in e.Args)
            {
                book = DI.ViewModelDashboard.OpenBookFile(file).GetAwaiter().GetResult();
            }

            ViewModelApplication.GoToPage(ApplicationPage.Dashboard);

            Current.MainWindow = new MainWindow();

            win.Close();

            Current.MainWindow.Show();


            // To be used with open with command 
            if (e.Args.Length == 1)
            {
                TaskManager.Run(() => DI.ViewModelDashboard.OpenBook(book));//.GetAwaiter().GetResult();
            }


        }
コード例 #29
0
        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);
            }
        }
コード例 #30
0
ファイル: App.xaml.cs プロジェクト: EgoistDeveloper/Wallppr
        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();
        }