void RegisterDevice()
 {
     if (!SessionManager.IMEI.HasValue)
     {
         SessionManager.IMEI = DeviceInfoHelper.GetDeviceUniqID();
     }
 }
예제 #2
0
        /// <summary>
        /// 配对信息返回结果
        /// </summary>
        /// <param name="msgType"></param>
        /// <param name="value"></param>
        private void AnalyzeDevicePairResult(MsgType msgType, string value)
        {
            App.Current.Dispatcher.Invoke(new Action(() =>
            {
                DevicePairInfo devicePairInfo = XmlUnityConvert.XmlDeserialize <DevicePairInfo>(value);
                ResultWindow resultWindow     = CheckResultMsg(msgType);
                if (resultWindow == null)
                {
                    return;
                }

                if (devicePairInfo.ResultCode == 0)
                {
                    resultWindow.SuccessCloseWindow();
                    if (msgType == MsgType.DevicePairResult)
                    {
                        DeviceInfoHelper.DevicePairInfo(devicePairInfo);
                    }
                    else
                    {
                        // 取消配对
                        DeviceInfoHelper.DeviceCancelPair(devicePairInfo.DeviceCode ?? string.Empty);
                    }
                }
                else
                {
                    resultWindow.FailedCloseWindow(devicePairInfo);
                }
            }));
        }
예제 #3
0
        /// <summary>
        /// If the user have credential store in local
        /// Launch the auto connection
        /// </summary>
        private async void AutoConnexion()
        {
            LoaderImage.Visibility              = ViewStates.Visible;
            Email.Visibility                    = ViewStates.Gone;
            Password.Visibility                 = ViewStates.Gone;
            GoToWhatIsSeekiosLayout.Visibility  = ViewStates.Gone;
            Connect.Visibility                  = ViewStates.Gone;
            GoToCreateAccountLayout.Visibility  = ViewStates.Gone;
            GoToForgetPasswordLayout.Visibility = ViewStates.Gone;

            if (!await App.Locator.Login.AutoConnect(DeviceInfoHelper.DeviceModel
                                                     , DeviceInfoHelper.Platform
                                                     , DeviceInfoHelper.Version
                                                     , DeviceInfoHelper.GetDeviceUniqueId(this)
                                                     , DeviceInfoHelper.CountryCode))
            {
                LoaderImage.Visibility              = ViewStates.Gone;
                Email.Visibility                    = ViewStates.Visible;
                Password.Visibility                 = ViewStates.Visible;
                GoToWhatIsSeekiosLayout.Visibility  = ViewStates.Visible;
                Connect.Visibility                  = ViewStates.Visible;
                GoToCreateAccountLayout.Visibility  = ViewStates.Visible;
                GoToForgetPasswordLayout.Visibility = ViewStates.Visible;
            }
        }
예제 #4
0
        /// <summary>
        /// Connect the user
        /// </summary>
        private async void ConnectClick(object sender, EventArgs e)
        {
            // Send to DataService info of entered email and password
            App.Locator.Login.Email    = Email.Text;
            App.Locator.Login.Password = Password.Text;

            if (!Email.Text.IsEmail())
            {
                Email.Error = Resources.GetString(Resource.String.createAccount_errorEmail);
                return;
            }

            // Hide Keyboard
            using (var imm = (Android.Views.InputMethods.InputMethodManager)GetSystemService(InputMethodService))
            {
                imm.HideSoftInputFromWindow(Connect.WindowToken, 0);
            }

            LoadingLayout.Visibility = ViewStates.Visible;

            await App.Locator.Login.Connect(DeviceInfoHelper.DeviceModel
                                            , DeviceInfoHelper.Platform
                                            , DeviceInfoHelper.Version
                                            , DeviceInfoHelper.GetDeviceUniqueId(this)
                                            , DeviceInfoHelper.CountryCode);

            LoadingLayout.Visibility = ViewStates.Invisible;
        }
예제 #5
0
 /// <summary>
 /// 断开连接
 /// </summary>
 public override void DisConnectNetWork()
 {
     App.Current.Dispatcher.Invoke(new Action(() =>
     {
         DeviceInfoHelper.DeviceItemClear();
     }));
 }
