Exemplo n.º 1
0
        public MainPage()
        {
            InitializeComponent();
            BindingContext      = this;
            btnActServ.Clicked += BtnActServ_Clicked;
            //  chVoz.CheckedChanged += ChVoz_CheckedChanged;
            chVoz.Toggled           += ChVoz_Toggled;
            btnConfigLector.Clicked += BtnConfigLecto_Clicked;


            if (Preferences.ContainsKey("LeerTodos"))
            {
                bool estado_contactos_lectura = Preferences.Get("LeerTodos", true);
                DependencyService.Get <XamarinAndroidGlobal>().setDatos(estado_contactos_lectura, "CONTACTOS");
            }
            else
            {
                DependencyService.Get <XamarinAndroidGlobal>().setDatos(true, "CONTACTOS");
            }


            if (Preferences.ContainsKey("CondicionDispositivo"))
            {
                bool estado_dispositivos_lectura = Preferences.Get("CondicionDispositivo", true);
                DependencyService.Get <XamarinAndroidGlobal>().setDatos(estado_dispositivos_lectura, "DISPOSITVOS");
            }
            else
            {
                DependencyService.Get <XamarinAndroidGlobal>().setDatos(false, "DISPOSITVOS");
            }

            if (Preferences.ContainsKey("EstadoVoz"))
            {
                //  chVoz.IsChecked = Preferences.Get("EstadoVoz", false);
                chVoz.IsToggled = Preferences.Get("EstadoVoz", false);
                DependencyService.Get <XamarinAndroidGlobal>().ADVoiceReaderWhats(chVoz.IsToggled);
            }
            else
            {
                // Preferences.Set("EstadoVoz", chVoz.IsChecked);
                Preferences.Set("EstadoVoz", chVoz.IsToggled);
            }
        }
Exemplo n.º 2
0
        public bool AddItem(Contact item)
        {
            bool isGood = false;

            try
            {
                item.CreateDate = DateTime.Now;
                bool bItems = Preferences.ContainsKey(ContactKeyID);
                if (bItems)
                {
                    string ijson = Preferences.Get(ContactKeyID, "");
                    var    list  = JsonConvert.DeserializeObject <List <Contact> >(ijson);
                    //list.Add(item);
                    bool    bAlreadyExist = false;
                    Contact existContact  = list.Where(x => x.Email == item.Email).FirstOrDefault();
                    if (existContact != null)
                    {
                        bAlreadyExist = true;
                    }
                    if (bAlreadyExist == false)
                    {
                        list.Add(item);
                        string jsonEnum = JsonConvert.SerializeObject(list);
                        Preferences.Set(ContactKeyID, jsonEnum);
                    }
                    isGood = true;
                }
                else
                {
                    //first one so add it.
                    List <Contact> list = new List <Contact>();
                    list.Add(item);
                    string jsonItem = JsonConvert.SerializeObject(list);
                    Preferences.Set(ContactKeyID, jsonItem);
                    isGood = true;
                }
            }
            catch (Exception ex)
            {
                string err = ex.Message;
            }
            return(isGood);
        }
        private void SetupSettingsUI()
        {
            ThemePicker.ItemsSource = SettingsConstants.UIThemes;

            LanguagePicker.ItemsSource = new List <string>(SettingsConstants.SupportedLanguages.Values);

            var languageKey = string.Empty;

            if (Preferences.ContainsKey(SettingsConstants.UserLanguageSetting) && !string.IsNullOrEmpty(Preferences.Get(SettingsConstants.UserLanguageSetting, null)))
            {
                languageKey = Preferences.Get(SettingsConstants.UserLanguageSetting, null);
            }
            else if (SettingsConstants.SupportedLanguages.ContainsKey(CultureInfo.CurrentCulture.TwoLetterISOLanguageName))
            {
                languageKey = CultureInfo.CurrentCulture.TwoLetterISOLanguageName;
            }

            LanguagePicker.SelectedItem = SettingsConstants.SupportedLanguages[languageKey];
        }
