Exemple #1
0
        void Connect(MyAccessPoint point)
        {
            if (point.AccessPoint.IsConnected)
            {
                return;
            }
            AuthRequest authRequest = new AuthRequest(point.AccessPoint);
            bool        overwrite   = true;

            if (authRequest.IsPasswordRequired)
            {
                if (point.AccessPoint.HasProfile)
                {
                    overwrite = false;
                }
            }
            if (overwrite)
            {
                WifiSettingView view = new WifiSettingView();
                view.ShowDialog();
                if (IsSettingOK)
                {
                    var viewmodel = (view.DataContext) as WifiSettingViewModel;
                    authRequest.Domain   = viewmodel.Domain;
                    authRequest.Password = viewmodel.Password;
                    authRequest.Username = viewmodel.UserName;
                }
            }
            point.AccessPoint.ConnectAsync(authRequest, overwrite);
            IsSettingOK = false;
            ListAll();
        }
        /// <summary>
        /// 弹出Wifi状态模态窗口
        /// </summary>
        /// <param name="point"></param>
        /// <returns>1:删除配置文件 2:连接</returns>
        static async Task <object> RunWifiStateDialogAsync(MyAccessPoint point)
        {
            WifiStateView view      = new WifiStateView();
            var           viewModel = new WifiStateViewModel(point);

            view.DataContext = viewModel;
            return(await DialogHost.Show(view, viewModel.OnOpenning, viewModel.OnClosing));
        }
 public WifiStateViewModel(MyAccessPoint accessPoint)
 {
     AccessPoint = accessPoint;
 }
        /// <summary>
        /// 弹出Wifi配置设置模态窗口
        /// </summary>
        /// <param name="authRequest"></param>
        /// <returns>是否配置成功/Domain/Username/Password</returns>
        static async Task <Tuple <bool, string, string, string> > RunWifiCfgSettingDialogAsync(MyAccessPoint point)
        {
            var view = new WifiSettingView();
            WifiSettingViewModel viewmodel = new WifiSettingViewModel(point);
            var result = await DialogHost.Show(view, viewmodel.OnOpenning, viewmodel.OnClosing);

            if (result.Equals("0"))
            {
                return(new Tuple <bool, string, string, string>(false, "", "", ""));
            }
            else
            {
                return(new Tuple <bool, string, string, string>(true, viewmodel.Domain, viewmodel.UserName, viewmodel.Password));
            }
        }
 /// <summary>
 /// 连接wifi
 /// </summary>
 /// <param name="point"></param>
 /// <param name="overwrite"></param>
 /// <param name="authRequest"></param>
 void Connect(MyAccessPoint point, bool overwrite, AuthRequest authRequest)
 {
     point.PromptMsg = "连接中....";
     IsConnecting    = true;
     point.AccessPoint.ConnectAsync(authRequest, overwrite, GiveMsgIfConnectFailed);
 }
Exemple #6
0
 public WifiSettingViewModel(MyAccessPoint selectedAccessPoint)
 {
     SelectedAccessPoint     = selectedAccessPoint;
     PwdCanSeeChangedCommand = new RelayCommand(PwdCanSeeChanged);
 }