예제 #6
0
 private async void Button_Click_1(object sender, RoutedEventArgs e)
 {
     if (terminalModel == "")
     {
         terminalModel = await DeviceInfoHelper.GetDeviceModelAsync();
     }
     if (termnalPlataform == "")
     {
         termnalPlataform = "WindowsPhone " + Environment.OSVersion.Version.ToString();
     }
     if (terminalDisplaysize == "")
     {
         terminalDisplaysize = Application.Current.Host.Content.ActualWidth + "x" + Application.Current.Host.Content.ActualHeight;
     }
     if (!controlUser)
     {
         NombreUsuario.BorderBrush = new SolidColorBrush(Colors.Red);
         MessageBox.Show("Nombre de usuario no valido");
     }
     else if (!controlPass)
     {
         PasswordUsuario.BorderBrush = new SolidColorBrush(Colors.Red);
         MessageBox.Show("Contraseña demasiado corta");
     }
     else if (!controlEmail)
     {
         EmailUsuario.BorderBrush = new SolidColorBrush(Colors.Red);
         MessageBox.Show("Email no valido");
     }
     else if (id_provincia == 0)
     {
         ListItemProvincias.BorderBrush = new SolidColorBrush(Colors.Red);
         MessageBox.Show("Seleciona una provincia");
     }
     else if (id_universidad == 0)
     {
         ListItemUniversidad.BorderBrush = new SolidColorBrush(Colors.Red);
         MessageBox.Show("Seleciona una universidad");
     }
     else if (id_facultad == 0)
     {
         ListItemFacultades.BorderBrush = new SolidColorBrush(Colors.Red);
         MessageBox.Show("Seleciona una facultad");
     }
     else if (await Comunicacion_Usuario.RegistrarUsuario(NombreUsuario.Text, PasswordUsuario.Password, EmailUsuario.Text, id_universidad + "", id_facultad + "", terminalModel, termnalPlataform, terminalDisplaysize))
     {
         AplicationSettings.RegistrarUsuario(NombreUsuario.Text, PasswordUsuario.Password);
         NavigationService.Navigate(new Uri("/View/Principal.xaml", UriKind.Relative));
     }
     else
     {
         MessageBox.Show(AplicationSettings.getErrorServer());
         AplicationSettings.setErrorServer("");
     }
 }
예제 #7
0
        /// <summary>
        /// 执法记录仪设备更新
        /// </summary>

        public void AnalyzeDeviceUpdateState(string value)
        {
            App.Current.Dispatcher.Invoke(new Action(() =>
            {
                UpdateDeviceInfos deviceInfos = XmlUnityConvert.XmlDeserialize <UpdateDeviceInfos>(value);
                if (deviceInfos != null && deviceInfos.DeviveInfoList != null)
                {
                    DeviceInfoHelper.DeviceInfoUpdate(deviceInfos);
                }
            }));
        }
예제 #8
0
        /// <summary>
        /// Stores data like assets and item templates. Defaults to an in-memory cache, but can be implemented as writing to disk by the platform
        /// </summary>
        // public IDataCache DataCache { get; set; } = new MemoryDataCache();
        // public Templates Templates { get; private set; }

        internal Session(ILoginProvider loginProvider, AccessToken accessToken, GeoCoordinate geoCoordinate, Signature.Types.DeviceInfo deviceInfo = null)
        {
            if (!ValidLoginProviders.Contains(loginProvider.ProviderId))
            {
                throw new ArgumentException($"LoginProvider ID must be one of the following: {string.Join(", ", ValidLoginProviders)}");
            }

            HttpClient    = new PokemonHttpClient();
            DeviceInfo    = deviceInfo ?? DeviceInfoHelper.GetRandomIosDevice();
            AccessToken   = accessToken;
            LoginProvider = loginProvider;
            // Player = new Player(geoCoordinate);
            //Map = new Map(this);
            //RpcClient = new RpcClient(this);
            //_heartbeat = new HeartbeatDispatcher(this);
        }
