diff options
author | Vitaly Takmazov | 2013-04-26 23:45:22 +0400 |
---|---|---|
committer | Vitaly Takmazov | 2013-04-26 23:45:22 +0400 |
commit | 4b2a51d8858ed3d28dd4af0aa86ca88fe2ec9ab3 (patch) | |
tree | 08d3e6e43b5fc5e5958c0570303c291aaa72e955 | |
parent | 648d914c8d5cf6fe2b3f8271839ec30143172376 (diff) | |
parent | f2a831eb785ca81a069406f7df0f3890ac2be90a (diff) |
Merge branch 'fix_repo'
-rw-r--r-- | Juick/Classes/BooleanToVisibilityConverter.cs | 21 | ||||
-rw-r--r-- | Juick/Juick.csproj | 3 | ||||
-rw-r--r-- | Juick/MainPage.xaml | 12 | ||||
-rw-r--r-- | Juick/ViewModels/AppViewModel.cs | 19 | ||||
-rw-r--r-- | Juick/ViewModels/Validation/DataViewModelBase.cs | 44 |
5 files changed, 47 insertions, 52 deletions
diff --git a/Juick/Classes/BooleanToVisibilityConverter.cs b/Juick/Classes/BooleanToVisibilityConverter.cs new file mode 100644 index 0000000..cd7e000 --- /dev/null +++ b/Juick/Classes/BooleanToVisibilityConverter.cs @@ -0,0 +1,21 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; + +namespace Juick.Classes +{ + public class BooleanToVisibiltyConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var visible = (bool)value; + return visible ? Visibility.Visible : Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +}
\ No newline at end of file diff --git a/Juick/Juick.csproj b/Juick/Juick.csproj index 26371f0..0163f65 100644 --- a/Juick/Juick.csproj +++ b/Juick/Juick.csproj @@ -80,7 +80,8 @@ <DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="Classes\AccountManager.cs" />
- <Compile Include="Classes\BooleanToVisibiltyConverter.cs" />
+ <Compile Include="Classes\BooleanToVisibilityConverter.cs" />
+ <Compile Include="Classes\DateHelper.cs" />
<Compile Include="Classes\DelegateCommand.cs" />
<Compile Include="Classes\ExpressionHelper.cs" />
<Compile Include="Classes\InvokeDelegateCommandAction.cs" />
diff --git a/Juick/MainPage.xaml b/Juick/MainPage.xaml index 7c38b7b..d2c99df 100644 --- a/Juick/MainPage.xaml +++ b/Juick/MainPage.xaml @@ -13,19 +13,21 @@ FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
- phoneshell:SystemTray.IsVisible="True">
+ phoneshell:SystemTray.IsVisible="True" CacheMode="BitmapCache">
<phone:PhoneApplicationPage.Resources>
- <classes:BooleanToVisibiltyConverter x:Key="BooleanToVisibilityConverter"/>
+ <classes:BooleanToVisibiltyConverter x:Key="BooleanToVisibilityConverter"/>
</phone:PhoneApplicationPage.Resources>
-
- <!--LayoutRoot is the root grid where all page content is placed-->
+
+
+
+ <!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
- <TextBlock Grid.Row="1" Text="Network unavailable" Visibility="{Binding NetworkUnavailable, Converter={StaticResource BooleanToVisibilityConverter}}"/>
+ <TextBlock Text="Network unavailable" Visibility="{Binding NetworkUnavailable, Converter={StaticResource BooleanToVisibilityConverter}}" />
<controls:Pivot x:Name="Pages" Title="juick" Grid.Row="2" ItemsSource="{Binding Pages}">
<controls:Pivot.HeaderTemplate>
<DataTemplate>
diff --git a/Juick/ViewModels/AppViewModel.cs b/Juick/ViewModels/AppViewModel.cs index 07ba7cf..4b30c08 100644 --- a/Juick/ViewModels/AppViewModel.cs +++ b/Juick/ViewModels/AppViewModel.cs @@ -16,7 +16,7 @@ namespace Juick.ViewModels public class AppViewModel : ViewModelBase { static readonly string IsNetworkAvailablePropertyName = ExpressionHelper.GetPropertyName<AppViewModel>(x => x.NetworkUnavailable); - readonly HttpNotificationChannel _pushChannel; + readonly HttpNotificationChannel pushChannel; // The name of our push channel. private const string channelName = "JuickChannel"; @@ -26,11 +26,16 @@ namespace Juick.ViewModels NetworkUnavailable = !DeviceNetworkInformation.IsNetworkAvailable; } + public void UpdateNetworkStatus() + { + NetworkUnavailable = !DeviceNetworkInformation.IsNetworkAvailable; + } + public AppViewModel() { UpdateNetworkStatus(); NetworkChange.NetworkAddressChanged += (sender, args) => UpdateNetworkStatus(); - _pushChannel = HttpNotificationChannel.Find(channelName); + pushChannel = HttpNotificationChannel.Find(channelName); // If the channel was not found, then create a new connection to the push service. if (_pushChannel == null) @@ -129,6 +134,16 @@ namespace Juick.ViewModels } } } + private bool _isNetworkUnavailable; + public bool NetworkUnavailable + { + get { return _isNetworkUnavailable; } + set + { + _isNetworkUnavailable = value; + NotifyPropertyChanged(IsNetworkAvailablePropertyName); + } + } private bool _isNetworkUnavailable; public bool NetworkUnavailable diff --git a/Juick/ViewModels/Validation/DataViewModelBase.cs b/Juick/ViewModels/Validation/DataViewModelBase.cs deleted file mode 100644 index dcbf34b..0000000 --- a/Juick/ViewModels/Validation/DataViewModelBase.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; - -namespace Juick.ViewModels.Validation -{ - public class DataViewModelBase : ViewModelBase, IDataErrorInfo - { - - private readonly Dictionary<String, List<String>> _errors = - new Dictionary<string, List<string>>(); - - // Adds the specified error to the errors collection if it is not already - // present, inserting it in the first position if isWarning is false. - public void AddError(string propertyName, string error, bool isWarning) - { - if (!_errors.ContainsKey(propertyName)) - _errors[propertyName] = new List<string>(); - - if (_errors[propertyName].Contains(error)) return; - if (isWarning) _errors[propertyName].Add(error); - else _errors[propertyName].Insert(0, error); - } - - // Removes the specified error from the errors collection if it is present. - public void RemoveError(string propertyName, string error) - { - if (!_errors.ContainsKey(propertyName) || !_errors[propertyName].Contains(error)) return; - _errors[propertyName].Remove(error); - if (_errors[propertyName].Count == 0) _errors.Remove(propertyName); - } - - public string Error { get { throw new NotImplementedException(); } } - - public string this[string columnName] - { - get - { - return (!_errors.ContainsKey(columnName) ? null : - String.Join(Environment.NewLine, _errors[columnName])); - } - } - } -} |