Ejemplo n.º 1
0
        private void bnConfig_Click(object sender, EventArgs e)
        {
            timer.Enabled = false;
            WZC_CONTEXT wzcContex = new WZC_CONTEXT();

            if (false == m_WirelessCard.GetWzcContext(ref wzcContex))
            {
                MessageBox.Show("获取WZC配置失败", "错误");
                timer.Enabled = true;
                return;
            }
            WZCConfig form = new WZCConfig();

            form.txtRefreshInterval.Text   = wzcContex.tmTr.ToString();
            form.txtAssociateTimeout.Text  = wzcContex.tmTp.ToString();
            form.txtIntervalOnConn.Text    = wzcContex.tmTc.ToString();
            form.txtIntervalOnDisconn.Text = wzcContex.tmTf.ToString();
            form.Owner = this;
            form.Left  = (this.Width - form.Width) / 2;
            form.Top   = (this.Height - form.Height) / 2;
            if (DialogResult.OK == form.ShowDialog())
            {
                wzcContex.tmTr = uint.Parse(form.txtRefreshInterval.Text);
                wzcContex.tmTp = uint.Parse(form.txtAssociateTimeout.Text);
                wzcContex.tmTc = uint.Parse(form.txtIntervalOnConn.Text);
                wzcContex.tmTf = uint.Parse(form.txtIntervalOnDisconn.Text);
                if (false == m_WirelessCard.SetWzcContext(ref wzcContex))
                {
                    MessageBox.Show("WZC配置失败", "错误");
                }
            }
            timer.Enabled = true;
        }
Ejemplo n.º 2
0
        public bool SetWzcContext(ref WZC_CONTEXT context)
        {
            bool fStatus = true;

            try
            {
                uint dwFlags  = 0;
                uint dwStatus = NativeMethods.WZCSetContext(null, 0, ref context, ref dwFlags);
                if (NativeConstants.ERROR_SUCCESS != dwStatus)
                {
                    return(false);
                }
            }
            catch
            {
                fStatus = false;
            }
            return(fStatus);
        }