private void button4_Click(object sender, EventArgs e)
        {
            Form home = new HomeView();

            home.Show();
            this.Hide();
        }
Exemple #2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            InitializeFakeDiContainer();
            SetDefaultWindowStyle();

            MainWindow = new HomeView(new HomeViewModel());
            MainWindow.Show();
        }
Exemple #3
0
        private void SingIn_Click(object sender, EventArgs e)
        {
            string UserName, UserPassword;

            this.Cursor             = Cursors.WaitCursor;
            this.ErrorLabel.Visible = false;

            UserName     = this.User.Text;
            UserPassword = this.Password.Text;

            if (UserName.Length == 0 || UserPassword.Length == 0)
            {
                this.ErrorMessage("Los campos de nombre de usuario y contraseña\nno pueden estar vacios");
                this.Cursor = Cursors.Default;
                return;
            }

            this.User.Clear();
            this.Password.Clear();

            this.Model.toWrite.Enqueue(new SignIn(UserName, UserPassword));

            if (!this.Model.Write())
            {
                this.ErrorMessage("Error al enviar los datos al servidor");
                this.Cursor = Cursors.Default;
                return;
            }

            if (!this.Model.Read())
            {
                this.ErrorMessage("No se ha obtenido respuesta del servidor");
                this.Cursor = Cursors.Default;
                return;
            }

            Data answer = this.Model.toRead.Dequeue();

            if (answer is RequestAnswer rs)
            {
                if (rs.answer)
                {
                    this.Model.singleton.userName = UserName;
                    SubProcess = false;
                    HomeView homeView = new HomeView();
                    homeView.Show();
                    this.Close();
                }
                else
                {
                    this.ErrorMessage("Usuario o contraseña incorrectos");
                }
            }
            this.Cursor = Cursors.Default;
        }
Exemple #4
0
 public void Dispatch(string request)
 {
     if (request.Equals("STUDENT"))
     {
         StudentView.Show();
     }
     else
     {
         HomeView.Show();
     }
 }
Exemple #5
0
 public void dispatch(string request)
 {
     if (String.Compare(request.ToUpper(), "SUDENT") == 0)
     {
         studentView.Show();
     }
     else
     {
         homeView.Show();
     }
 }
Exemple #6
0
        private void Login()
        {
            if (string.IsNullOrEmpty(Account.Value) || string.IsNullOrEmpty(Password.Value))
            {
                return;
            }

            if (Account.Value.Equals("admin") && Password.Value.Equals("admin"))
            {
                var home = new HomeView();
                home.Show();
                home.DataContext = new HomeViewModel();
            }
        }
Exemple #7
0
        private void App_OnStartup(object sender, StartupEventArgs e)
        {
            ApplicationService.InitializeApplicationDirectorys();
            var applicationModel = ApplicationService.LoadApplicationModel() ??
                                   new ApplicationModel {
                Settings = new SettingsModel {
                    WindowHeight = 350,
                    WindowWidth  = 560,
                    WindowLeft   = 100,
                    WindowTop    = 100,
                    MusicPath    = MusicPath
                }
            };
            var home = new HomeView(applicationModel);

            home.Show();
        }
Exemple #8
0
        public static void HomeView(FormWindowState windowState = FormWindowState.Normal)
        {
            Cursor.Current = Cursors.WaitCursor;

            if (Application.OpenForms["HomeView"] == null)
            {
                HomeView action = new HomeView();
                action.Show();
            }
            else
            {
                {
                    Application.OpenForms["HomeView"].Activate();
                    Application.OpenForms["HomeView"].WindowState = windowState;
                    Application.OpenForms["HomeView"].Show();
                }
            }
        }
Exemple #9
0
 private void ControlA_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     _homeView.Show();
 }
Exemple #10
0
        async void AsyncSignUpFunc()
        {
            LoadingVisiblity = Visibility.Visible;
            try
            {
                if (string.IsNullOrEmpty(Host) && string.IsNullOrEmpty(Port))
                {
                    MyMessage.Show("IP和端口不能为空");
                    return;
                }

                ThriftServiceNameSpace.ThriftService its = new ThriftServiceNameSpace.ThriftService();
                string ip   = Host;
                string port = Port;

                int result = ThriftServiceBasic.Singin(ref ip, ref port);
                if (result == 200)
                {
                    if (GlobalCache.Func_AutoSignin)
                    {
                        autoLogin.Stop();                       //auto singin funcation
                    }
                    if (Config.SaveUserInfo(Host, Port) == 200) //save ip&port
                    {
                        AppConfigs.AsyncSelectFaceType();
                        var config = Config.RegionList.FirstOrDefault(region => region.RegionNO == GlobalCache.AppRegion);
                        if (config != null)
                        {
                            try
                            {
                                GlobalCache.AppLocation = config.RegionName;
                                HomeView home = new HomeView();
                                CurrentWindow.Close();
                                home.Show();
                            }
                            catch (Exception ex)
                            {
                                string err = ex.Message;
                                Logger <SignUpViewModel> .Log.Error("SignUp_Click", ex);

                                MyMessage.Show("该问题需要联系技术人员处理,\n数据或程序问题");
                                return;
                            }
                        }
                        else
                        {
                            MyMessage.Show("exe.config文件与AreaInfo.xml文件中的区域类型不一致");
                            return;
                        }
                    }
                    else
                    {
                        MyMessage.Show("请您先检查userinfo.xml文件是否存在,若存在,\n请联系技术人员处理");
                    }
                }
                else if (result == 404)
                {
                    MyMessage.Show(string.Format("无法连接到 {0}:{1}", ip, port));
                }
            }
            catch (Exception ex)
            {
                Logger <SignUpViewModel> .Log.Error("SignUp_Click", ex);
            }
            finally
            {
                LoadingVisiblity = Visibility.Collapsed;
            }
        }