Пример #1
0
        private static void OnIsExpandedPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            WiFiItem control = sender as WiFiItem;

            if (control != null)
            {
                var newValue = (bool)args.NewValue;
                var oldValue = (bool)args.OldValue;

                RoutedPropertyChangedEventArgs <bool> e =
                    new RoutedPropertyChangedEventArgs <bool>(oldValue, newValue, WifiSignalLevelPropertyEvent);

                control.OnIsExpandedPropertyChanged(e);
            }
        }
Пример #2
0
        private static void OnSSIDTextPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            WiFiItem control = sender as WiFiItem;

            if (control != null)
            {
                var newValue = (string)args.NewValue;
                var oldValue = (string)args.OldValue;

                RoutedPropertyChangedEventArgs <string> e =
                    new RoutedPropertyChangedEventArgs <string>(oldValue, newValue, SSIDTextPropertyEvent);

                control.OnSSIDTextPropertyChanged(e);
            }
        }
Пример #3
0
        private static void OnEncryptTypePropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            WiFiItem control = sender as WiFiItem;

            if (control != null)
            {
                var newValue = (EnumEncryptType)args.NewValue;
                var oldValue = (EnumEncryptType)args.OldValue;

                RoutedPropertyChangedEventArgs <EnumEncryptType> e =
                    new RoutedPropertyChangedEventArgs <EnumEncryptType>(oldValue, newValue, EncryptTypePropertyEvent);

                control.OnEncryptTypePropertyChanged(e);
            }
        }
Пример #4
0
        public void cbo_ssid_refresh(bool _bDisplayProgressBar = true)
        {
            wifilist.Children.Clear();

            byte wifiInit = 0;

            int result = dll.GetWifiChangeStatus(((MainWindow)App.Current.MainWindow).statusPanelPage.m_selectedPrinter, ref wifiInit);

            // Begin: Fix bug # 61388
            if (0 == result) // success?
            {
                VOP.MainWindow.m_byWifiInitStatus = wifiInit;
            }
            else
            {
                Win32.OutputDebugString("cbo_ssid_refresh->dll.GetWifiChangeStatus() ---> failed...  , Result =    " + result.ToString());
            }
            // End: Fix bug # 61388

            if (wifiInit == 0x00)
            {
                return;
            }

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

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

            //WiFiInfoRecord m_wifi = null;
            //AsyncWorker worker1 = new AsyncWorker(Application.Current.MainWindow);

            //worker1.InvokeMethod<WiFiInfoRecord>(((MainWindow)App.Current.MainWindow).statusPanelPage.m_selectedPrinter, ref m_wifi, DllMethodType.GetWiFiInfo, this);

            if (null != m_rec && m_rec.CmdResult == EnumCmdResult._ACK)
            {
                for (int i = 0; i < m_rec.SsidList.Count; i++)
                {
                    if (!String.IsNullOrEmpty(m_rec.SsidList[i]))
                    {
                        VOP.Controls.WiFiItem wifiitem = new VOP.Controls.WiFiItem();
                        wifiitem.SSIDText = m_rec.SsidList[i];
                        if ((byte)EnumEncryptType.NoSecurity == m_rec.EncryptionList[i])    //No Security
                        {
                            wifiitem.EncryptionText = (string)this.FindResource("ResStr_No_Security");
                            wifiitem.EncryptType    = VOP.EnumEncryptType.NoSecurity;
                        }
                        else if ((byte)EnumEncryptType.WEP == m_rec.EncryptionList[i]) //WEP
                        {
                            wifiitem.EncryptionText = (string)this.FindResource("ResStr_Protected_by_WEP");
                            wifiitem.EncryptType    = VOP.EnumEncryptType.WEP;
                        }
                        else if ((byte)EnumEncryptType.WPA2_PSK_AES == m_rec.EncryptionList[i])   //3. WPA2-PSK-AES
                        {
                            wifiitem.EncryptionText = (string)this.FindResource("ResStr_Protected_by_WPA2");
                            wifiitem.EncryptType    = VOP.EnumEncryptType.WPA2_PSK_AES;
                        }
                        else if ((byte)EnumEncryptType.MixedModePSK == m_rec.EncryptionList[i])   //4.Mixed Mode PSK
                        {
                            wifiitem.EncryptionText = (string)this.FindResource("ResStr_Protected_by_Mixed_Mode_PSK");
                            wifiitem.EncryptType    = VOP.EnumEncryptType.MixedModePSK;
                        }
                        wifiitem.WifiSignalLevel = VOP.Controls.EnumWifiSignalLevel.stronger;

                        if (m_rec.ConnectedStatusList[i] == true)
                        {
                            wifiitem.Connected      = true;
                            wifiitem.EncryptionText = (string)this.FindResource("ResStr_Connected");
                        }
                        wifiitem.ConnectedPropertyChanged += wifiitem_ConnectedPropertyChanged;

                        wifilist.Children.Add(wifiitem);
                    }
                }
            }
        }