private int totatCount;
private TimeSpan totalTime;
private int avarageScore;
+ private SummaryType summaryType;
/// <summary>
/// Initializes a new instance of the <see cref="ExercisingViewModel"/> class.
/// </summary>
public IExerciseService SquatService { get; private set; }
+ /// <summary>
+ /// Gets the <see cref="SummaryType"/> property.
+ /// </summary>
+ public SummaryType SummaryType
+ {
+ get => summaryType;
+ private set
+ {
+ if (value != summaryType)
+ {
+ summaryType = value;
+ SummaryTitle = GetSummaryTitle(summaryType);
+ }
+ }
+ }
+
/// <inheritdoc />
protected override ICommand GetGoPrevious()
{
}
SummaryOkCommand = new Command(() => { ExecuteChangeWorkout(offset); });
- SummaryTitle = GetSummaryTitle(SummaryType.ChangeWorkout);
+ SummaryType = SummaryType.ChangeWorkout;
IsSummaryVisible = true;
}
UpdateStatistics();
SummaryBackCommand = new Command(ExecuteCloseSummary);
SummaryOkCommand = new Command(() => { ExecuteChangeWorkout(); });
- SummaryTitle = GetSummaryTitle(SummaryType.TryAgain);
+ SummaryType = SummaryType.TryAgain;
IsSummaryVisible = true;
}
UpdateStatistics();
SummaryBackCommand = new Command(ExecuteCloseSummary);
SummaryOkCommand = new Command(Services.NavigationService.Instance.PopToRoot);
- SummaryTitle = GetSummaryTitle(SummaryType.EndWorkout);
+ SummaryType = SummaryType.EndWorkout;
IsSummaryVisible = true;
}
{
UpdateStatistics();
SummaryOkCommand = new Command(Services.NavigationService.Instance.PopToRoot);
- SummaryTitle = GetSummaryTitle(SummaryType.TimeIsUp);
+ SummaryType = SummaryType.TimeIsUp;
IsSummaryVisible = true;
}
using Fitness.Controls;
+using Fitness.Models;
+using Tizen.NUI;
namespace Fitness.Views
{
+ /// <summary>
+ /// Partial <see cref="SummaryView"/> class.
+ /// </summary>
public partial class SummaryView : Page
{
+ private const int SingleOkButtonWidth = 98;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="SummaryView"/> class.
+ /// </summary>
public SummaryView()
{
InitializeComponent();
+ SummaryViewTitle.PropertyChanged += OnSummaryTitleChanged;
+ }
+
+ private void OnSummaryTitleChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
+ {
+ if (BindingContext is ViewModels.ExercisingViewModel viewModel && viewModel.SummaryType == SummaryType.TimeIsUp)
+ {
+ OkButton.Margin = new Extents((ushort)UnitsUtils.UnitsToPixels(SingleOkButtonWidth), 0, 0, 0);
+ BackButton.Size = new Size2D(0, 0);
+ BackButton.Margin = new Extents(0, 0, 0, 0);
+ }
}
}
}
HeightSpecification="{Static LayoutParamPolicies.MatchParent}"/>
<TextLabel BindingContext="{Binding Source={x:Reference Root}, Path=BindingContext}"
+ x:Name="SummaryViewTitle"
Text="{Binding SummaryTitle}"
PixelSize="40"
WidthSpecification="{Static LayoutParamPolicies.MatchParent}"
<LinearLayout LinearOrientation="Horizontal"/>
</View.Layout>
- <View Size="{views:SizeInUnits Width=20, Height=26}"/>
-
- <ctrl:NinePatchButton Text="Back"
- Size="{views:SizeInUnits Width=100, Height=26}"
+ <ctrl:NinePatchButton x:Name="BackButton"
BindingContext="{Binding Source={x:Reference Root}, Path=BindingContext}"
+ Text="Back"
+ Margin="{views:ExtentsInUnits Start=20}"
+ Size="{views:SizeInUnits Width=100, Height=26}"
Command="{Binding SummaryBackCommand}"
behaviors:StyleSetter.Style="{Binding Source={x:Static styles:Buttons.Outline}}"/>
- <View Weight="1"
- HeightSpecification="{Static LayoutParamPolicies.MatchParent}"
- WidthSpecification="{Static LayoutParamPolicies.MatchParent}"/>
- <ctrl:NinePatchButton Text="Ok"
+ <ctrl:NinePatchButton x:Name="OkButton"
+ Text="Ok"
+ Margin="{views:ExtentsInUnits Start=56}"
Size="{views:SizeInUnits Width=100, Height=26}"
BindingContext="{Binding Source={x:Reference Root}, Path=BindingContext}"
Command="{Binding SummaryOkCommand}"
behaviors:StyleSetter.Style="{Binding Source={x:Static styles:Buttons.Inverse}}"/>
-
- <View Size="{views:SizeInUnits Width=20, Height=24}"/>
</View>