Exemple #1
0
        /// <summary>
        /// Handles the DoWork event of the backgroundWorker control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.ComponentModel.DoWorkEventArgs"/> instance containing the event data.</param>
        public void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            DataModel.BlockAllOperation = true;

            try
            {
                bool           runDeviceConfig = true;
                NetworkProfile profile         = (NetworkProfile)e.Argument;
                if (profile == null)
                {
                    // autodetect
                    profile         = NetworkProfileHelper.AutoDetectNetworkProfile(DataModel.NetworkProfileList);
                    runDeviceConfig = false;
                }

                if (profile != null)
                {
                    UseCaseProfile.Run(profile, backgroundWorker, runDeviceConfig);
                }

                e.Result = profile;
            }
            finally
            {
                DataModel.BlockAllOperation = false;
            }
        }
Exemple #2
0
        public void TestAutoDetect()
        {
            Console.WriteLine("Start");

            // load test profiles
            List <NetworkProfile> networkProfileList = SetupProfiles();

            NetworkProfile current = NetworkProfileHelper.AutoDetectNetworkProfile(networkProfileList);


            if (current != null)
            {
                Console.WriteLine("Profile name: {0}, Wifi SSID: {1} ", current.Name, current.AssociatedWifiSSID);
            }
            else
            {
                Console.WriteLine("No profile found");
            }

            Console.WriteLine("Finished!");
        }