Exemple #1
0
        public async void PerformLogin()
        {
            UsernameTextItem.IsEnabled       = false;
            PasswordMaskedTextItem.IsEnabled = false;
            LoginButton.IsEnabled            = false;

            var user = new CtrlUser {
                Username = MyUsername, Password = MyPassword.ConvertToSha256HexString()
            };

            CtrlSession.Instance.CurrentUser = user;

            if (await CtrlSession.Instance.StartSession())
            {
                var appWnd = new CtrlWindow();
                var mod    = CtrlModuleStarter.LoadModule <MainMenuUserControl, MainMenuViewModel>(null);

                appWnd.StartModule(mod);

                Close();
            }
            else
            {
                UsernameTextItem.IsEnabled       = true;
                PasswordMaskedTextItem.IsEnabled = true;
                LoginButton.IsEnabled            = true;
                //PasswordMaskedTextItem.CtrlValidationError = new CtrlValidationError
                //{
                //    ValidationErrorHeader = "Fehler beim Login",
                //    ValidationErrorText = "Passwort nicht korrekt!"
                //};
            }
        }
Exemple #2
0
        private void AllMenus_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            DependencyObject originalSource = (DependencyObject)e.OriginalSource;

            while ((originalSource != null) && !(originalSource is ListViewItem))
            {
                originalSource = VisualTreeHelper.GetParent(originalSource);
            }

            if (originalSource is ListViewItem)
            {
                var sendingMenu = sender as CtrlListMenu;
                if (sendingMenu == null)
                {
                    return;
                }

                var sendingItem = sendingMenu.SelectedItem as CtrlMainMenuItem;
                if (sendingItem == null)
                {
                    return;
                }

                var mod     = sendingItem.AssociatedModule;
                var modInfo = ModuleDictionary.ModuleMapping[mod];


                var appWnd = new CtrlWindow();
                var modObj = CtrlModuleStarter.LoadModule(modInfo.Item1, modInfo.Item2);

                modObj.RenderType = ModuleRenderType.WithRibbon;

                appWnd.StartModule(modObj);

                DashboardColumn.Width = new GridLength(0);
                CtrlWindow.Width      = ListMenuColumn.ActualWidth + 12;

                CtrlWindow.WindowState = WindowState.Normal;
                CtrlWindow.WindowState = WindowState.Minimized;

                CtrlWindow.Height = 800;
            }
        }