예제 #9
0
        /// <summary>
        /// 执法记录仪移除
        /// </summary>
        /// <param name="value"></param>
        private void AnalyzeDeviceInfosRemove(string value)
        {
            App.Current.Dispatcher.Invoke(new Action(() =>
            {
                XmlDocument xmlDoc = new XmlDocument();

                xmlDoc.LoadXml(value);

                XmlNode node = xmlDoc.SelectSingleNode("DeviveInfo");
                if (node != null)
                {
                    string devieCode = node.Attributes["ID"].Value;

                    DeviceInfoHelper.DevieItemRemove(devieCode);
                }
            }));
        }
 private void OnConnectivityChanged(object sender, Plugin.Connectivity.Abstractions.ConnectivityChangedEventArgs e)
 {
     if (AppInformationLayout != null)
     {
         AppInformationLayout.Visibility = e.IsConnected ? ViewStates.Gone : ViewStates.Visible;
         OnConnectionStateChanged?.Invoke(e.IsConnected);
     }
     if (e.IsConnected)
     {
         App.Locator.ListSeekios.SubscribeToSignalR();
         App.Locator.ListSeekios.LoadUserEnvironment(DeviceInfoHelper.DeviceModel
                                                     , DeviceInfoHelper.Platform
                                                     , DeviceInfoHelper.Version
                                                     , DeviceInfoHelper.GetDeviceUniqueId(this)
                                                     , DeviceInfoHelper.CountryCode);
     }
 }
예제 #11
0
        private void ShowCGUPopup()
        {
            if (_popupCGU == null)
            {
                var refreshInProgressBuilder = new Android.Support.V7.App.AlertDialog.Builder(this, Resource.Style.Theme_AppCompat_Light_Dialog);
                var inflater = (LayoutInflater)GetSystemService(LayoutInflaterService);
                var view     = inflater.Inflate(Resource.Drawable.CGUPopup, null);

                //get the different elements
                //_stepInformationTextView = view.FindViewById<TextView>(Resource.Id.popupRefreshInProgress_stepText);
                //_titleTextView = view.FindViewById<TextView>(Resource.Id.popupRefreshinProgress_title);
                _linkToCGUTextView = view.FindViewById <TextView>(Resource.Id.popupcgu_linkwebcgu);

                _linkToCGUTextView.Click += OnGoToCGUURLButtonClick;

                //Android.Text.ISpanned cgu = Android.Text.Html.FromHtml("");
                //_stepInformationTextView.TextFormatted = cgu;
                //_stepInformationTextView.MovementMethod = new Android.Text.Method.ScrollingMovementMethod();

                //_stepInformationTextView.Text = Resources.GetString(Resource.String.map_TextStep3);

                //Cancel button
                refreshInProgressBuilder.SetNegativeButton(Resource.String.popupcgu_buttonDontAgree, (senderAlert, args) =>
                {
                    if (_popupCGU != null)
                    {
                        _popupCGU.Dismiss();
                    }
                });
                refreshInProgressBuilder.SetPositiveButton(Resource.String.popupcgu_buttonAgree, (senderAlert, args) =>
                {
                    App.Locator.Login.CreateAccount(FirstNameEditText.Text
                                                    , LastNameEditText.Text
                                                    , DeviceInfoHelper.DeviceModel
                                                    , DeviceInfoHelper.Platform
                                                    , DeviceInfoHelper.Version
                                                    , DeviceInfoHelper.GetDeviceUniqueId(this)
                                                    , DeviceInfoHelper.CountryCode).ContinueWith(c => { _popupCGU?.Dismiss(); });
                });
                refreshInProgressBuilder.SetView(view);
                _popupCGU = refreshInProgressBuilder.Create();
                _popupCGU.DismissEvent += _popupRefresh_DismissEvent;
            }
            _popupCGU.Show();
        }
