コード例 #1
0
        private async void ButtonLogin_Click(object sender, RoutedEventArgs e)
        {
            //modifier for advanced options
            if (Keyboard.IsKeyDown(Key.LeftCtrl) && Keyboard.IsKeyDown(Key.LeftShift) && Keyboard.IsKeyDown(Key.D))
            {
                AdvancedLogin advLogin = new AdvancedLogin();
                advLogin.Owner = this;
                advLogin.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                advLogin.ShowDialog();
            }

            else
            {
                string email    = TextBoxLoginEmail.Text.ToLower();
                string password = TextBoxLoginPassword.Password;

                if (email == "")
                {
                    LabelLoginEmailError.Visibility    = Visibility.Visible;
                    LabelLoginPasswordError.Visibility = Visibility.Collapsed;
                }
                else if (password == "")
                {
                    LabelLoginEmailError.Visibility    = Visibility.Collapsed;
                    LabelLoginPasswordError.Visibility = Visibility.Visible;
                }
                else
                {
                    LabelLoginEmailError.Visibility    = Visibility.Collapsed;
                    LabelLoginPasswordError.Visibility = Visibility.Collapsed;

                    string hashedPass = dataUtility.EncodePassword(password);

                    Task <int> loginAsync = login.UserLogin(email, hashedPass);

                    LoginLoading.Visibility = Visibility.Visible;
                    ButtonLogin.Content     = "";

                    int loginResult = await loginAsync;

                    LoginLoading.Visibility = Visibility.Collapsed;
                    ButtonLogin.Content     = "Sign In";

                    if (loginResult == 1)
                    {
                        EntryView entryView = new EntryView();
                        this.Close();
                        entryView.ShowDialog();
                    }
                    else if (loginResult == 0)
                    {
                        DialogWindow dialog = new DialogWindow("Login Failed.", "Incorrect email or password.", "Error");
                        dialog.Owner = this;
                        dialog.ShowDialog();
                    }
                    else if (loginResult == -1)
                    {
                        DialogWindow dialog = new DialogWindow("Could not connect.", "Try again later.", "Error");
                        dialog.Owner = this;
                        dialog.ShowDialog();
                    }
                }
            }
        }
