public void RegistrationExecute()
        {
            RegistrationView registrationView = new RegistrationView();

            login.Close();
            registrationView.ShowDialog();
        }
Esempio n. 2
0
        public void ShowRegistrationView()
        {
            var vm   = new RegistrationViewModel(this);
            var from = new RegistrationView(vm);

            from.Owner = _mainfrom;
            from.ShowDialog();
        }
Esempio n. 3
0
        public static void OpenRegister()
        {
            loginView.Hide();
            RegistrationViewModel rvm = new RegistrationViewModel();

            regView             = new RegistrationView();
            regView.DataContext = rvm;
            regView.ShowDialog();
        }
Esempio n. 4
0
        private void GoRegistrationExecute()
        {
            _avtView.Visibility = Visibility.Hidden;
            RegistrationView      regView      = new RegistrationView();
            RegistrationViewModel regViewModel = new RegistrationViewModel(regView);

            regView.DataContext = regViewModel;
            regView.ShowDialog();
            _avtView.Visibility = Visibility.Visible;
        }
Esempio n. 5
0
 private void RegisterExecute()
 {
     try
     {
         RegistrationView registerView = new RegistrationView();
         login.Close();
         registerView.ShowDialog();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
        private void Registration(object obj)
        {
            _gameNetLoginModel.View.Hide();
            _gameNetLoginModel.View.ButtonLogin.IsEnabled = false;
            _gameNetLoginModel.View.ProgressRing.IsActive = true;

            var view = new RegistrationView();
            var show = view.ShowDialog();

            // Если регистрация юзера прошла, добавляем его в базу.
            if (show != null && show.Value) {
                var cl = new Clients {
                    Email = view.TextBoxEmail.Text,
                    Id = 0,
                    Password = view.PasswordBox.Password,
                    UserName = view.TextBoxUserName.Text
                };

                try {
                    //TODO: Если сервер базы данных недоступен не прерывать основной поток на ожидание таймаута
                    //await Task.Factory.StartNew(() => {
                        _gameNetLoginModel.Db.Clients.InsertOnSubmit(cl);
                        _gameNetLoginModel.Db.SubmitChanges();
                    //});
                } catch (SqlException) {
                    _gameNetLoginModel.View.TextBlockWarning.Text = "Сервер базы данных недоступен!";
                    _gameNetLoginModel.View.TextBlockWarning.Visibility = Visibility.Visible;
                    _gameNetLoginModel.View.ButtonLogin.IsEnabled = true;
                    _gameNetLoginModel.View.ProgressRing.IsActive = false;
                } // try-catch
            } // if

            _gameNetLoginModel.View.ButtonLogin.IsEnabled = true;
            _gameNetLoginModel.View.ProgressRing.IsActive = false;

            var preloaderView = Application.Current.Windows
                                           .OfType<PreloaderView>()
                                           .FirstOrDefault();
            if (preloaderView != null) {
                preloaderView.ProgressRing.IsActive = false;
                preloaderView.TextBlockProgress.Visibility = Visibility.Collapsed;
                preloaderView.StackPanelMenu.Visibility = Visibility.Visible;
            } // if

            _gameNetLoginModel.View.ShowDialog();
        } // Registration
Esempio n. 7
0
        void InitializeCommands()
        {
            LoginCommand = new RelayCommand(async param =>
            {
                try
                {
                    NetworkManager.CurrentUser = await NetworkManager.Client.ConnectAsync(UserLogin, UserPassword);

                    Window currentWindow       = param as Window;
                    currentWindow.DialogResult = true;
                    currentWindow.Close();
                }
                catch (Exception excep)
                {
                    new MessageBoxView(excep.Message).Show();
                }
            });
            OpenRegistrationViewCommand = new RelayCommand(param =>
            {
                try
                {
                    Window currentWindow = param as Window;

                    RegistrationView registrationView = new RegistrationView()
                    {
                        WindowStartupLocation = WindowStartupLocation.CenterOwner, Owner = currentWindow
                    };;
                    registrationView.ShowDialog();
                }
                catch (Exception excep)
                {
                    new MessageBoxView(excep.Message).Show();
                }
            });
            CancleCommand = new RelayCommand(param =>
            {
                Window currentWindow       = param as Window;
                currentWindow.DialogResult = false;
                currentWindow.Close();
            });
        }