예제 #12
0
        /// <summary>
        /// 点击开始、停止采集操作结果
        /// </summary>
        /// <param name="msgType">消息类型</param>
        /// <param name="value">信息内容</param>
        /// <param name="deviceState">更新执法记录仪采集状态</param>
        private void AnalyzeDeviceCollectResult(MsgType msgType, string value, DeviceState deviceState)
        {
            App.Current.Dispatcher.Invoke(new Action(() =>
            {
                DeviceCollectInfo deviceCollectInfo = XmlUnityConvert.XmlDeserialize <DeviceCollectInfo>(value);
                ResultWindow resultWindow           = CheckResultMsg(msgType);
                if (resultWindow == null)
                {
                    return;
                }

                if (deviceCollectInfo.ResultCode == 0)
                {
                    resultWindow.SuccessCloseWindow();
                    DeviceInfoHelper.DeviceCollectInfo(deviceCollectInfo.DeviceID, deviceState);
                }
                else
                {
                    resultWindow.FailedCloseWindow(deviceCollectInfo);
                }
            }));
        }
예제 #13
0
        //public void Load(JObject jsonObj)
        //{
        //    try
        //    {
        //        var input = jsonObj.ToString(Formatting.None, new StringEnumConverter { CamelCaseText = true });
        //        var settings = new JsonSerializerSettings();
        //        settings.Converters.Add(new StringEnumConverter { CamelCaseText = true });
        //        JsonConvert.PopulateObject(input, this, settings);
        //        Save(_filePath);
        //    }
        //    catch (JsonReaderException exception)
        //    {
        //            Logger.Write("JSON Exception: " + exception.Message, LogLevel.Error);
        //    }
        //}

        public void Load(string configFile, string schemaFile, int schemaVersion, bool validate = false)
        {
            try
            {
                _filePath = configFile;

                if (File.Exists(_filePath))
                {
                    // if the file exists, load the settings
                    var input = File.ReadAllText(_filePath, Encoding.UTF8);

                    if (validate)
                    {
                        var jsonObj = JObject.Parse(input);

                        // Migrate before validation.
                        MigrateSettings(schemaVersion, jsonObj, configFile, schemaFile);

                        // validate Json using JsonSchema
                        Logger.Write("Validating auth.json...");
                        IList <ValidationError> errors = null;
                        bool valid;
                        try
                        {
                            valid = jsonObj.IsValid(JsonSchema, out errors);
                        }
                        catch (JSchemaException ex)
                        {
                            if (ex.Message.Contains("commercial licence") || ex.Message.Contains("free-quota"))
                            {
                                Logger.Write(
                                    "auth.json: " + ex.Message);
                                valid = false;
                            }
                            else
                            {
                                throw;
                            }
                        }
                        if (!valid)
                        {
                            if (errors != null)
                            {
                                foreach (var error in errors)
                                {
                                    Logger.Write(
                                        "auth.json [Line: " + error.LineNumber + ", Position: " + error.LinePosition + "]: " +
                                        error.Path + " " +
                                        error.Message, LogLevel.Error);
                                }
                            }

                            Logger.Write("Fix auth.json and restart NecroBot or press a key to ignore and continue...",
                                         LogLevel.Warning);
                            Console.ReadKey();
                        }

                        // Now we know it's valid so update input with the migrated version.
                        input = jsonObj.ToString();
                    }

                    var settings = new JsonSerializerSettings();
                    settings.Converters.Add(new StringEnumConverter {
                        CamelCaseText = true
                    });
                    JsonConvert.PopulateObject(input, this, settings);
                }
                // Do some post-load logic to determine what device info to be using - if 'custom' is set we just take what's in the file without question
                if (DeviceConfig.DevicePlatform.Equals("ios", StringComparison.InvariantCultureIgnoreCase))
                {
                    // iOS
                    if (DeviceConfig.DevicePackageName.Equals("random", StringComparison.InvariantCultureIgnoreCase))
                    {
                        var randomAppleDeviceInfo = DeviceInfoHelper.GetRandomIosDevice();
                        SetDevInfoByDeviceInfo(randomAppleDeviceInfo);

                        // After generating iOS settings, automatically set the package name to "custom", so that we don't regenerate settings every time we start.
                        DeviceConfig.DevicePackageName = "custom";
                    }
                }
                else
                {
                    // We cannot emulate Android at the moment, so if we got here, then regenerate the settings with random iOS device.

                    /*
                     * // Android
                     * if (!DeviceConfig.DevicePackageName.Equals("random", StringComparison.InvariantCultureIgnoreCase) &&
                     *  !DeviceConfig.DevicePackageName.Equals("custom", StringComparison.InvariantCultureIgnoreCase))
                     * {
                     *  // User requested a specific device package, check to see if it exists and if so, set it up - otherwise fall-back to random package
                     *  var keepDevId = DeviceConfig.DeviceId;
                     *  SetDevInfoByKey();
                     *  DeviceConfig.DeviceId = keepDevId;
                     * }
                     * if (DeviceConfig.DevicePackageName.Equals("random", StringComparison.InvariantCultureIgnoreCase))
                     * {
                     *  // Random is set, so pick a random device package and set it up - it will get saved to disk below and re-used in subsequent sessions
                     *  var rnd = new Random();
                     *  var rndIdx = rnd.Next(0, DeviceInfoHelper.AndroidDeviceInfoSets.Keys.Count - 1);
                     *  DeviceConfig.DevicePackageName = DeviceInfoHelper.AndroidDeviceInfoSets.Keys.ToArray()[rndIdx];
                     *  SetDevInfoByKey();
                     * }
                     */
                    DeviceConfig.DevicePlatform    = "ios";
                    DeviceConfig.DevicePackageName = "custom";

                    var randomAppleDeviceInfo = DeviceInfoHelper.GetRandomIosDevice();
                    SetDevInfoByDeviceInfo(randomAppleDeviceInfo);

                    // Clear out the android fields.
                    DeviceConfig.AndroidBoardName      = null;
                    DeviceConfig.AndroidBootloader     = null;
                    DeviceConfig.DeviceModelIdentifier = null;
                    DeviceConfig.FirmwareTags          = null;
                    DeviceConfig.FirmwareFingerprint   = null;
                }

                if (string.IsNullOrEmpty(DeviceConfig.DeviceId) || DeviceConfig.DeviceId == "8525f5d8201f78b5")
                {
                    // Changed to random hex as full alphabet letters could have been flagged
                    // iOS device ids are 16 bytes (32 chars long)
                    DeviceConfig.DeviceId = RandomString(32, "0123456789abcdef");
                }

                Save(_filePath);
            }
            catch (JsonReaderException exception)
            {
                if (exception.Message.Contains("Unexpected character") && exception.Message.Contains("Username"))
                {
                    Logger.Write("JSON Exception: You need to properly configure your Username using quotations.",
                                 LogLevel.Error);
                }
                else if (exception.Message.Contains("Unexpected character") &&
                         exception.Message.Contains("Password"))
                {
                    Logger.Write(
                        "JSON Exception: You need to properly configure your Password using quotations.",
                        LogLevel.Error);
                }
                else
                {
                    Logger.Write("JSON Exception: " + exception.Message, LogLevel.Error);
                }
            }
        }