コード例 #2
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.window = ((PasswordManager.WPF.EntryView)(target));

            #line 13 "..\..\EntryView.xaml"
                this.window.Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);

            #line default
            #line hidden
                return;

            case 2:
                this.MainGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 3:
                this.RowDefinitionHeader = ((System.Windows.Controls.RowDefinition)(target));
                return;

            case 4:
                this.RowDefinitionBody = ((System.Windows.Controls.RowDefinition)(target));
                return;

            case 5:
                this.ColumnDefinitionMenu = ((System.Windows.Controls.ColumnDefinition)(target));
                return;

            case 6:
                this.ColumnDefinitionBody = ((System.Windows.Controls.ColumnDefinition)(target));
                return;

            case 7:
                this.NavGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 8:
                this.ButtonAdd = ((System.Windows.Controls.Button)(target));
                return;

            case 9:
                this.ButtonUser = ((System.Windows.Controls.Button)(target));

            #line 58 "..\..\EntryView.xaml"
                this.ButtonUser.Click += new System.Windows.RoutedEventHandler(this.ButtonUser_Click);

            #line default
            #line hidden
                return;

            case 10:
                this.MenuScrollViewer = ((System.Windows.Controls.ScrollViewer)(target));
                return;

            case 11:
                this.MenuGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 12:
                this.MenuCollapse = ((System.Windows.Controls.Grid)(target));

            #line 102 "..\..\EntryView.xaml"
                this.MenuCollapse.MouseEnter += new System.Windows.Input.MouseEventHandler(this.Menu_MouseEnter);

            #line default
            #line hidden

            #line 102 "..\..\EntryView.xaml"
                this.MenuCollapse.MouseLeave += new System.Windows.Input.MouseEventHandler(this.Menu_MouseLeave);

            #line default
            #line hidden

            #line 102 "..\..\EntryView.xaml"
                this.MenuCollapse.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.Menu_MouseDown);

            #line default
            #line hidden
                return;

            case 13:
                this.IconMenuOpen = ((FontAwesome.WPF.ImageAwesome)(target));
                return;

            case 14:
                this.LabelGridCollapse = ((System.Windows.Controls.Label)(target));
                return;

            case 15:
                this.MenuHome = ((System.Windows.Controls.Grid)(target));

            #line 107 "..\..\EntryView.xaml"
                this.MenuHome.MouseEnter += new System.Windows.Input.MouseEventHandler(this.Menu_MouseEnter);

            #line default
            #line hidden

            #line 107 "..\..\EntryView.xaml"
                this.MenuHome.MouseLeave += new System.Windows.Input.MouseEventHandler(this.Menu_MouseLeave);

            #line default
            #line hidden
                return;

            case 16:
                this.IconMenuHome = ((FontAwesome.WPF.ImageAwesome)(target));
                return;

            case 17:
                this.LabelGridHome = ((System.Windows.Controls.Label)(target));
                return;

            case 18:
                this.BlankArea = ((System.Windows.Controls.Grid)(target));
                return;

            case 19:
                this.BorderUserSettings = ((System.Windows.Controls.Border)(target));
                return;

            case 20:
                this.GridUserSettings = ((System.Windows.Controls.Grid)(target));
                return;

            case 21:
                this.UserSettingsUserIcon = ((System.Windows.Controls.Label)(target));
                return;

            case 22:
                this.UserSettingsUserNameLabel = ((System.Windows.Controls.Label)(target));
                return;

            case 23:
                this.UserSettingsEmailLabel = ((System.Windows.Controls.Label)(target));
                return;

            case 24:
                this.UserSettingsAdvanced = ((System.Windows.Controls.TextBlock)(target));

            #line 149 "..\..\EntryView.xaml"
                this.UserSettingsAdvanced.MouseEnter += new System.Windows.Input.MouseEventHandler(this.TextButton_MouseEnter);

            #line default
            #line hidden

            #line 149 "..\..\EntryView.xaml"
                this.UserSettingsAdvanced.MouseLeave += new System.Windows.Input.MouseEventHandler(this.TextButton_MouseLeave);

            #line default
            #line hidden
                return;

            case 25:
                this.UserSettingsSignOut = ((System.Windows.Controls.TextBlock)(target));

            #line 151 "..\..\EntryView.xaml"
                this.UserSettingsSignOut.MouseEnter += new System.Windows.Input.MouseEventHandler(this.TextButton_MouseEnter);

            #line default
            #line hidden

            #line 151 "..\..\EntryView.xaml"
                this.UserSettingsSignOut.MouseLeave += new System.Windows.Input.MouseEventHandler(this.TextButton_MouseLeave);

            #line default
            #line hidden

            #line 151 "..\..\EntryView.xaml"
                this.UserSettingsSignOut.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.UserSettingsSignOut_MouseDown);

            #line default
            #line hidden
                return;

            case 26:
                this.PasswordGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 27:
                this.PasswordHeader = ((System.Windows.Controls.Grid)(target));
                return;

            case 28:
                this.HeaderLabel = ((System.Windows.Controls.Label)(target));
                return;

            case 29:
                this.BorderButtonIconView = ((System.Windows.Controls.Border)(target));

            #line 172 "..\..\EntryView.xaml"
                this.BorderButtonIconView.MouseEnter += new System.Windows.Input.MouseEventHandler(this.Button_MouseEnter);

            #line default
            #line hidden

            #line 172 "..\..\EntryView.xaml"
                this.BorderButtonIconView.MouseLeave += new System.Windows.Input.MouseEventHandler(this.Button_MouseLeave);

            #line default
            #line hidden

            #line 172 "..\..\EntryView.xaml"
                this.BorderButtonIconView.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.ResultIconView_MouseDown);

            #line default
            #line hidden
                return;

            case 30:
                this.IconView = ((FontAwesome.WPF.ImageAwesome)(target));
                return;

            case 31:
                this.BorderButtonGridView = ((System.Windows.Controls.Border)(target));

            #line 180 "..\..\EntryView.xaml"
                this.BorderButtonGridView.MouseEnter += new System.Windows.Input.MouseEventHandler(this.Button_MouseEnter);

            #line default
            #line hidden

            #line 180 "..\..\EntryView.xaml"
                this.BorderButtonGridView.MouseLeave += new System.Windows.Input.MouseEventHandler(this.Button_MouseLeave);

            #line default
            #line hidden

            #line 180 "..\..\EntryView.xaml"
                this.BorderButtonGridView.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.ResultGridView_MouseDown);

            #line default
            #line hidden
                return;

            case 32:
                this.GridView = ((FontAwesome.WPF.ImageAwesome)(target));
                return;

            case 33:
                this.LabelSortOptions = ((System.Windows.Controls.Label)(target));
                return;

            case 34:
                this.BorderDropDownSort = ((System.Windows.Controls.Border)(target));
                return;

            case 35:
                this.ComboBoxSort = ((System.Windows.Controls.ComboBox)(target));

            #line 194 "..\..\EntryView.xaml"
                this.ComboBoxSort.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.ComboBoxSort_SelectionChanged);

            #line default
            #line hidden
                return;

            case 36:
                this.PasswordBody = ((System.Windows.Controls.Grid)(target));
                return;

            case 37:
                this.BodyScrollViewer = ((System.Windows.Controls.ScrollViewer)(target));
                return;

            case 38:
                this.PasswordList = ((System.Windows.Controls.Grid)(target));
                return;
            }
            this._contentLoaded = true;
        }