コード例 #1
0
        public MainWindow()
        {
            AuthenticationWindow aw = new AuthenticationWindow(hb);

            if (aw.ShowDialog() != true)
            {
                Close();
                return;
            }

            user = aw.User;

            InitializeComponent();

            Title = "Домашня бугалтерія - " + user.Name;

            curUserControl = ouc = new OrdersUserControl(hb);
            GridMain.Children.Add(ouc);
            GridFilters.Children.Add(ouc.FilterUserControl);

            buc = new BalanceUserControl(hb);
            GridMain.Children.Add(buc);

            erfpuc = new ExpensesRevenuesForPeriodUserControl(hb);
            GridMain.Children.Add(erfpuc);

            buc.Visibility = erfpuc.Visibility = Visibility.Collapsed;

            curButton = ButtonOrders;

            FieldChange("ButtonOrders");

            UpdateAll();
        }
コード例 #2
0
        public bool Authenticate(ExtendedApplicationBase app)
        {
            AuthenticationWindow loadingWindow = new AuthenticationWindow();

            loadingWindow.Show();

            var account  = app.Properties[app.PROPERTY_ACCOUNT];
            var password = app.Properties[app.PROPERTY_PASSWORD];

            if (account == null || password == null)
            {
                loadingWindow.Close();
                return(false);
            }

            if (Authenticate(account.ToString(), password.ToString()))
            {
                //1. 获取用户信息
                UserWorkRequest request  = new UserWorkRequest();
                var             identity = new Identity(account.ToString(), true);
                app.Context.User = new Principal(request, identity);
                Thread.Sleep(5000);
                loadingWindow.Close();

                return(true);
            }
            loadingWindow.Close();
            return(false);
        }
コード例 #3
0
ファイル: App.xaml.cs プロジェクト: Dmitriy91/skype
        public static void Authenticate()
        {
            while (true)
            {
                AuthenticationWindow authenticationWindow = new AuthenticationWindow();
                authenticationWindow.ShowDialog();

                if (authenticationWindow.Tag == null)
                {
                    AsynchronousClientSocket.Shutdown();
                    Process.GetCurrentProcess().CloseMainWindow();
                }
                else if ((AuthenticationDialogResult)authenticationWindow.Tag == AuthenticationDialogResult.Authenticated)
                {
                    break;
                }
                else if ((AuthenticationDialogResult)authenticationWindow.Tag == AuthenticationDialogResult.ShowRegWin)
                {
                    RegistrationWindow registrationWindow = new RegistrationWindow();
                    registrationWindow.ShowDialog();

                    if (registrationWindow.Tag == null)
                    {
                        AsynchronousClientSocket.Shutdown();
                        Process.GetCurrentProcess().CloseMainWindow();
                    }
                }
            }
        }
コード例 #4
0
        private void ShowAuthenticationView()
        {
            IView authenticationWindow        = null;
            AuthenticationViewModel viewModel = new AuthenticationViewModel(new AuthenticationService());

            authenticationWindow = new AuthenticationWindow(viewModel);
            viewModel.settoClose(authenticationWindow);
            authenticationWindow.Show();

            viewToClose.Close();
        }
コード例 #5
0
        private bool Authenticate(Window window)
        {
            window.Hide();
            AuthenticationWindow authentication = new AuthenticationWindow();

            if (authentication.ShowDialog() == true)
            {
                window.Show();
                return(true);
            }
            return(false);
        }