예제 #14
0
 /// <summary>
 /// Dynamically gets the current OS version
 /// </summary>
 /// <returns></returns>
 public static int GetCurrentOSBuildNumber()
 {
     return(DeviceInfoHelper.GetCurrentOSBuildNumber());
 }
예제 #15
0
        //public void Load(JObject jsonObj)
        //{
        //    try
        //    {
        //        var input = jsonObj.ToString(Formatting.None, new StringEnumConverter { CamelCaseText = true });
        //        var settings = new JsonSerializerSettings();
        //        settings.Converters.Add(new StringEnumConverter { CamelCaseText = true });
        //        JsonConvert.PopulateObject(input, this, settings);
        //        Save(_filePath);
        //    }
        //    catch (JsonReaderException exception)
        //    {
        //            Logger.Write("JSON Exception: " + exception.Message, LogLevel.Error);
        //    }
        //}

        public void Load(string path, bool boolSkipSave = false, bool validate = false)
        {
            try
            {
                _filePath = path;

                if (File.Exists(_filePath))
                {
                    // if the file exists, load the settings
                    var input = File.ReadAllText(_filePath, Encoding.UTF8);

                    if (validate)
                    {
                        // validate Json using JsonSchema
                        Logger.Write("Validating auth.json...");
                        var jsonObj = JObject.Parse(input);
                        IList <ValidationError> errors = null;
                        bool valid;
                        try
                        {
                            valid = jsonObj.IsValid(JsonSchema, out errors);
                        }
                        catch (JSchemaException ex)
                        {
                            if (ex.Message.Contains("commercial licence") || ex.Message.Contains("free-quota"))
                            {
                                Logger.Write(
                                    "auth.json: " + ex.Message);
                                valid = false;
                            }
                            else
                            {
                                throw;
                            }
                        }
                        if (!valid)
                        {
                            if (errors != null)
                            {
                                foreach (var error in errors)
                                {
                                    Logger.Write(
                                        "auth.json [Line: " + error.LineNumber + ", Position: " + error.LinePosition + "]: " +
                                        error.Path + " " +
                                        error.Message, LogLevel.Error);
                                }
                            }

                            Logger.Write("Fix auth.json and restart NecroBot or press a key to ignore and continue...",
                                         LogLevel.Warning);
                            Console.ReadKey();
                        }
                    }

                    var settings = new JsonSerializerSettings();
                    settings.Converters.Add(new StringEnumConverter {
                        CamelCaseText = true
                    });
                    JsonConvert.PopulateObject(input, this, settings);
                }
                // Do some post-load logic to determine what device info to be using - if 'custom' is set we just take what's in the file without question
                if (DeviceConfig.DevicePlatform.Equals("ios", StringComparison.InvariantCultureIgnoreCase))
                {
                    // iOS
                    if (DeviceConfig.DevicePackageName.Equals("random", StringComparison.InvariantCultureIgnoreCase))
                    {
                        var randomAppleDeviceInfo = DeviceInfoHelper.GetRandomIosDevice();
                        SetDevInfoByDeviceInfo(randomAppleDeviceInfo);
                    }
                }
                else
                {
                    // Android
                    if (!DeviceConfig.DevicePackageName.Equals("random", StringComparison.InvariantCultureIgnoreCase) &&
                        !DeviceConfig.DevicePackageName.Equals("custom", StringComparison.InvariantCultureIgnoreCase))
                    {
                        // User requested a specific device package, check to see if it exists and if so, set it up - otherwise fall-back to random package
                        var keepDevId = DeviceConfig.DeviceId;
                        SetDevInfoByKey();
                        DeviceConfig.DeviceId = keepDevId;
                    }
                    if (DeviceConfig.DevicePackageName.Equals("random", StringComparison.InvariantCultureIgnoreCase))
                    {
                        // Random is set, so pick a random device package and set it up - it will get saved to disk below and re-used in subsequent sessions
                        var rnd    = new Random();
                        var rndIdx = rnd.Next(0, DeviceInfoHelper.AndroidDeviceInfoSets.Keys.Count - 1);
                        DeviceConfig.DevicePackageName = DeviceInfoHelper.AndroidDeviceInfoSets.Keys.ToArray()[rndIdx];
                        SetDevInfoByKey();
                    }
                }
                if (string.IsNullOrEmpty(DeviceConfig.DeviceId) || DeviceConfig.DeviceId == "8525f5d8201f78b5")
                {
                    DeviceConfig.DeviceId = RandomString(16, "0123456789abcdef");
                }
                // changed to random hex as full alphabet letters could have been flagged

                // Jurann: Note that some device IDs I saw when adding devices had smaller numbers, only 12 or 14 chars instead of 16 - probably not important but noted here anyway

                if (!boolSkipSave)
                {
                    Save(_filePath);
                }
            }
            catch (JsonReaderException exception)
            {
                if (exception.Message.Contains("Unexpected character") && exception.Message.Contains("PtcUsername"))
                {
                    Logger.Write("JSON Exception: You need to properly configure your PtcUsername using quotations.",
                                 LogLevel.Error);
                }
                else if (exception.Message.Contains("Unexpected character") && exception.Message.Contains("PtcPassword"))
                {
                    Logger.Write(
                        "JSON Exception: You need to properly configure your PtcPassword using quotations.",
                        LogLevel.Error);
                }
                else if (exception.Message.Contains("Unexpected character") &&
                         exception.Message.Contains("GoogleUsername"))
                {
                    Logger.Write(
                        "JSON Exception: You need to properly configure your GoogleUsername using quotations.",
                        LogLevel.Error);
                }
                else if (exception.Message.Contains("Unexpected character") &&
                         exception.Message.Contains("GooglePassword"))
                {
                    Logger.Write(
                        "JSON Exception: You need to properly configure your GooglePassword using quotations.",
                        LogLevel.Error);
                }
                else
                {
                    Logger.Write("JSON Exception: " + exception.Message, LogLevel.Error);
                }
            }
        }
