コード例 #1
0
        private void Receive(int cmd, string data)
        {
            if (cmd == (int)ResponseInfo.False)
            {
                MessageBox.Show("다시 확인 바랍니다.");
            }

            else if (cmd == (int)ResponseInfo.Already)
            {
                MessageBox.Show("다른 곳에서 접속 중입니다. 연결을 끊고 시도해 주세요.");
            }

            else if (cmd == (int)ResponseInfo.Auth)
            {
                MessageBox.Show("인증받지 않은 아이디입니다. 이메일 인증을 진행해 주세요.");
                Detach();
                UpdateViewCommand update = MainViewModel.GetInstance().updateViewCommand as UpdateViewCommand;
                update.Execute("Auth");
            }

            else
            {
                Detach();
                UpdateViewCommand update = MainViewModel.GetInstance().updateViewCommand as UpdateViewCommand;
                update.Execute("Home");
            }
        }
コード例 #2
0
        public void GoJoin()
        {
            Detach();
            UpdateViewCommand update = MainViewModel.GetInstance().updateViewCommand as UpdateViewCommand;

            update.Execute("Join");
        }
コード例 #3
0
        public MainWindow()
        {
            InitializeComponent();
            MainView = new MainViewModel();
            ICommand UpdateViewCommand = new UpdateViewCommand(MainView);

            DataContext = MainView;
            UpdateViewCommand.Execute("Login");
        }
コード例 #4
0
        private void Register()
        {
            try
            {
                using (UnitOfWork unit = new UnitOfWork())
                {
                    IEnumerable <User> result = unit.UserRepository.Get(x => x.UserLogin == UserLogin);
                    if (result.Count() != 0)
                    {
                        Message = "Пользователь с таким логином уже существует!";
                        return;
                    }
                    else
                    {
                        User regUser = new User();
                        regUser.Salt         = PasswordHash.GenerateSaltForPassword().ToString();
                        regUser.UserPassword = PasswordHash.ComputePasswordHash(UserPassword, int.Parse(regUser.Salt));
                        regUser.UserLogin    = UserLogin;

                        unit.UserRepository.Create(regUser);
                        unit.Save();

                        User foundUser = unit.UserRepository.Get(x => x.UserLogin == regUser.UserLogin).First();

                        usersDatum.IdData   = foundUser.Id;
                        usersDatum.FullName = UserSurname + " " + UserName + " " + UserLastname;

                        unit.UserDatumRepository.Create(usersDatum);
                        unit.Save();

                        usersParam.IdParams = foundUser.Id;

                        unit.UserParamRepository.Create(usersParam);
                        unit.Save();

                        Message = "Регистрация прошла успешно! Введите логин и пароль";
                        UpdateViewCommand.Execute("LogInPage");
                    }
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show("Сообщение ошибки: " + exception.Message, "Произошла ошибка");
            }
        }
コード例 #5
0
        public NavigationViewModel(IDialogService dialogService, IWindowService windowService, IBrowserService browserService)
        {
            this.User         = new UserRepo().LoginFirst();
            UpdateViewCommand = new UpdateViewCommand(this, WorkStatus, User, dialogService, windowService, browserService);
            UpdateViewCommand.Execute(ViewType.Home);
            this.Title = User.Username;
            Sections   = new ObservableCollection <string>();

            // Initialize commands
            GetSectionsCommand = new RelayCommand(GetSections);

            // Change configuration connection string to writable
            var fi = typeof(ConfigurationElement).GetField("_bReadOnly", BindingFlags.Instance | BindingFlags.NonPublic);

            fi.SetValue(ConfigurationManager.ConnectionStrings["Default"], false);

            // Populate sections
            GetSectionsCommand.Execute(null);
        }
コード例 #6
0
ファイル: AuthModel.cs プロジェクト: lcw3176/StrawberryTalk
        private void Receive(int cmd, string data)
        {
            if (cmd == (int)ResponseInfo.True)
            {
                MessageBox.Show("인증이 완료되었습니다. 정상적인 이용이 가능합니다.");
                Detach();
                UpdateViewCommand update = MainViewModel.GetInstance().updateViewCommand as UpdateViewCommand;
                update.Execute("Login");
            }

            else if (cmd == (int)ResponseInfo.Ready)
            {
                MessageBox.Show("인증번호가 전송되었습니다. 인증을 진행해 주세요.");
            }

            else
            {
                MessageBox.Show("잘못된 번호입니다. 다시 한번 확인해 주세요.");
            }
        }
コード例 #7
0
ファイル: JoinModel.cs プロジェクト: lcw3176/StrawberryTalk
        private void Receive(int cmd, string data)
        {
            if (cmd == (int)ResponseInfo.Email)
            {
                MessageBox.Show("이미 존재하는 계정입니다.");
            }

            else if (cmd == (int)ResponseInfo.Nickname)
            {
                MessageBox.Show("이미 존재하는 닉네임입니다.");
            }

            else
            {
                MessageBox.Show("가입 완료! 인증을 완료하셔야 이용 가능합니다.");
                Detach();
                UpdateViewCommand update = MainViewModel.GetInstance().updateViewCommand as UpdateViewCommand;
                update.Execute("Auth");
            }
        }