예제 #1
0
        private void OK_Click(object sender, RoutedEventArgs e)
        {
            //if (this.tb_InitialServer.Text.Trim() != "" && this.tb_InitialServerOfKey.Text.Trim() != "")
            if (this.tb_InitialServer.Text.Trim() != "")
            {
                ConfigurationUtil.SetValue("InitialServer", this.tb_InitialServer.Text);
                ConfigurationUtil.SetValue("InitialServer_key", this.tb_InitialServerOfKey.Text);
            }
            else
            {
                Snackbar.Enqueue("请输入地址!");
                return;
            }

            ShiKuManager.GetConfigAsync();

            this.Close();
        }
예제 #2
0
        /// <summary>
        /// 同步基元(进程间通信)
        /// </summary>
        //System.Threading.Mutex mutex;

        #region 应用程序启动时
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            //Timeline.DesiredFrameRateProperty.OverrideMetadata(typeof(Timeline), new FrameworkPropertyMetadata { DefaultValue = 30 });//设置为30帧动画
            Current.ShutdownMode = ShutdownMode.OnExplicitShutdown; //设置为但
            ShiKuManager.GetConfigAsync();                          //获取配置
            //mutex = new System.Threading.Mutex(true, "ElectronicNeedleTherapySystem", out ret);

            /*if (!ret)
             * {
             *  MessageBox.Show("你已经打开了酷聊,请查看托盘或结束进程重启");
             *  Environment.Exit(0);
             *  return;
             * }*/
            //Application.Current.MainWindow = new TestingWindow();
            Current.MainWindow = new Login();
            Current.MainWindow.Show();
            //检查目录
            CheckOrCreateChatDir();
        }
예제 #3
0
        public LoginAndRegisterViewModel()
        {
            SelectedCountryCode  = 6;    //默认选中中国
            RSelectedCountryCode = 6;
            EnabledLogin         = true; //允许登录
            SnackBar             = new SnackbarMessageQueue();
            #region Initial Commands
            LoginCommand              = new RelayCommand <IHavePassword>(UserLogin);
            RegisterCommand           = new RelayCommand <IHavePassword>(UserRegisterAccount);
            UsernameTextChangeCommand = new RelayCommand <IHavePassword>(UsernameChanged);
            UploadAvatorCommand       = new RelayCommand(AvatorUpload);
            FemaleOrMaleCommand       = new RelayCommand <object>(FemaleOrMaleChoice);
            RememberPwdCommand        = new RelayCommand <bool>(RememberPassword);
            RegisterTxtLostFocus      = new RelayCommand(CheckPhoneNumber);
            PasswordChanged           = new RelayCommand <RoutedEventArgs>(PasswordChange);

            visiShowKey    = Visibility.Collapsed;
            IsVisitorLogin = false;
            #endregion

            #region Initial Location Lists
            GPSLocator = new GeoCoordinateWatcher();
            Location   = new GeoCoordinate();
            Task.Run(() =>
            {
                GPSLocator.TryStart(false, TimeSpan.FromMilliseconds(5000)); ////超过5S则返回False;
                Location = GPSLocator.Position.Location;                     //获取位置
            });
            CountryList  = GetLocationList(AreasType.Country).ToObservableCollection();
            ProvinceList = new ObservableCollection <Areas>();
            ProvinceList.AddRange(new Areas()
            {
                parent_id = 1, type = 2
            }.GetChildrenList().ToObservableCollection());
            CityList = new ObservableCollection <Areas>();
            AreaList = new ObservableCollection <Areas>();
            //GobalAreaList = new ObservableCollection<Country>();
            GobalAreaList = Country.GetCountries().ToObservableCollection();//国家和地区列表
            #endregion

            if (Debugger.IsAttached)
            {
                //UserId = "15625294668";
            }
            Messenger.Default.Register <bool>(this, LoginNotifications.InitialAccount, (para) => { InitialAccount(); });
            Messenger.Default.Register <string>(this, LoginAndRegisterViewModel.ErrorMessage, (texts) => { SnackBar.Enqueue(texts, "重试", () => { ShiKuManager.GetConfigAsync(); }); });
        }