Commits

Ron Huang committed 2da07e7

Merged DistanceLabel with Feedback.

Comments (0)

Files changed (3)

WhereIsMakkah/MainPage.xaml

 			<RowDefinition Height="Auto" />
 			<RowDefinition Height="*" />
 			<RowDefinition Height="Auto"/>
-			<RowDefinition Height="Auto"/>
 		</Grid.RowDefinitions>
 
 		<!--TitlePanel contains the name of the application and page title-->
 			</es:BlockArrow.Projection>
 		</es:BlockArrow>
 		<TextBlock TextWrapping="Wrap" Text="{Binding Feedback, Mode=OneWay}" Margin="{StaticResource PhoneMargin}" d:LayoutOverrides="Width" Grid.Row="2" HorizontalAlignment="Center"/>
-		<TextBlock TextWrapping="Wrap" Text="{Binding DistanceLabel, Mode=OneWay}" Margin="{StaticResource PhoneMargin}" d:LayoutOverrides="Width" Grid.Row="3" HorizontalAlignment="Center"/>
 	</Grid>
 
 

WhereIsMakkah/ViewModel/MainViewModel.cs

 
                 // Update bindings, no broadcast
                 RaisePropertyChanged(DirectionDeterminedPropertyName);
-                RaisePropertyChanged(DistanceLabelPropertyName);
+                RaisePropertyChanged(FeedbackPropertyName);
             }
         }
 
         {
             get
             {
-                return _locationDetermined && _motionDetermined;
+                return _locationServiceSetting && _locationDetermined && _motionDetermined;
             }
         }
 
         {
             get
             {
-                if (LocationServiceSetting)
+                if (_locationServiceSetting)
                 {
-                    return _feedback;
+                    if (_locationDetermined)
+                    {
+                        var unit = _metricSetting ? AppResources.MetricUnitLabel : AppResources.ImperialUnitLabel;
+
+                        return string.Format(AppResources.DistanceLabel, Distance.ToString("0"), unit);
+                    }
+                    else
+                    {
+                        return _feedback;
+                    }
                 }
                 else
                 {
         /// </summary>
         public bool MetricSetting
         {
-            get
-            {
-                return _metricSetting;
-            }
-
             set
             {
                 if (_metricSetting == value)
                 _metricSetting = value;
 
                 // Update bindings, no broadcast
-                RaisePropertyChanged(DistanceLabelPropertyName);
+                RaisePropertyChanged(FeedbackPropertyName);
             }
         }
 
         {
             get
             {
-                if (MetricSetting)
+                if (_metricSetting)
                 {
                     return _distance;
                 }
                 _distance = value;
 
                 // Update bindings, no broadcast
-                RaisePropertyChanged(DistanceLabelPropertyName);
-            }
-        }
-
-        /// <summary>
-        /// The <see cref="Unit" /> property's name.
-        /// </summary>
-        public const string DistanceLabelPropertyName = "DistanceLabel";
-
-        public string DistanceLabel
-        {
-            get
-            {
-                if (LocationServiceSetting && _locationDetermined)
-                {
-                    var unit = MetricSetting ? AppResources.MetricUnitLabel : AppResources.ImperialUnitLabel;
-
-                    return string.Format(AppResources.DistanceLabel, Distance.ToString("0"), unit);
-                }
-                else
-                {
-                    return "";
-                }
+                RaisePropertyChanged(FeedbackPropertyName);
             }
         }
 
         /// </summary>
         public bool LocationServiceSetting
         {
-            get
-            {
-                return _locationServiceSetting;
-            }
-
             set
             {
                 if (_locationServiceSetting == value)
                 _locationServiceSetting = value;
 
                 // Update bindings, no broadcast
-                RaisePropertyChanged(DistanceLabelPropertyName);
+                RaisePropertyChanged(DirectionDeterminedPropertyName);
                 RaisePropertyChanged(FeedbackPropertyName);
             }
         }
 
         private void StartLocationSensor()
         {
-            if (!LocationServiceSetting)
+            if (!_locationServiceSetting)
             {
                 return;
             }

WhereIsMakkah/WhereIsMakkah.csproj

     <Content Include="Icon\appbar.feature.settings.rest.png">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
-    <Content Include="Icon\appbar.refresh.rest.png">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
     <Content Include="LICENSE.txt" />
     <Content Include="SplashScreenImage.jpg">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>