コード例 #6
0
 private void LogOutExecute()
 {
     try
     {
         AuthenticationWindow aw = new AuthenticationWindow();
         man.Close();
         aw.Show();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
コード例 #7
0
        public static string AuthenticateTwitch(string username, bool isBot)
        {
            var authwindow = new AuthenticationWindow(username, isBot);

            if (authwindow.ShowDialog() == true)
            {
                return(authwindow.Oauth);
            }
            else
            {
                return(null);
            }
        }
コード例 #8
0
        protected override void OnStartup(StartupEventArgs e)
        {
            CustomPrincipal customPrincipal = new CustomPrincipal();

            AppDomain.CurrentDomain.SetThreadPrincipal(customPrincipal);
            base.OnStartup(e);

            IView authenticationWindow        = null;
            AuthenticationViewModel viewModel = new AuthenticationViewModel(new AuthenticationService());

            authenticationWindow = new AuthenticationWindow(viewModel);
            viewModel.settoClose(authenticationWindow);
            authenticationWindow.Show();
        }
コード例 #9
0
        public void OpenAuthWindow()
        {
            if (AuthenticationWindow == null)
            {
                AuthenticationWindow = new AuthenticationWindow(jirnalCore_)
                {
                    Owner = MainWindow
                };
                AuthenticationWindow.Closed += (sender, args) => AuthenticationWindow = null;
                AuthenticationWindow.Show();
            }

            AuthenticationWindow.Activate();
        }
コード例 #10
0
ファイル: Authentication.cs プロジェクト: FlashPros/OakBot
        public static string AuthenticateTwitch(string username, bool isBot)
        {
            var authwindow = new AuthenticationWindow(username, isBot);

            if (authwindow.ShowDialog() == true)
            {
                //System.Console.WriteLine("My Oauth: " + authwindow.Oauth);
                return(authwindow.Oauth);
            }
            else
            {
                return(null);
            }
        }
コード例 #11
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            AuthenticationWindow    authWindow          = new AuthenticationWindow();
            AuthenticationViewModel authWindowViewModel = new AuthenticationViewModel();

            authWindow.DataContext              = authWindowViewModel;
            authWindowViewModel.LoginCompleted += (sender, args) =>
            {
                MainWindow = new MainWindow();
                MainWindow.Show();
                authWindow.Close();
            };
            authWindow.ShowDialog();
        }
コード例 #12
0
        public MainWindowViewModel(MainWindow window)
        {
            AddNewEntityCommand = new DelegateCommand <object>(AddNewEntity, CanAddNewEntity);
            ShowAllInfoAboutSelectedAuthorCommand =
                new DelegateCommand <object>(ShowAllInfoAboutSelectedAuthor, CanShowAllInfoAboutSelectedAuthor);
            ShowAllInfoAboutSelectedPublisherCommand =
                new DelegateCommand <object>(ShowAllInfoAboutSelectedPublisher, CanShowAllInfoAboutSelectedPublisher);

            _mainWindow = window;
            var authenticationViewModel = new AuthenticationViewModel();

            authenticationViewModel.SignInConfirmed += AuthenticationViewModel_SignInConfirmed;
            authenticationViewModel.SignInSkipped   += AuthenticationViewModel_SignInSkipped;
            authenticationViewModel.SignUpConfirmed += AuthenticationViewModel_SignUpConfirmed;
            _authenticationWindow          = new AuthenticationWindow(authenticationViewModel);
            _mainWindow.SourceInitialized += delegate {
                _mainWindow.ShowActivated = false;
                _mainWindow.Hide();
                _authenticationWindow.Closed += AuthenticationWindow_Closed;
                _authenticationWindow.ShowDialog();
            };
        }
コード例 #13
0
        public void ShowView(object parameter)
        {
            if (AdminRights)
            {
                AdminViewModel adminViewModel = new AdminViewModel();
                IView          adminView      = new AdminWindow(adminViewModel);
                adminViewModel.settoClose(adminView);
                adminView.Show();
                toClose.Close();
            }

            else if (DoctorRights)
            {
                DoctorViewModel doctorViewModel = new DoctorViewModel();
                IView           doctorView      = new DoctorWindow(doctorViewModel);
                doctorViewModel.settoClose(doctorView);
                doctorView.Show();
                toClose.Close();
            }

            else if (PatientRights)
            {
                PatientViewModel patientViewModel = new PatientViewModel();
                IView            patientView      = new PatientWindow(patientViewModel);
                patientViewModel.settoClose(patientView);
                patientView.Show();
                toClose.Close();
            }

            else
            {
                IView authenticationWindow        = null;
                AuthenticationViewModel viewModel = new AuthenticationViewModel(new AuthenticationService());
                authenticationWindow = new AuthenticationWindow(viewModel);
                viewModel.settoClose(authenticationWindow);
                authenticationWindow.Show();
                toClose.Close();
            }
        }
 public AuthenticationViewModel(AuthenticationWindow authenticationWindow)
 {
     authentication  = authenticationWindow;
     currentEmployee = new User();
 }
コード例 #15
0
 public LoginUC(AuthenticationWindow parentWindow)
 {
     authWindow  = parentWindow;
     authControl = parentWindow.ContentArea;
     InitializeComponent();
 }
コード例 #16
0
        public void Register(object parameter)
        {
            ComboBox comboRole = parameter as ComboBox;
            int      role      = Int32.Parse(((ComboBoxItem)comboRole.SelectedItem).Tag.ToString());
            var      context   = new MedicalDBEntities();
            var      users     = context.Users;
            User     user      = new User();
            User     user1     = new User();

            if (Email != null && Name != null && Surname != null && CNP != null && Password != null && Telephone != null && _validationErrors.Values.Count == 0)
            {
                if (this.CheckUser(Email))
                {
                    user.email       = Email;
                    user.nameUser    = Name;
                    user.surnameUser = Surname;
                    user.password    = Password;
                    user.telephone   = Telephone;
                    user.roleUser    = role;
                    user.CNP         = CNP;
                    users.Add(user);

                    if (user.roleUser == 2 && SelectedSpecialization != null)
                    {
                        var    doctors = context.Doctors;
                        Doctor doctor  = new Doctor();
                        doctor.idSpecialization = SelectedSpecialization.idSpecialization;
                        doctor.idUser           = user.idUser;
                        doctors.Add(doctor);
                    }
                    context.SaveChanges();

                    MessageBox.Show("Contul dumneavoastra a fost inregistrat cu succes");
                    IView authenticationWindow = null;

                    if (AdminRights)
                    {
                        AdminViewModel adminViewModel = new AdminViewModel();
                        IView          adminView      = new AdminWindow(adminViewModel);
                        adminViewModel.settoClose(adminView);
                        adminView.Show();
                        toClose.Close();
                    }

                    else
                    {
                        AuthenticationViewModel viewModel = new AuthenticationViewModel(new AuthenticationService());
                        authenticationWindow = new AuthenticationWindow(viewModel);
                        viewModel.settoClose(authenticationWindow);
                        authenticationWindow.Show();
                        toClose.Close();
                    }
                }
                else
                {
                    MessageBox.Show("Exista deja un cont cu acest email");
                }
            }
            else
            {
                MessageBox.Show("Va rugăm să introduceți toate datele");
            }
        }
コード例 #17
0
 public AuthenticationViewModel(AuthenticationWindow authenticationWindow)
 {
     authentication  = authenticationWindow;
     currentEmployee = new DAN_XLIII.Model.Employee();
 }