Exemplo n.º 4
0
        //Sets the value of the time if app crashed or match was restored
        private void timerValueSetter()
        {
            if (!Preferences.ContainsKey("lastItemPicked"))
            {
                Preferences.Set("lastItemPicked", 0);
                Preferences.Set("lastItemDroppped", 0);
                Preferences.Set("tempEventString", "");
                Preferences.Set("tempMatchEvents", "");
            }
            //else if (Preferences.Get ("lastItemPicked", 0) == 0 || Preferences.Get ("lastItemDropped", 0) == 0) { } else if (Preferences.Get ("lastItemDroppped", 0) > Preferences.Get ("lastItemDropped", 0)) {
            //    cubePicked.Text = ConstantVars.ITEM_DROPPED_TEXT_LIVE;
            //}

            if (!Preferences.ContainsKey("timerValue"))
            {
                Preferences.Set("timerValue", (int)timerValue);
            }
            else if (Preferences.ContainsKey("timerValue") && firstTimerStart == true)
            {
                timerValue       = Preferences.Get("timerValue", 0);
                timeSlider.Value = timerValue;
                timerText.Text   = timeToString((int)timerValue);
                firstTimerStart  = false;
            }
            try {
                try {
                    events = MatchFormat.JSONEventsToObject(JObject.Parse(Preferences.Get("tempMatchEvents", "")));
                    if (events != null && events.Count > 0)
                    {
                        lastEvent = events[events.Count - 1];
                    }
                } catch (JsonReaderException) { }
                if (Object.ReferenceEquals(events, null))
                {
                    events = new List <MatchFormat.Data>();
                }
            } catch (InvalidCastException) { }
            setEventButtons(isTimerRunning);
            int balls = calculateCurrentBalls();

            currentCellAmt.Text = balls.ToString();
            //setCubeButton ();
        }
Exemplo n.º 5
0
        //Sets the value of the time if app crashed or match was restored
        private void timerValueSetter()
        {
            if (!Preferences.ContainsKey("lastItemPicked"))
            {
                Preferences.Set("lastItemPicked", 0);
                Preferences.Set("lastItemDroppped", 0);
                Preferences.Set("tempEventString", "");
                Preferences.Set("tempMatchEvents", "");
                Application.Current.SavePropertiesAsync();
            }
            else if (Preferences.Get("lastItemPicked", 0) == 0 || Preferences.Get("lastItemDropped", 0) == 0)
            {
            }
            else if (Preferences.Get("lastItemDroppped", 0) > Preferences.Get("lastItemDropped", 0))
            {
                cubePicked.Image = ConstantVars.ITEM_DROPPED_IMAGE_LIVE;
                cubePicked.Text  = ConstantVars.ITEM_DROPPED_TEXT_LIVE;
            }

            if (!Preferences.ContainsKey("timerValue"))
            {
                Preferences.Set("timerValue", (int)timerValue);
            }
            else if (Preferences.ContainsKey("timerValue") && firstTimerStart == true)
            {
                timerValue       = Preferences.Get("timerValue", 0);
                timeSlider.Value = timerValue;
                timerText.Text   = timeToString((int)timerValue);
                firstTimerStart  = false;
            }
            try {
                try {
                    events = MatchFormat.JSONEventsToObject(JObject.Parse(Preferences.Get("tempMatchEvents", "")));
                } catch (JsonReaderException) { }
                if (Object.ReferenceEquals(events, null))
                {
                    events = new List <MatchFormat.Data> ();
                }
            } catch (InvalidCastException) { }
            setEventButtons(isTimerRunning);
            setCubeButton();
        }
