Exemple #1
0
        private void InitializeLanguages()
        {
            object VerenigingsId;

            if (ApplicationData.Current.LocalSettings.Values.TryGetValue("VerenigingsId", out VerenigingsId))
            {
                _nummer = VerenigingsId.ToString();
            }

            /*
             * var languages = new List<ApplicationLanguage>();
             *
             * foreach (var langTag in ApplicationLanguages.ManifestLanguages)
             * {
             *  var lang = new Windows.Globalization.Language(langTag);
             *  var name = (lang.NativeName == lang.DisplayName) ? lang.DisplayName : lang.DisplayName + " - " + lang.NativeName;
             *
             *  languages.Add(new ApplicationLanguage { Tag = langTag, DisplayName = name });
             * }
             *
             * ManifestLanguages = new ObservableCollection<ApplicationLanguage>(languages);
             * SelectedLanguage = ManifestLanguages.FirstOrDefault(x => x.Tag == ApplicationLanguages.PrimaryLanguageOverride);
             */
        }
Exemple #2
0
        private async Task LoadAppResources()
        {
            try
            {
                LocationServiceProxy locationService = (LocationServiceProxy)_container.Resolve <ILocationService>();
                //CardReaderService cardReaderService = (CardReaderService)_container.Resolve<ICardReaderService>();

                //List<MSRReader> readers = await cardReaderService.Connect();

                //string result = string.Empty;

                //foreach (MSRReader reader in readers)
                //{
                //    result += await cardReaderService.ListenForInput(reader);
                //    result += Environment.NewLine;
                //}

                //int length = result.Length;

                //await Task.Delay(2000);
                if (locationService.GetIsInternetConnected())
                {
                    await Task.Delay(2000);

                    Vereniging           vereniging = null;
                    object               VerenigingsId;
                    VerenigingRepository verenigingRepository = (VerenigingRepository)_container.Resolve <IVerenigingRepository>();
                    if (ApplicationData.Current.LocalSettings.Values.TryGetValue("VerenigingsId", out VerenigingsId))
                    {
                        vereniging = await verenigingRepository.GetVerenigingByNummerAsync(VerenigingsId.ToString());
                    }
                    else
                    {
                        Geoposition position = await locationService.GetLocationAsync();

                        vereniging = await verenigingRepository.GetVerenigingByLocatieAsync(position.Coordinate.Point.Position.Longitude, position.Coordinate.Point.Position.Latitude);
                    }

                    while (vereniging == null)
                    {
                    }
                    ;

                    BaanRepository baanRepository = (BaanRepository)_container.Resolve <IBaanRepository>();
                    await baanRepository.GetBanenAsync(vereniging.Id, vereniging.AccommodatieId);

                    ReserveringRepository reserveringRepository = (ReserveringRepository)_container.Resolve <IReserveringRepository>();
                    await reserveringRepository.GetReserveringenAsync();

                    SponsorRepository sponsorRepository = (SponsorRepository)_container.Resolve <ISponsorRepository>();
                    await sponsorRepository.GetSponsorsAsync(vereniging.Id);

                    try
                    {
                        verenigingRepository.UpdateStoreAgentAsync();
                    }
                    catch { }
                }

                await Task.Delay(2000);
            }
            catch (Exception ex)
            {
                string messsage = ex.Message;
                //throw;
            }
        }