コード例 #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 override async void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            // TODO: Create an appropriate data model for your problem domain to replace the sample data

            //var sds = new SampleDataSource();
            if (pageState == null)
            {
                mainpageLoadingRing.IsActive    = true;
                mainpageLoadingPanel.Visibility = Windows.UI.Xaml.Visibility.Visible;

                //if (SampleDataSource._sampleDataSource.AllGroups.Count == 0)
                //{
                try
                {
                    Data.SubredditManager._subredditManager.ReadSRFromFileAsync(mainpageLoadingRing, mainpageLoadingPanel);
                    //this is on purpose. subreddit should pop up as they are created.
                    //the method is passed the elements to disable upon its' completed
                }
                catch (System.Net.Http.HttpRequestException e)
                {
                    var dia = new Windows.UI.Popups.MessageDialog("Your computer and Reddit are having connection issues. Check internet connectivity and try again.");
                    dia.ShowAsync();
                }
                //}
            }

            var sampleDataGroups = SampleDataSource.GetGroups((String)navigationParameter);

            this.DefaultViewModel["Items"] = sampleDataGroups;
        }
コード例 #2
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 override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            var queryText = navigationParameter as String;

            // 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["Filters"] = filterList;
            //this.DefaultViewModel["ShowFilters"] = filterList.Count > 1;

            var sampleDataGroups = SampleDataSource.GetGroups("AllGroups");

            this.DefaultViewModel["Results"] = sampleDataGroups.FirstOrDefault().Items;
        }
コード例 #3
0
ファイル: ItemsPage.xaml.cs プロジェクト: Vktor/ElClima
        /// <summary>
        /// Rellena la página con el contenido pasado durante la navegación. Cualquier estado guardado se
        /// proporciona también al crear de nuevo una página a partir de una sesión anterior.
        /// </summary>
        /// <param name="navigationParameter">Valor de parámetro pasado a
        /// <see cref="Frame.Navigate(Type, Object)"/> cuando se solicitó inicialmente esta página.
        /// </param>
        /// <param name="pageState">Diccionario del estado mantenido por esta página durante una sesión
        /// anterior. Será null la primera vez que se visite una página.</param>
        protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            // TODO: Crear un modelo de datos adecuado para el dominio del problema para reemplazar los datos de ejemplo
            var sampleDataGroups = SampleDataSource.GetGroups((String)navigationParameter);

            this.DefaultViewModel["Items"] = sampleDataGroups;
        }
コード例 #4
0
        /// <summary>
        /// このページには、移動中に渡されるコンテンツを設定します。前のセッションからページを
        /// 再作成する場合は、保存状態も指定されます。
        /// </summary>
        /// <param name="navigationParameter">このページが最初に要求されたときに
        /// <see cref="Frame.Navigate(Type, Object)"/> に渡されたパラメーター値。
        /// </param>
        /// <param name="pageState">前のセッションでこのページによって保存された状態の
        /// ディクショナリ。ページに初めてアクセスするとき、状態は null になります。</param>
        protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            // TODO: 問題のドメインでサンプル データを置き換えるのに適したデータ モデルを作成します
            var sampleDataGroups = SampleDataSource.GetGroups((String)navigationParameter);

            this.DefaultViewModel["Items"] = sampleDataGroups;
        }
コード例 #5
0
        /// <summary>
        /// Rellena la página con el contenido pasado durante la navegación.  Cualquier estado guardado se
        /// proporciona también al crear de nuevo una página a partir de una sesión anterior.
        /// </summary>
        /// <param name="navigationParameter">Valor de parámetro pasado a
        /// <see cref="Frame.Navigate(Type, Object)"/> cuando se solicitó inicialmente esta página.
        /// </param>
        /// <param name="pageState">Diccionario del estado mantenido por esta página durante una sesión
        /// anterior.  Será null la primera vez que se visite una página.</param>
        protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            var queryText    = navigationParameter as String;
            var fltList      = new List <Filter>();
            var TotMatchItem = 0;

            SearchResult = new Dictionary <string, IEnumerable <SampleDataItem> >();
            var groups = SampleDataSource.GetGroups("AllGroups");

            foreach (var grp in groups)
            {
                var matchItems     = grp.Items.Where(item => item.Title.ToLower().Contains(queryText));
                int NoOfMatchItems = matchItems.Count();
                if (NoOfMatchItems > 0)
                {
                    SearchResult.Add(grp.Title, matchItems);
                    fltList.Add(new Filter(grp.Title, NoOfMatchItems));
                }
                TotMatchItem += NoOfMatchItems;
            }
            fltList.Insert(0, new Filter("All", TotMatchItem, true));
            this.DefaultViewModel["QueryText"]   = '\u201c' + queryText + '\u201d';
            this.DefaultViewModel["Filters"]     = fltList;
            this.DefaultViewModel["ShowFilters"] = fltList.Count > 1;
        }