Exemplo n.º 6
0
        public ItemsViewModel()
        {
            if (Preferences.ContainsKey("serverUrl"))
            {
                _noteService = new ApiService(Preferences.Get("serverUrl", ""), "Note");
            }
            Title            = "Browse Notes";
            Notes            = new ObservableCollection <NoteGetModel>();
            LoadNotesCommand = new Command(async() => await ExecuteLoadNotesCommand());

            MessagingCenter.Subscribe <CloudSyncPage>(this, "LogedIn", (obj) => _noteService = new ApiService(Preferences.Get("serverUrl", ""), "Note"));

            MessagingCenter.Subscribe <NewNotePage, NoteInsertModel>(this, "AddNote", async(obj, note) =>
            {
                try
                {
                    var newNote = note as NoteInsertModel;
                    if (string.IsNullOrEmpty(newNote.Title))
                    {
                        newNote.Title = "#";
                    }
                    await NoteService.Add(newNote);
                }
                catch (Exception ex)
                {
                    await Application.Current.MainPage.DisplayAlert("Error", ex.Message, "OK");
                }
            });

            MessagingCenter.Subscribe <NoteDetailPage, NoteUpdateModel>(this, "UpdateNote", async(obj, note) =>
            {
                try
                {
                    var updatedNote = note as NoteUpdateModel;
                    await NoteService.Update(updatedNote);
                }
                catch (Exception ex)
                {
                    await Application.Current.MainPage.DisplayAlert("Error", ex.Message, "OK");
                }
            });
        }
Exemplo n.º 7
0
 private void NeedToLoadFavorite()
 {
     if (Preferences.ContainsKey("boolFavorite"))
     {
         if (Preferences.Get("boolFavorite", false))
         {
             return;
         }
         else
         {
             Preferences.Set("JSONFavorite", API.GetFavoritesJSON(Preferences.Get("idUser", 0)));
             Preferences.Set("boolFavorite", true);
         }
     }
     else
     {
         Preferences.Set("JSONFavorite", API.GetFavoritesJSON(Preferences.Get("idUser", 0)));
         Preferences.Set("boolFavorite", true);
     }
 }
Exemplo n.º 8
0
 private void NeedToLoadReservations()
 {
     if (Preferences.ContainsKey("boolReservation"))
     {
         if (Preferences.Get("boolReservation", false))
         {
             return;
         }
         else
         {
             Preferences.Set("JSONReservation", API.GetReservationsJSON(Preferences.Get("idUser", 0)));
             Preferences.Set("boolReservation", true);
         }
     }
     else
     {
         Preferences.Set("JSONReservation", API.GetReservationsJSON(Preferences.Get("idUser", 0)));
         Preferences.Set("boolReservation", true);
     }
 }
Exemplo n.º 9
0
        public override Task InitializeAsync(object parameter)
        {
            if (!Preferences.ContainsKey(Constants.SHOWN_ONBOARDING))
            {
                Preferences.Set(Constants.SHOWN_ONBOARDING, true);
                this.navigationService.GoToLoginFlow();

                return(Task.CompletedTask);
            }

            if (Preferences.ContainsKey(Constants.IS_USER_LOGGED_IN) && Preferences.Get(Constants.IS_USER_LOGGED_IN, false) == true)
            {
                this.navigationService.GoToMainFlow();

                return(Task.CompletedTask);
            }

            this.navigationService.GoToLoginFlow();
            return(this.navigationService.InsertAsRoot <LoginViewModel>());
        }
Exemplo n.º 10
0
        public void ResetListViewSources()
        {
            List <Withdrawl> withdrawls = DB.conn.Table <Withdrawl>().ToList();

            double totalWithdrawls = 0;

            foreach (Withdrawl withdrawl in withdrawls)
            {
                totalWithdrawls += withdrawl.Amount;
            }

            if (!Preferences.ContainsKey("CurrentBalance"))
            {
                Preferences.Set("CurrentBalance", 0.0);
            }
            Preferences.Set("CurrentBalance", (Preferences.Get("TotalSaved", 0.0) - totalWithdrawls));

            bankLabel.Text            = "$" + Preferences.Get("CurrentBalance", 0.0);
            withdrawlList.ItemsSource = withdrawls;
        }
