Exemplo n.º 1
0
        public void init_config(bool _bDisplayProgressBar = true)
        {
            softAPSettingInit.m_bEnableSoftAp = false; // disable
            softAPSettingInit.m_ssid          = "";
            softAPSettingInit.m_pwd           = "";

            SoftApRecord m_rec  = null;
            AsyncWorker  worker = new AsyncWorker(Application.Current.MainWindow);

            if (_bDisplayProgressBar)
            {
                worker.InvokeMethod <SoftApRecord>(((MainWindow)App.Current.MainWindow).statusPanelPage.m_selectedPrinter, ref m_rec, DllMethodType.GetSoftAp, this);
            }
            else
            {
                m_rec = worker.GetSoftAp(((MainWindow)App.Current.MainWindow).statusPanelPage.m_selectedPrinter);
            }

            if (null != m_rec && m_rec.CmdResult == EnumCmdResult._ACK)
            {
                softAPSetting.m_ssid              = softAPSettingInit.m_ssid = m_rec.SSID;
                softAPSetting.m_pwd               = softAPSettingInit.m_pwd = m_rec.PWD;
                softAPSetting.m_bEnableSoftAp     = softAPSettingInit.m_bEnableSoftAp = m_rec.WifiEnable;
                VOP.MainWindow.m_byWifiInitStatus = 0x01;
            }

            tbSSID.Text = softAPSettingInit.m_ssid;
            tbPWD.Text  = softAPSettingInit.m_pwd;
            chkbtn_wifi_enable.IsChecked = softAPSettingInit.m_bEnableSoftAp;
        }
Exemplo n.º 2
0
        public bool apply()
        {
            bool isApplySuccess = false;

            // soft ap config
            string str_ssid       = tbSSID.Text;
            string str_pwd        = tbPWD.Text;
            bool   isEnableSoftAp = (chkbtn_wifi_enable.IsChecked == true);

            if (is_InputVailible())
            {
                SoftApRecord m_rec  = new SoftApRecord(((MainWindow)App.Current.MainWindow).statusPanelPage.m_selectedPrinter, str_ssid, str_pwd, isEnableSoftAp);
                AsyncWorker  worker = new AsyncWorker(Application.Current.MainWindow);

                if (worker.InvokeMethod <SoftApRecord>(((MainWindow)App.Current.MainWindow).statusPanelPage.m_selectedPrinter, ref m_rec, DllMethodType.SetSoftAp, this))
                {
                    if (null != m_rec && m_rec.CmdResult == EnumCmdResult._ACK)
                    {
                        softAPSettingInit.m_ssid          = softAPSetting.m_ssid = str_ssid;
                        softAPSettingInit.m_pwd           = softAPSetting.m_pwd = str_pwd;
                        softAPSettingInit.m_bEnableSoftAp = softAPSetting.m_bEnableSoftAp = isEnableSoftAp;
                        isApplySuccess = true;
                    }
                }

                //if (null != event_config_dirty)
                //    event_config_dirty(is_dirty());
            }
            else
            {
                if (str_ssid.Length <= 0)
                {
                    VOP.Controls.MessageBoxEx.Show(VOP.Controls.MessageBoxExStyle.Simple, Application.Current.MainWindow, (string)this.FindResource("ResStr_Msg_10"), (string)this.FindResource("ResStr_Warning"));
                }
                else if (str_pwd.Length < 8 || str_pwd.Length >= 64)
                {
                    VOP.Controls.MessageBoxEx.Show(VOP.Controls.MessageBoxExStyle.Simple, Application.Current.MainWindow, (string)this.FindResource("ResStr_Msg_3"), (string)this.FindResource("ResStr_Warning"));
                }
            }

            if (isApplySuccess)
            {
                ((MainWindow)App.Current.MainWindow).statusPanelPage.ShowMessage((string)this.FindResource("ResStr_Msg_1"), Brushes.Black);
            }
            else
            {
                ((MainWindow)App.Current.MainWindow).statusPanelPage.ShowMessage((string)this.FindResource("ResStr_Setting_Fail"), Brushes.Red);
            }

            return(isApplySuccess);
        }