예제 #1
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                // This just gets in the way.
                //this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            CheckLanguageSettings();

            RootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (RootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                RootFrame = new Frame();
                // Set the default language
                RootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];

                RootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = RootFrame;
            }

            if (RootFrame.Content == null)
            {
                var credential = new CredentialBLL();
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (credential.CheckIfExists())
                {
                    RootFrame.Navigate(typeof(LoginPage), e.Arguments);
                }
                else
                {
                    RootFrame.Navigate(typeof(RegisterPage), e.Arguments);
                }
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
        private void ChangePassword()
        {
            Status = "";

            try
            {
                var credential = new CredentialBLL(resourceContextForCurrentView);
                credential.ChangeMasterPassword(OldPassword, MasterPassword, ConfirmPassword);
            }
            catch (Exception ex)
            {
                Status = ex.Message;
            }
        }
예제 #3
0
        private void Login()
        {
            Status = "";

            try
            {
                var credential = new CredentialBLL(resourceContextForCurrentView);
                var pass       = credential.RetrivePassword();

                if (pass != Model.MasterPassword)
                {
                    var error = ResourceManager.Current.MainResourceMap.GetValue("Resources/LoginError", resourceContextForCurrentView).ValueAsString;
                    throw new Exception(error);
                }

                App.RootFrame.Navigate(typeof(AppShell));
            }
            catch (Exception ex)
            {
                Status = ex.Message;
            }
        }
예제 #4
0
 public RegisterViewModel()
 {
     Model = new RegisterModel();
     BLL   = new CredentialBLL(resourceContextForCurrentView);
 }