Exemplo n.º 11
0
        public void RefreshFavoris()
        {
            if (Preferences.ContainsKey("favoris"))
            {
                Favoris = JsonConvert.DeserializeObject <List <Message> >(Preferences.Get("favoris", null));
                favorisListView.ItemsSource   = Favoris;
                favorisListView.HeightRequest = (Favoris.Count * 100) / 2;
                favorisListView.IsVisible     = true;
            }
            else
            {
                Debug.WriteLine("Empty");
                favorisListView.IsVisible = false;
            }

            if (Favoris.Count == 0)
            {
                favorisListView.IsVisible = false;
            }
        }
Exemplo n.º 12
0
 public Settings()
 {
     InitializeComponent();
     //toggled gets set here so that the toggled event doesnt get fired on initial page load
     if (Preferences.ContainsKey("DisplayEUDate"))
     {
         DisplayEUDate.IsToggled = Preferences.Get("DisplayEUDate", false);
         DisplayEUDate.Toggled  += DisplayEUDate_Toggled;
     }
     if (Preferences.ContainsKey("HighlightScores"))
     {
         HighlightScores.IsToggled = Preferences.Get("HighlightScores", false);
         HighlightScores.Toggled  += HighlightScores_Toggled;
     }
     if (Preferences.ContainsKey("SeparateBySeason"))
     {
         SeparateBySeason.IsToggled = Preferences.Get("SeparateBySeason", false);
         SeparateBySeason.Toggled  += SeparateBySeason_Toggled;
     }
 }
Exemplo n.º 13
0
        public static void getPreferences()
        {
            if (Preferences.ContainsKey("Blackpreference"))
            {
                blackpreference = true;
            }

            if (Preferences.ContainsKey("Asianpreference"))
            {
                asianpreference = true;
            }

            if (Preferences.ContainsKey("NativeAmericanpreference"))
            {
                nativeamericanpreference = true;
            }
            if (Preferences.ContainsKey("Latinopreference"))
            {
                latinopreference = true;
            }
        }
        private async void TouchIDTapped(object sender, EventArgs e)
        {
            try
            {
                if (Preferences.ContainsKey("QuickAccess"))
                {
                    var request = new AuthenticationRequestConfiguration("Authentication", "Authenticate to Login.");
                    var result  = await CrossFingerprint.Current.AuthenticateAsync(request);

                    if (result.Authenticated)
                    {
                        txtEmail.Text = await SecureStorage.GetAsync("U_Email");

                        txtPassword.Text = await SecureStorage.GetAsync("U_Password");

                        Login(true);
                    }
                }
            }
            catch { }
        }
Exemplo n.º 15
0
        public Task <IEnumerable <T> > GetItems()
        {
            if (!Preferences.ContainsKey(StringConstants.STORAGE))
            {
                Preferences.Set(StringConstants.STORAGE, null);
            }

            var storage = Preferences.Get(StringConstants.STORAGE, null);

            if (storage != null)
            {
                _items = JsonConvert.DeserializeObject <IEnumerable <T> >(storage);
            }
            else
            {
                _items = new List <T>();
            }

            // just added task.run
            return(Task.Run(() => _items));
        }
Exemplo n.º 16
0
        private static void MigrateSettingsIfNeeded()
        {
            if (VersionTracking.IsFirstLaunchForCurrentBuild &&
                GetBuildVersion(VersionTracking.CurrentVersion) >= VersionConstants.NewSettingsVersion &&
                GetBuildVersion(VersionTracking.CurrentBuild) >= VersionConstants.NewSettingsBuild &&
                VersionTracking.PreviousBuild == null &&
                VersionTracking.PreviousVersion == null &&
                (Preferences.ContainsKey(PreferenceConstants.SoberDate) ||
                 Preferences.ContainsKey(PreferenceConstants.NotificationsEnabled)))
            {
                var settingsService = Startup.ServiceProvider.GetService <ISettingsService>();
                settingsService.MigrateOldPreferences();

                if (settingsService.Get(PreferenceConstants.NotificationsEnabled, false))
                {
                    var notifService = Startup.ServiceProvider.GetService <INotificationService>();
                    var notifTime    = settingsService.Get(PreferenceConstants.NotificationTime, DateTime.MinValue);
                    notifService.ScheduleDailyNotification(notifTime);
                }
            }
        }
