Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

cleanup - sent to aaron

  • Loading branch information...
commit 78fe69fb0be4101175ea316c7930b62701bb4ce6 1 parent ba12a1a
Chris Koenig authored
20 Localization/AppResources.Designer.cs
View
@@ -124,6 +124,15 @@ public class AppResources {
}
/// <summary>
+ /// Looks up a localized string similar to About RssStarterKit text.
+ /// </summary>
+ public static string MainView_About_Body {
+ get {
+ return ResourceManager.GetString("MainView_About_Body", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to About RssStarterKit.
/// </summary>
public static string MainView_About_Title {
@@ -142,6 +151,15 @@ public class AppResources {
}
/// <summary>
+ /// Looks up a localized string similar to NETWORK UNAVAILABLE.
+ /// </summary>
+ public static string MainView_NetworkErrorMessage {
+ get {
+ return ResourceManager.GetString("MainView_NetworkErrorMessage", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to News Feeds.
/// </summary>
public static string MainView_Title {
@@ -151,7 +169,7 @@ public class AppResources {
}
/// <summary>
- /// Looks up a localized string similar to The network is not currently available - some features of the application will be disabled until network is restored. \n\nPress &quot;back&quot; to continue using cached data, or exit the application and try again later..
+ /// Looks up a localized string similar to The network is not currently available - some features of the application will be disabled until network is restored. Press the &quot;back&quot; to continue using cached data, or exit the application and try again later..
/// </summary>
public static string NetworkNotAvailableMessage {
get {
10 Localization/AppResources.resx
View
@@ -145,6 +145,10 @@
<value>The feed item you selected item has no content. Please visit the website using the button below to read this post.</value>
<comment>Used on the ItemView when the selected feed item has no content</comment>
</data>
+ <data name="MainView_About_Body" xml:space="preserve">
+ <value>About RssStarterKit text</value>
+ <comment>Used on the MainView in the AboutBox</comment>
+ </data>
<data name="MainView_About_Title" xml:space="preserve">
<value>About RssStarterKit</value>
<comment>about appbar menu on MainView</comment>
@@ -153,12 +157,16 @@
<value>about</value>
<comment>about menu on the RssFeedView Application Bar</comment>
</data>
+ <data name="MainView_NetworkErrorMessage" xml:space="preserve">
+ <value>NETWORK UNAVAILABLE</value>
+ <comment>Used on the MainView for displaying status of network</comment>
+ </data>
<data name="MainView_Title" xml:space="preserve">
<value>News Feeds</value>
<comment>Used on the MainView for the Title panel</comment>
</data>
<data name="NetworkNotAvailableMessage" xml:space="preserve">
- <value>The network is not currently available - some features of the application will be disabled until network is restored. \n\nPress "back" to continue using cached data, or exit the application and try again later.</value>
+ <value>The network is not currently available - some features of the application will be disabled until network is restored. Press the "back" to continue using cached data, or exit the application and try again later.</value>
<comment>Used to display an error message when the application is launched if there is no network.</comment>
</data>
<data name="NoDataCollectedConverterText" xml:space="preserve">
10 RssStarterKit.csproj
View
@@ -50,6 +50,13 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="Coding4Fun.Phone.Controls">
+ <HintPath>packages\Coding4Fun.Phone.Controls.Complete.1.5.1\lib\Coding4Fun.Phone.Controls.dll</HintPath>
+ </Reference>
+ <Reference Include="Coding4Fun.Phone.Controls.Toolkit">
+ <HintPath>packages\Coding4Fun.Phone.Controls.Complete.1.5.1\lib\Coding4Fun.Phone.Controls.Toolkit.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
<Reference Include="GalaSoft.MvvmLight.Extras.WP71, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\MvvmLightLibsPreview.4.1.0\lib\sl4-windowsphone71\GalaSoft.MvvmLight.Extras.WP71.dll</HintPath>
</Reference>
@@ -60,7 +67,7 @@
<Reference Include="Microsoft.Phone" />
<Reference Include="Microsoft.Phone.Controls" />
<Reference Include="Microsoft.Phone.Controls.Toolkit, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b772ad94eb9ca604, processorArchitecture=MSIL">
- <HintPath>packages\SilverlightToolkitWP.4.2011.12.14\lib\sl4-windowsphone71\Microsoft.Phone.Controls.Toolkit.dll</HintPath>
+ <HintPath>packages\Coding4Fun.Phone.Controls.Complete.1.5.1\lib\Microsoft.Phone.Controls.Toolkit.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Phone.Interop" />
<Reference Include="Microsoft.Practices.ServiceLocation, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
@@ -93,6 +100,7 @@
<DependentUpon>AppResources.resx</DependentUpon>
</Compile>
<Compile Include="Localization\Localization.cs" />
+ <Compile Include="Messages\NetworkUnavailableMessage.cs" />
<Compile Include="Models\RssFeed.cs" />
<Compile Include="Models\RssItem.cs" />
<Compile Include="Models\Settings.cs" />
26 ViewModels/MainViewModel.cs
View
@@ -14,6 +14,7 @@
using RssStarterKit.Configuration;
using RssStarterKit.Helpers;
using RssStarterKit.Localization;
+using RssStarterKit.Messages;
using RssStarterKit.Models;
namespace RssStarterKit.ViewModels
@@ -29,9 +30,27 @@ public class MainViewModel : ViewModelBase
private ObservableCollection<RssFeed> _Feeds;
Settings settings;
private readonly static string NS_ATOM = "http://www.w3.org/2005/Atom";
+ private Visibility _NetworkErrorVisibility;
#region Properties
+ public Visibility NetworkErrorVisibility
+ {
+ get
+ {
+ var app = (App)Application.Current;
+ return app.IsNetworkAvailable ? Visibility.Collapsed : Visibility.Visible;
+ // return _NetworkErrorVisibility;
+ }
+ //set
+ //{
+ // if (_NetworkErrorVisibility == value)
+ // return;
+ // _NetworkErrorVisibility = value;
+ // RaisePropertyChanged(() => NetworkErrorVisibility);
+ //}
+ }
+
public bool PreviewEnabled
{
get
@@ -256,6 +275,13 @@ private void LoadSelectedFeed()
else
{
// refresh feed from network
+ var app = (App)App.Current;
+ if (!app.IsNetworkAvailable)
+ {
+ MessengerInstance.Send<NetworkUnavailableMessage>(new NetworkUnavailableMessage());
+ return;
+ }
+
RefreshSelectedFeed();
}
}
57 Views/MainView.xaml
View
@@ -7,6 +7,7 @@
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:ec="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
+ xmlns:c4f="clr-namespace:Coding4Fun.Phone.Controls;assembly=Coding4Fun.Phone.Controls"
x:Class="RssStarterKit.Views.MainView"
SupportedOrientations="Portrait"
Orientation="Portrait"
@@ -29,51 +30,6 @@
<RowDefinition />
</Grid.RowDefinitions>
- <Popup x:Name="AboutBox"
- Tap="AboutBox_Tap"
- IsOpen="False">
- <Border BorderBrush="{StaticResource PhoneForegroundBrush}"
- BorderThickness="5"
- Margin="8,8,0,0">
- <Grid Width="450"
- Height="273">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" />
- <RowDefinition />
- </Grid.RowDefinitions>
- <Rectangle Fill="{StaticResource PhoneChromeBrush}"
- Grid.RowSpan="2" />
- <TextBlock Text="{Binding LocalizedResources.MainView_About_Title, Source={StaticResource LocalizedStrings}}"
- Style="{StaticResource PhoneTextTitle2Style}"
- Grid.Row="0"
- Margin="10,10,10,17" />
- <TextBlock Text="Enter your comments here in the language of your choice. The user can press the BACK button to close this window - we don't need a separate button just for that. Also, just adjust the height of the grid as necessary to fit all your text and make it look nice."
- Grid.Row="1"
- Margin="24,0 "
- Style="{StaticResource PhoneTextSubtleStyle}"
- TextWrapping="Wrap" />
- </Grid>
- </Border>
- </Popup>
-
- <Popup x:Name="NetworkMessagePopup"
- Tap="NetworkMessagePopup_Tap"
- IsOpen="False"
- d:IsHidden="True">
- <Border BorderBrush="{StaticResource PhoneForegroundBrush}"
- BorderThickness="5"
- Margin="8,8,0,0">
- <Grid Width="450"
- Height="392">
- <TextBlock Margin="25"
- FontSize="{StaticResource PhoneFontSizeLarge}"
- Text="{Binding LocalizedResources.NetworkNotAvailableMessage, Source={StaticResource LocalizedStrings}}"
- TextWrapping="Wrap" />
-
- </Grid>
- </Border>
- </Popup>
-
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel"
Grid.Row="0"
@@ -91,7 +47,18 @@
<Grid x:Name="ContentPanel"
Grid.Row="1"
Margin="12,0,12,0">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition />
+ </Grid.RowDefinitions>
+ <TextBlock Text="{Binding LocalizedResources.MainView_NetworkErrorMessage, Source={StaticResource LocalizedStrings}}"
+ Visibility="{Binding NetworkErrorVisibility}"
+ Foreground="{StaticResource PhoneAccentBrush}"
+ HorizontalAlignment="Center"
+ Margin="0,0,0,10"
+ FontSize="36" />
<ListBox x:Name="AllFeedsListBox"
+ Grid.Row="1"
toolkit:TiltEffect.IsTiltEnabled="True"
SelectedItem="{Binding SelectedFeed, Mode=TwoWay}"
ItemsSource="{Binding Feeds}"
51 Views/MainView.xaml.cs
View
@@ -1,9 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Windows;
+using Coding4Fun.Phone.Controls;
+using GalaSoft.MvvmLight.Messaging;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using RssStarterKit.Localization;
+using RssStarterKit.Messages;
using RssStarterKit.ViewModels;
namespace RssStarterKit.Views
@@ -15,47 +19,35 @@ public partial class MainView : PhoneApplicationPage
public MainView()
{
InitializeComponent();
+ Messenger.Default.Register<NetworkUnavailableMessage>(this, (message) => ShowNetworkUnavailable());
Loaded += (s, e) =>
{
((ApplicationBarMenuItem)ApplicationBar.MenuItems[0]).Text = AppResources.MainView_AppBar_Menu_About;
if (!app.IsNetworkAvailable && !app.NetworkMessageShown)
{
- NetworkMessagePopup.IsOpen = true;
- ContentPanel.Visibility = System.Windows.Visibility.Collapsed;
- TitlePanel.Visibility = System.Windows.Visibility.Collapsed;
app.NetworkMessageShown = true;
+ ShowNetworkUnavailable();
}
};
}
- private void AboutMenuItem_Click(object sender, EventArgs e)
- {
- AboutBox.IsOpen = true;
- }
-
- protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
+ private void ShowNetworkUnavailable()
{
- if (AboutBox.IsOpen)
+ var prompt = new MessagePrompt()
{
- AboutBox.IsOpen = false;
- e.Cancel = true;
- }
- else if (NetworkMessagePopup.IsOpen)
- {
- NetworkMessagePopup.IsOpen = false;
- TitlePanel.Visibility = System.Windows.Visibility.Visible;
- ContentPanel.Visibility = System.Windows.Visibility.Visible;
- e.Cancel = true;
- }
- else
- {
- base.OnBackKeyPress(e);
- }
+ Message = AppResources.NetworkNotAvailableMessage,
+ };
+ prompt.Show();
}
- private void AboutBox_Tap(object sender, System.Windows.Input.GestureEventArgs e)
+ private void AboutMenuItem_Click(object sender, EventArgs e)
{
- AboutBox.IsOpen = false;
+ var about = new AboutPrompt()
+ {
+ Title = Localization.AppResources.MainView_About_Title,
+ Body = Localization.AppResources.MainView_About_Body,
+ };
+ about.Show();
}
private void ResetMenuItem_Click(object sender, EventArgs e)
@@ -63,12 +55,5 @@ private void ResetMenuItem_Click(object sender, EventArgs e)
var model = DataContext as MainViewModel;
model.ResetFeeds();
}
-
- private void NetworkMessagePopup_Tap(object sender, System.Windows.Input.GestureEventArgs e)
- {
- NetworkMessagePopup.IsOpen = false;
- TitlePanel.Visibility = System.Windows.Visibility.Visible;
- ContentPanel.Visibility = System.Windows.Visibility.Visible;
- }
}
}
12 Views/RssFeedView.xaml
View
@@ -31,9 +31,17 @@
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
- <Grid Grid.Row="0"
+ <TextBlock Text="{Binding LocalizedResources.MainView_NetworkErrorMessage, Source={StaticResource LocalizedStrings}}"
+ Visibility="{Binding NetworkErrorVisibility}"
+ Foreground="{StaticResource PhoneAccentBrush}"
+ HorizontalAlignment="Center"
+ Margin="0,0,0,10"
+ Grid.Row="0"
+ FontSize="36" />
+ <Grid Grid.Row="1"
Margin="-10,0,-9,0">
<Grid.Background>
<SolidColorBrush Color="{StaticResource PhoneInactiveColor}" />
@@ -52,7 +60,7 @@
Margin="0,4,8,4" />
</Grid>
<ListBox x:Name="SingleFeedListBox"
- Grid.Row="1"
+ Grid.Row="2"
toolkit:TiltEffect.IsTiltEnabled="True"
SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
ItemsSource="{Binding SelectedFeed.Items}"
1  packages.config
View
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
+ <package id="Coding4Fun.Phone.Controls.Complete" version="1.5.1" />
<package id="MvvmLightLibsPreview" version="4.1.0" />
<package id="SilverlightToolkitWP" version="4.2011.12.14" />
</packages>
Please sign in to comment.
Something went wrong with that request. Please try again.