예제 #16
0
        private void UpdateData()
        {
            switch (DeviceInfoHelper.GetDeviceFormFactorType())
            {
            case DeviceFormFactorType.Desktop:
                Di.Text = "";
                break;

            case DeviceFormFactorType.Phone:
                Di.Text = "";
                break;

            case DeviceFormFactorType.Tablet:
                Di.Text = "";
                break;

            case DeviceFormFactorType.SurfaceHub:
                Di.Text = "";
                break;

            case DeviceFormFactorType.IoT:
                Di.Text = "";
                break;

            default:
                Di.Text = "";
                break;
            }
            Dmo.Text = DeviceInfoHelper.GetDeviceModel();
            Dma.Text = DeviceInfoHelper.GetDeviceManufacturer();
            b.Text   = DeviceInfoHelper.GetBuild();

            ApplicationDataContainer _appSettings = ApplicationData.Current.LocalSettings;

            if (_appSettings.Values.ContainsKey("OfflineMode"))
            {
                if (Convert.ToBoolean(_appSettings.Values["OfflineMode"]))
                {
                    in_t.Visibility  = in_pd.Visibility = in_l.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                    in_NC.Visibility = Windows.UI.Xaml.Visibility.Visible;

                    dn_t.Visibility  = dn_pd.Visibility = dn_l.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                    dn_NC.Visibility = Windows.UI.Xaml.Visibility.Visible;
                    in_NC.Text       = dn_NC.Text = "Currently in Offline Mode. ";
                }
                else
                {
                    if (NetworkInterface.GetIsNetworkAvailable())
                    {
                        in_t.Visibility  = in_pd.Visibility = in_l.Visibility = Windows.UI.Xaml.Visibility.Visible;
                        in_NC.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                        dn_t.Visibility  = dn_pd.Visibility = dn_l.Visibility = Windows.UI.Xaml.Visibility.Visible;
                        dn_NC.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                        NewsLoad(true);
                        NewsLoad(false);
                    }
                    else
                    {
                        in_t.Visibility  = in_pd.Visibility = in_l.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                        in_NC.Visibility = Windows.UI.Xaml.Visibility.Visible;

                        dn_t.Visibility  = dn_pd.Visibility = dn_l.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                        dn_NC.Visibility = Windows.UI.Xaml.Visibility.Visible;
                    }
                }
            }
            else
            {
                if (NetworkInterface.GetIsNetworkAvailable())
                {
                    in_t.Visibility  = in_pd.Visibility = in_l.Visibility = Windows.UI.Xaml.Visibility.Visible;
                    in_NC.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                    dn_t.Visibility  = dn_pd.Visibility = dn_l.Visibility = Windows.UI.Xaml.Visibility.Visible;
                    dn_NC.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                    NewsLoad(true);
                    NewsLoad(false);
                }
                else
                {
                    in_t.Visibility  = in_pd.Visibility = in_l.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                    in_NC.Visibility = Windows.UI.Xaml.Visibility.Visible;

                    dn_t.Visibility  = dn_pd.Visibility = dn_l.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                    dn_NC.Visibility = Windows.UI.Xaml.Visibility.Visible;
                }
            }
        }