Exemplo n.º 17
0
        public Cravings()
        {
            InitializeComponent();
            if (!Preferences.ContainsKey("CravingsCreated")) { 
                Preferences.Set("CravingsCreated", true);

                int i = 0;
                foreach (string craving in cravingsString)
                {
                    CravingsClass newCraving = new CravingsClass
                    {
                        DisplayName = craving,
                        Hex = "#" + string.Format("{0:X2}{1:X2}{2:X2}", colors[i].Red, colors[i].Green, colors[i].Blue),
                        Count = 0
                    };
                    DB.conn2.Insert(newCraving);
                i++;
                }
            }
            ResetListViewSources();
        }
Exemplo n.º 18
0
        private void InitCommands()
        {
            OpenSettingsCommand = new Command(() =>
            {
            });

            UpdateUserCommand = new Command(() =>
            {
                _bwUpdater.RunWorkerAsync();
            });

            LogoutCommand = new Command(() =>
            {
                App.CurrentUser = null;

                if (Preferences.ContainsKey("username"))
                {
                    Preferences.Clear("username");
                }

                if (Preferences.ContainsKey("password"))
                {
                    Preferences.Clear("password");
                }

                Application.Current.MainPage.Navigation.PushModalAsync(new AuthorizationPage());
            });

            OpenDuckPopupCommand = new Command(() =>
            {
                var widthPopup = _ownPage.Width - 30;

                var sizePopup = new Size(widthPopup, widthPopup * 0.75);

                _ownPage.Navigation.ShowPopup(new DuckPopup
                {
                    Size = sizePopup
                });
            });
        }
Exemplo n.º 19
0
        protected override void OnStart()
        {
            //Directly open the device web page if connected to WLED Access Point
            if (NetUtility.IsConnectedToWledAP())
            {
                listview.OpenAPDeviceControlPage();
            }

            // Load device list from Preferences
            if (Preferences.ContainsKey("wleddevices"))
            {
                string devices = Preferences.Get("wleddevices", "");
                if (!devices.Equals(""))
                {
                    ObservableCollection <WLEDDevice> fromPreferences = Serialization.Deserialize(devices);
                    if (fromPreferences != null)
                    {
                        listview.DeviceList = fromPreferences;
                    }
                }
            }
        }
