Exemple #1
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            MainPageWhatsNewViewModel group = value as MainPageWhatsNewViewModel;
            object result = null;

            if (group != null)
            {
                if (group.Count == 0)
                {
                    result = (SolidColorBrush)Application.Current.Resources["PhoneChromeBrush"];
                }
                else
                {
                    result = (SolidColorBrush)Application.Current.Resources["PhoneAccentBrush"];
                }
            }

            return(result);
        }
Exemple #2
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (Settings.InitialLaunchSetting)
            {
                App.Favorites = new Category {
                    CategoryTitle = AppResources.FavoritesCategoryTitleText
                };
                App.DataBaseUtility.AddCategory(App.Favorites);
                App.DataBaseUtility.SaveChangesToDB();

                // App has initialized for the first time.
                Settings.InitialLaunchSetting = false;
            }

            if (e.NavigationMode == NavigationMode.New)
            {
                ApplicationBar appBar = new ApplicationBar
                {
                    Mode = ApplicationBarMode.Minimized,
                };

                ApplicationBarMenuItem refreshMenu = new ApplicationBarMenuItem(AppResources.MainPageAppBarRefreshText);

                refreshMenu.Click += OnRefreshClick;

                appBar.MenuItems.Add(refreshMenu);

                this.ApplicationBar = appBar;
            }

            _allCategories = new MainPageAllCategoriesViewModel();

            _allFeeds = new MainPageAllFeedsViewModel();

            _whatsNewArticles = new MainPageWhatsNewViewModel();

            _featuredArticles = new MainPageFeaturedViewModel();


            // Loading categories in the database to the "All" panoramaitem's categories listbox.
            AllCategoryItems.DataContext = _allCategories;

            // Loading feeds in the database to the "All" panoramaitem's feeds longlistselector.
            AllFeedItems.DataContext = _allFeeds;

            // Loading articles in the database to the "What's new" panoramaitem's article listbox.
            WhatsNewArticleItems.DataContext = _whatsNewArticles;

            // Bind Last Updated text
            //BindingOperations.SetBinding(
            //WhatsNewArticleItems,
            //HeaderedListBox.LastUpdatedTextProperty,
            //new Binding
            //{
            //    Source = time.ToString(),
            //    Path = new PropertyPath("LastDownloadProperty"),
            //    Converter = new RelativeTimeConverter()
            //});

            //// Bind ProgressBar
            //BindingOperations.SetBinding(
            //WhatsNewArticleItems,
            //HeaderedListBox.IsIndeterminateProperty,
            //new Binding
            //{
            //    Source = WhatsNewArticles.Downloader,
            //    Path = new PropertyPath("IsDownloadingProperty")
            //});

            // Loading featured tiles
            FeaturedArticleItems.DataContext = new MainPageFeaturedViewModel();

            HubTile1.Tap += OnHubTileTapped;
            HubTile2.Tap += OnHubTileTapped;
            HubTile3.Tap += OnHubTileTapped;
            HubTile4.Tap += OnHubTileTapped;
            HubTile5.Tap += OnHubTileTapped;
            HubTile6.Tap += OnHubTileTapped;

            // Loading settings
            SettingsPanel.DataContext = App.ApplicationSettings;
        }