コード例 #6
0
        /// <summary>
        /// Remplit la page à l'aide du contenu passé lors de la navigation. Tout état enregistré est également
        /// fourni lorsqu'une page est recréée à partir d'une session antérieure.
        /// </summary>
        /// <param name="navigationParameter">Valeur de paramètre passée à
        /// <see cref="Frame.Navigate(Type, Object)"/> lors de la requête initiale de cette page.
        /// </param>
        /// <param name="pageState">Dictionnaire d'état conservé par cette page durant une session
        /// antérieure. Null lors de la première visite de la page.</param>
        protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            // TODO: créez un modèle de données approprié pour le domaine posant problème pour remplacer les exemples de données
            var sampleDataGroups = SampleDataSource.GetGroups((String)navigationParameter);

            this.DefaultViewModel["Groups"] = sampleDataGroups;
        }
コード例 #7
0
        /// <summary>
        /// 使用在导航过程中传递的内容填充页。在从以前的会话
        /// 重新创建页时,也会提供任何已保存状态。
        /// </summary>
        /// <param name="navigationParameter">最初请求此页时传递给
        /// <see cref="Frame.Navigate(Type, Object)"/> 的参数值。
        /// </param>
        /// <param name="pageState">此页在以前会话期间保留的状态
        /// 字典。首次访问页面时为 null。</param>
        protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            // TODO: 创建适用于问题域的合适数据模型以替换示例数据
            var sampleDataGroups = SampleDataSource.GetGroups((String)navigationParameter);

            this.DefaultViewModel["Groups"] = sampleDataGroups;
        }
コード例 #8
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 override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            var sampleDataGroups = SampleDataSource.GetGroups("");

            pageTitle.Text = navigationParameter.ToString();
            this.DefaultViewModel["Items"] = (IEnumerable <SampleDataGroup>)sampleDataGroups.Take(1);
        }
コード例 #9
0
        /// <summary>
        /// Заполняет страницу содержимым, передаваемым в процессе навигации. Также предоставляется любое сохраненное состояние
        /// при повторном создании страницы из предыдущего сеанса.
        /// </summary>
        /// <param name="navigationParameter">Значение параметра, передаваемое
        /// <see cref="Frame.Navigate(Type, Object)"/> при первоначальном запросе этой страницы.
        /// </param>
        /// <param name="pageState">Словарь состояния, сохраненного данной страницей в ходе предыдущего
        /// сеанса. Это значение будет равно NULL при первом посещении страницы.</param>
        protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            // TODO: Создание соответствующей модели данных для области проблемы, чтобы заменить пример данных
            var sampleDataGroups = SampleDataSource.GetGroups((String)navigationParameter);

            this.DefaultViewModel["Groups"] = sampleDataGroups;
        }
        /// <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)
        {
            // TODO: Create an appropriate data model for your problem domain to replace the sample data
            var sampleDataGroups = SampleDataSource.GetGroups((String)navigationParameter);

            DefaultViewModel["Groups"] = sampleDataGroups;
        }
コード例 #11
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 override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            // TODO: Create an appropriate data model for your problem domain to replace the sample data
            var sampleDataGroups = SampleDataSource.GetGroups((String)navigationParameter);

            this.DefaultViewModel["Groups"] = sampleDataGroups;

            TealiumTagger.Instance.SetGlobalVariable("SampleGlobalVar2", "global-var-value");
        }
コード例 #12
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 override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            // TODO: Create an appropriate data model for your problem domain to replace the sample data
            var sampleDataGroups = SampleDataSource.GetGroups((String)navigationParameter);

            this.DefaultViewModel["Groups"] = sampleDataGroups;

            EnableLiveTile.CreateLiveTile.ShowliveTile(true, "Gift Centre");
        }
コード例 #13
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 override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            // TODO: Create an appropriate data model for your problem domain to replace the sample data
            var sampleDataGroups = SampleDataSource.GetGroups((String)navigationParameter);

            this.DefaultViewModel["Groups"] = sampleDataGroups;

            var tipos      = DataService.DataService.LoadTipos();
            var categorias = DataService.DataService.LoadCategorias();
            var receitas   = DataService.DataService.LoadReceitas();
        }
コード例 #14
0
        protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            Random     random     = new Random();
            Uri        uri        = new Uri("ms-appx:///Assets/background_" + random.Next(1, 7) + ".jpg", UriKind.RelativeOrAbsolute);
            ImageBrush background = new ImageBrush();

            background.ImageSource        = new BitmapImage(uri);
            this.MainPage_Grid.Background = background;
            var sampleDataGroups = SampleDataSource.GetGroups("AllGroups");

            this.DefaultViewModel["Items"] = sampleDataGroups;
        }