Exemplo n.º 20
0
        private void LoadEvents(int type, bool updateRequested)
        {
            Device.BeginInvokeOnMainThread(async() =>
            {
                IsBusy = true;
                try
                {
                    cts.Token.ThrowIfCancellationRequested();
                    List <Models.Event> events = new List <Models.Event>();
                    if (Preferences.ContainsKey("events_key"))
                    {
                        var eventsSerialized = Preferences.Get("events_key", "null");
                        if (eventsSerialized is null || eventsSerialized.Length <= 0 || updateRequested)
                        {
                            //events = await App.EventManager.GetDataListAsync("event/type=" + type);

                            events           = await App.EventManager.GetDataListAsync("event");
                            eventsSerialized = JsonConvert.SerializeObject(events, Newtonsoft.Json.Formatting.None,
                                                                           new JsonSerializerSettings
                            {
                                NullValueHandling = NullValueHandling.Ignore
                            });
                            Preferences.Set("events_key", eventsSerialized);
                            events = events.FindAll(x => x.Type == type);
                        }
                        else
                        {
                            events = JsonConvert.DeserializeObject <List <Models.Event> >(eventsSerialized);
                            events = events.FindAll(x => x.Type == type);
                        }

                        foreach (var item in events)
                        {
                            EventsCollection.Add(item);
                        }
                        //EventsCollection = new ObservableCollection<Models.Event>(events);
                    }
                    IsBusy = false;
                } catch (OperationCanceledException) { IsBusy = false; }
        public App()
        {
            Device.SetFlags(new string[] { "MediaElement_Experimental", "RadioButton_Experimental", "Shell_UWP_Experimental", "Visual_Experimental", "CollectionView_Experimental", "FastRenderers_Experimental" });
            InitializeComponent();

            if (Preferences.Get("AutoLogin", false))
            {
                User user = new User
                {
                    Username     = Preferences.Get("username", String.Empty),
                    PasswordSha1 = Preferences.Get("password", string.Empty)
                };

                LoginService loginService = new LoginService();

                if (!loginService.Login(user))
                {
                    Preferences.Set("AutoLogin", false);
                }
            }

            if (Preferences.ContainsKey("lang"))
            {
                LanguageManager.SetLanguage(Preferences.Get("lang", "en"));
                Current.MainPage = new NavigationPage(new HomePage())
                {
                    BarBackgroundColor = StaticVariables.NavBarBackgroundColor,
                    BarTextColor       = StaticVariables.NavBarTextColor,
                };
            }
            else
            {
                Current.MainPage = new NavigationPage(new SelectLanguagePage())
                {
                    BarBackgroundColor = StaticVariables.NavBarBackgroundColor,
                    BarTextColor       = StaticVariables.NavBarTextColor,
                };
            }
        }
Exemplo n.º 22
0
 public void SetFavorite(ProductViewModel product, bool favorite)
 {
     if (favorite)
     {
         if (Preferences.ContainsKey(nameof(product.Favorite), nameof(ProductManager)))
         {
             var origin = Preferences.Get(nameof(product.Favorite), 0, nameof(ProductManager));
             foreach (var p in Products.Where(x => x.Favorite))
             {
                 p.Favorite = false;
             }
         }
         Preferences.Set(nameof(product.Favorite), product._model.Id, nameof(ProductManager));
         _favorite = product;
     }
     else
     {
         Preferences.Remove(nameof(product.Favorite), nameof(ProductManager));
         _favorite = null;
     }
     product.Favorite = favorite;
 }
Exemplo n.º 23
0
        public SettingsPage()
        {
            InitializeComponent();
            if (!Preferences.ContainsKey("Gender"))
            {
                Preferences.Set("Gender", "Female");
            }
            if (!Preferences.ContainsKey("Unit"))
            {
                Preferences.Set("Unit", false);
            }
            bool b = Preferences.Get("Unit", false);

            isKilometers.IsToggled = Preferences.Get("Unit", false);
            if (Preferences.Get("Gender", "Female") == "Female")
            {
                gender.SelectedIndex = 0;
            }
            else
            {
                gender.SelectedIndex = 1;
            }
        }
 private void ReconcileTheme()
 {
     if (Preferences.ContainsKey("theme"))
     {
         var theme = Preferences.Get("theme", "");
         if (theme != null)
         {
             ICollection <ResourceDictionary> mergedDictionaries = Application.Current.Resources.MergedDictionaries;
             mergedDictionaries.Clear();
             if (theme == "Dark")
             {
                 mergedDictionaries.Add(new DarkTheme());
             }
             else
             {
                 mergedDictionaries.Add(new LightTheme());
             }
         }
     }
     else
     {
     }
 }
Exemplo n.º 25
0
        public Vulturii_negri()
        {
            InitializeComponent();
            BindingContext = this;
            DateTime currentdate = DateTime.Now;
            bool     haskey      = Preferences.ContainsKey("Vulturii_negri");

            if (haskey)
            {
                string date = Preferences.Get("Vulturii_negri", "");
                if (date != null)
                {
                    dt = Convert.ToDateTime(date);
                    TimeSpan timediff = currentdate - dt;

                    if (timediff.Days < 1)
                    {
                        myBtn.IsEnabled = false;
                        DisplayAlert("VOTAT", "URMATORUL VOT POSIBIL: " + dt.AddDays(1).ToShortDateString() + " LA ORA: " + dt.AddDays(1).ToShortTimeString(), "OK");
                    }
                }
            }
        }
Exemplo n.º 26
0
        /// <summary>
        /// Get new asset list
        /// </summary>
        /// <param name="assetList">Existing asset list</param>
        /// <param name="bundleId">Bundle ID</param>
        /// <returns></returns>
        public async Task <IRestResponse <AssetListAPIResponse> > SendAssetList(string assetList, int bundleId, FGORegion region)
        {
            var request = new RestRequest("translate/update-asset-list")
            {
                Method = Method.POST
            };

            request.AddHeader("Content-type", "application/json");
            var sendObject = new Dictionary <string, object>()
            {
                { "data", assetList },
                { "group", bundleId },
                { "region", (int)region }
            };

            if (Preferences.ContainsKey("AuthKey"))
            {
                sendObject.Add("key", Preferences.Get("AuthKey", ""));
            }
            request.AddParameter("application/json; charset=utf-8", SimpleJson.SerializeObject(sendObject), ParameterType.RequestBody);

            return(await ExecuteAsync <AssetListAPIResponse>(request));
        }
Exemplo n.º 27
0
        public List <Object> GetValuesLogin(string keyUsuario, string keyHoraLogin, string guid)
        {
            var lista = new List <Object>();

            if (Preferences.ContainsKey(keyUsuario))
            {
                var usuario = Preferences.Get(keyUsuario, "Supervisor");
                lista.Add(usuario);
            }

            if (Preferences.ContainsKey(keyHoraLogin))
            {
                var horaFecha = Preferences.Get(keyHoraLogin, DateTime.MinValue.Ticks);
                lista.Add(horaFecha);
            }
            if (Preferences.ContainsKey(guid))
            {
                var idUsuario = Preferences.Get(guid, "0");
                lista.Add(idUsuario);
            }

            return(lista);
        }
Exemplo n.º 28
0
        public App()
        {
            InitializeComponent();

            if (!Preferences.ContainsKey("guid"))
            {
                Preferences.Set("guid", Guid.NewGuid().ToString());
            }

            if (!Preferences.ContainsKey("volume"))
            {
                Preferences.Set("volume", 0.5);
            }

            if (!Preferences.ContainsKey("language"))
            {
                Preferences.Set("language", 0);
            }

            tour = new pnTour(Preferences.Get("language", 0));

            MainPage = new NavigationPage(new MainPage( ));
        }
Exemplo n.º 29
0
        private void setDefaultPreferencesValues()
        {
            if (!Preferences.ContainsKey("RenderingMode"))
            {
                Preferences.Set("RenderingMode", 0);
            }
            //Xamarin.Forms.DependencyService.Get<ILocalize>().SetLocale(ci);

            //Preferences.Set("Language", "ru");

            //if (Preferences.ContainsKey("doubleBuffering"))
            //    Preferences.Set("doubleBuffering", true);

            if (!Preferences.ContainsKey("TipViewShow"))
            {
                Preferences.Set("TipViewShow", true);
            }

            if (!Preferences.ContainsKey("SamplesLoad"))
            {
                Preferences.Set("SamplesLoad", true);
            }
        }
        protected override void OnAppearing()
        {
            popNav = false;
            string comp = Preferences.Get(ConstantVars.CURRENT_EVENT_NAME, "Error in name");

            try
            {
                comp = App.eventsList[comp];
            }
            catch { }
            currComp.Text = comp;
            if (!Preferences.ContainsKey(ConstantVars.APP_DATA_STORAGE))
            {
                Preferences.Set(ConstantVars.APP_DATA_STORAGE, "");
                Preferences.Set("tempMatchEvents", "");
            }
            if (!Preferences.ContainsKey("newAppear"))
            {
            }                                               //DEBUG PURPOSES
            else if (Preferences.Get("newAppear", 0) == 1)
            {
                Preferences.Set("appState", 1);
                Preferences.Set("timerValue", 0);
                Preferences.Set("newAppear", 0);
                Preferences.Set("tempMatchEvents", "");
                populateMatchesList();
            }
            else if (Preferences.Get("newAppear", 0) == 0)
            {
                Preferences.Set("appState", 0);
                Preferences.Set("timerValue", 0);
                //Preferences.Set ("teamStart", "");
                Preferences.Set("newAppear", 0);
                Preferences.Set("tempMatchEvents", "");
            }
            populateMatchesList();
        }