Example #1
0
        public void PopulateForm()
        {
            var countryCode = Manager.GetCountryCode("Local");

            CountryCodeList.SelectedValue = countryCode;

            var localConnectionType = Manager.GetNetworkConnectionType("Local");

            if (localConnectionType == NetworkConnectionType.Ethernet)
            {
                ActivateEthernet.Checked = true;
            }

            var wifiName = GetSecurityValue("wifi-network-name");

            if (!String.IsNullOrEmpty(wifiName) && wifiName != "na")
            {
                WiFiName.Text = wifiName;
            }

            var wifiPass = GetSecurityValue("wifi-network-password");

            if (!String.IsNullOrEmpty(wifiPass) && wifiPass != "na")
            {
                WiFiPass.Text = wifiPass;
            }

            if (!String.IsNullOrEmpty(wifiName) && wifiName != "na" &&
                !String.IsNullOrEmpty(wifiPass) && wifiPass != "na" &&
                localConnectionType == NetworkConnectionType.WiFi)
            {
                ActivateWiFiNetwork.Checked = true;
            }

            var hotSpotName = GetSecurityValue("wifi-hotspot-name");

            if (!String.IsNullOrEmpty(hotSpotName) && hotSpotName != "na")
            {
                HotSpotName.Text = hotSpotName;
            }
            else
            {
                HotSpotName.Text = "GrowSense" + new Random().Next(10000);
            }

            var hotSpotPass = GetSecurityValue("wifi-hotspot-password");

            if (!String.IsNullOrEmpty(hotSpotPass) && hotSpotPass != "na")
            {
                HotSpotPass.Text = hotSpotPass;
            }
            else
            {
                HotSpotPass.Text = "pass" + new Random().Next(100000, 999999);
            }

            if (!String.IsNullOrEmpty(hotSpotName) && hotSpotName != "na" &&
                !String.IsNullOrEmpty(hotSpotPass) && hotSpotPass != "na" &&
                localConnectionType == NetworkConnectionType.WiFiHotSpot)
            {
                ActivateWiFiHotSpot.Checked = true;
            }
        }