コード例 #15
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 override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            // TODO: download tweets based on the search string

            // No tweet selected yet
            TweetDownloader.SelectedTweet = null;

            // TODO: initialize settings pane

            // Initialize the first group in the view
            var sampleDataGroups = SampleDataSource.GetGroups("AllGroups");

            this.DefaultViewModel["Groups"] = sampleDataGroups;
        }
コード例 #16
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 override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            var smallListViewItems = SampleDataSource.GetGroups("AllGroups").Where(g => g.UniqueId.Equals("Group-1")).ToList();

            // Cloning the data set over and over again to increase its size
            List <SampleDataGroup> largeListViewItems = SampleDataSource.GetGroups("AllGroups").Where(g => !g.UniqueId.Equals("Group-1")).ToList <SampleDataGroup>();

            largeListViewItems.AddRange(largeListViewItems);
            largeListViewItems.AddRange(largeListViewItems);
            largeListViewItems.AddRange(largeListViewItems);

            this.DefaultViewModel["SmallList"] = smallListViewItems;
            this.DefaultViewModel["LargeList"] = largeListViewItems;
        }
コード例 #17
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 override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
        {
            // TODO: Create an appropriate data model for your problem domain to replace the sample data
            var sampleDataGroups = SampleDataSource.GetGroups("AllGroups");

//            var sampleDataGroups = new List<SampleDataGroup>();

            for (int index = 0; index < /*((AccountDTO[]) navigationParameter).Length*/ sampleDataGroups.Count(); index++)
            {
                var accountDto = ((AccountDTO[])navigationParameter)[index];

//                new SampleDataGroup(accountDto.Id.ToString(), accountDto.Name,
//                                                         accountDto.Balance.ToString(), string.Empty,
//                                                         accountDto.PostingsCount.ToString());
                sampleDataGroups.ElementAt(index).UniqueId = accountDto.Id.ToString();
                sampleDataGroups.ElementAt(index).Title    = accountDto.Name.ToString();
                sampleDataGroups.ElementAt(index).Subtitle = accountDto.Balance.ToString();
            }

            DefaultViewModel["Groups"] = sampleDataGroups;
        }
コード例 #18
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="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            // TODO: Assign a collection of bindable groups to this.DefaultViewModel["Groups"]


            // Read data from a simple setting
            if (Connectivity.Connectivity.ConnectedToTheInternet() == false)
            {
                if (ID != null)
                {
                    // Create a simple setting
                    Windows.Storage.ApplicationData.Current.LocalSettings.Values.Remove("Popup");
                    MessageDialog dialog = new MessageDialog("Δεν υπάρχει ενεργή σύνδεση στο διαδίκτυο. Μπορείτε να δείτε τα δεδομένα που είναι αποθηκευμένα σην εφαρμογή.", "Σφάλμα σύνδεσης");
                    await dialog.ShowAsync();
                }
            }

            var sampleDataGroups = SampleDataSource.GetGroups("AllGroups");

            this.DefaultViewModel["Groups"] = sampleDataGroups;
            EnableLiveTile.CreateLiveTile.ShowliveTile();
        }
コード例 #19
0
        /// <summary>
        /// Invoked when a filter is selected using the ComboBox in snapped view state.
        /// </summary>
        /// <param name="sender">The ComboBox instance.</param>
        /// <param name="e">Event data describing how the selected filter was changed.</param>
        void Filter_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // Determine what filter was selected
            var selectedFilter = e.AddedItems.FirstOrDefault() as Filter;

            if (selectedFilter != null)
            {
                // Mirror the results into the corresponding Filter object to allow the
                // RadioButton representation used when not snapped to reflect the change
                selectedFilter.Active = true;

                string lowerQueryText   = _queryText.ToLower();
                var    matchingArticles =
                    from g in SampleDataSource.GetGroups("AllGroups")
                    from a in g.Items
                    where a.Title.ToLower().Contains(lowerQueryText) ||
                    a.Description.ToLower().Contains(lowerQueryText) ||
                    a.Content.ToLower().Contains(lowerQueryText)
                    select a;


                this.DefaultViewModel["Results"] = matchingArticles.ToList();

                // Ensure results are found
                object      results;
                ICollection resultsCollection;
                if (this.DefaultViewModel.TryGetValue("Results", out results) &&
                    (resultsCollection = results as ICollection) != null &&
                    resultsCollection.Count != 0)
                {
                    VisualStateManager.GoToState(this, "ResultsFound", true);
                    return;
                }
            }

            // Display informational text when there are no search results.
            VisualStateManager.GoToState(this, "NoResultsFound", true);
        }
コード例 #20
0
 void ISupportSaveLoadState.LoadState(object navigationParameter, PageStateStorage pageState)
 {
     Groups = SampleDataSource.GetGroups((string)navigationParameter);
 }