Ejemplo n.º 1
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="navigationParameter">The parameter value passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested.
        /// </param>
        /// <param name="pageState">A dictionary of state preserved by this page during an earlier
        /// session.  This will be null the first time a page is visited.</param>
        protected async override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
        {
            var queryText = navigationParameter as String;
            PrayerViewModel prayerViewModel = new PrayerViewModel();
            prayerViewModel.SearchCity(queryText);
            List<Location> list = new List<Location>();
            list.Add(prayerViewModel.Location);
            this.DefaultViewModel["Results"] = list;

            // TODO: Application-specific searching logic.  The search process is responsible for
            //       creating a list of user-selectable result categories:
            //
            //       filterList.Add(new Filter("<filter name>", <result count>));
            //
            //       Only the first filter, typically "All", should pass true as a third argument in
            //       order to start in an active state.  Results for the active filter are provided
            //       in Filter_SelectionChanged below.

            var filterList = new List<Filter>();
            filterList.Add(new Filter("All", 0, true));

            // Communicate results through the view model
            this.DefaultViewModel["QueryText"] = '\u201c' + queryText + '\u201d';
            this.DefaultViewModel["CanGoBack"] = this._previousContent != null;
            this.DefaultViewModel["Filters"] = filterList;
            this.DefaultViewModel["ShowFilters"] = filterList.Count > 1;
        }
Ejemplo n.º 2
0
        internal async void PerformSetupTasks()
        {
            prayerViewModel = new PrayerViewModel();
            await prayerViewModel.LoadPrayers();

            // Tear down the extended splash screen after all operations are complete.
            RemoveExtendedSplash();
        }
Ejemplo n.º 3
0
        public SettingsNarrow(PrayerViewModel context)
        {
            this.InitializeComponent();
            DataContext = prayerViewModel = context;

            Windows.ApplicationModel.Resources.ResourceLoader loader = new Windows.ApplicationModel.Resources.ResourceLoader();

            if (prayerViewModel == null)
                prayerViewModel = new PrayerViewModel();

            CalculationMethodSettingsString.Text = loader.GetString("CalculationMethodSettingsString");
            AsrMethodSettingsString.Text = loader.GetString("AsrMethodSettingsString");
            MidnightMethodSettingsString.Text = loader.GetString("MidnightMethodSettingsString");
            MaghribAdjustementSettingsString.Text = loader.GetString("MaghribAdjustementSettingsString");
        }
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="navigationParameter">The parameter value passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested.
        /// </param>
        /// <param name="pageState">A dictionary of state preserved by this page during an earlier
        /// session.  This will be null the first time a page is visited.</param>
        protected override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
        {
            Windows.ApplicationModel.Resources.ResourceLoader loader = new Windows.ApplicationModel.Resources.ResourceLoader();

            prayerViewModel = navigationParameter as PrayerViewModel;
            if (prayerViewModel == null)
                prayerViewModel = new PrayerViewModel();

            DefaultViewModel["Countries"] = LocationService.GetCountryList();
            DefaultViewModel["DefaultLocation"] = localSettings.Values["location"];
            DefaultViewModel["MethodName"] = prayerViewModel.MethodName;
            DefaultViewModel["AsrMethod"] = prayerViewModel.AsrMethod;
            DefaultViewModel["MidnightMethod"] = prayerViewModel.MidnightMethod;
            DefaultViewModel["MaghribAdjustement"] = prayerViewModel.MaghribAdjustement;

            DefaultViewModel["CalculationMethodSettingsString"] = loader.GetString("CalculationMethodSettingsString");
            DefaultViewModel["AsrMethodSettingsString"] = loader.GetString("AsrMethodSettingsString");
            DefaultViewModel["MidnightMethodSettingsString"] = loader.GetString("MidnightMethodSettingsString");
            DefaultViewModel["MaghribAdjustementSettingsString"] = loader.GetString("MaghribAdjustementSettingsString");
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Populates the page with content passed during navigation. Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="navigationParameter">The parameter value passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested.
        /// </param>
        /// <param name="pageState">A dictionary of state preserved by this page during an earlier
        /// session.  This will be null the first time a page is visited.</param>
        protected async override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
        {
            //if (!this.isEventRegistered)
            //{
            //    SettingsPane.GetForCurrentView().CommandsRequested += onCommandsRequested;
            //    this.isEventRegistered = true;
            //}

            prayerViewModel = navigationParameter as PrayerViewModel;
            if (prayerViewModel == null)
            {
                prayerViewModel = new PrayerViewModel();
                Location location = navigationParameter as Location;
                prayerViewModel.LoadPrayersByLocation(location);
            }
            DataContext = prayerViewModel;


            //PeriodicUpdateRecurrence recurrence = PeriodicUpdateRecurrence.Daily;
            //string urlString = string.Format("http://prayerservice.net23.net/service/prayerservice.php?date={0}&latitude={1}&longitude={2}&timezone={3}&dst={4}&method={5}",
            //    DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
            //    prayerViewModel.Location.Latitude,
            //    prayerViewModel.Location.Longitude,
            //    prayerViewModel.Location.TimeZone,
            //    prayerViewModel.Location.Dst,
            //    prayerViewModel.Method.ToString());
            //TileUpdateManager.CreateTileUpdaterForApplication().StartPeriodicUpdate(new Uri(urlString), recurrence);

            //StorageFolder folder = KnownFolders.DocumentsLibrary;
            //StorageFile file = await folder.GetFileAsync("worldcitiespop.txt");
            //var stream = await file.OpenAsync(FileAccessMode.Read);
            //StreamReader sr = new StreamReader(stream.AsStream());
            //while (sr.ReadLine() != null)
            //{
            //    string line = sr.ReadLine();
            //}


        }