Exemplo n.º 1
0
        /// <summary>
        /// 点击登录按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SignUp_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                ThriftServiceNameSpace.ThriftService its = new ThriftServiceNameSpace.ThriftService();

                string ip   = IP.Text;
                string port = Port.Text;

                int result = ThriftServiceBasic.Singin(ref ip, ref port);
                if (result == 200)
                {
                    if (GlobalCache.Func_AutoSignin)
                    {
                        autoLogin.Stop();                               //auto singin funcation
                    }
                    if (Config.SaveUserInfo(IP.Text, Port.Text) == 200) //save ip&port
                    {
                        AppConfigs.AsyncSelectFaceType();
                        var config = Config.RegionList.FirstOrDefault(region => region.RegionNO == GlobalCache.AppRegion);
                        if (config != null)
                        {
                            try
                            {
                                GlobalCache.AppLocation = config.RegionName;
                                MainWindow _mainWindow = new MainWindow();
                                this.Close();
                                _mainWindow.Show();
                                xiaowen = true;
                            }
                            catch (Exception ex)
                            {
                                string err = ex.Message;
                                Logger <Login> .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 <Login> .Log.Error("SignUp_Click", ex);
            }
            finally
            {
                LoadingVisiblity = Visibility.Collapsed;
            }
        }
Exemplo n.º 2
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;
            }
        }