--- /dev/null
+using System;
+using Fitness.Services;
+using Tizen.NUI;
+
+namespace Fitness.ViewModels
+{
+ public class LoadingViewModel : BaseViewModel, IDisposable
+ {
+ private const int TickIntervalInMilliseconds = 1500;
+ private string text;
+ private Timer timer;
+ private bool disposed = false;
+
+ private string[] messages = new string[]
+ {
+ "get ready",
+ "1",
+ "2",
+ "3",
+ "GO!",
+ string.Empty,
+ };
+
+ public LoadingViewModel()
+ {
+ StartCounting();
+ }
+
+ ~LoadingViewModel()
+ {
+ Dispose(false);
+ }
+
+ public string Text
+ {
+ get => text;
+ set
+ {
+ if (text != value)
+ {
+ text = value;
+ RaisePropertyChanged();
+ }
+ }
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (!disposed)
+ {
+ if (disposing)
+ {
+ timer?.Dispose();
+ }
+
+ disposed = true;
+ }
+ }
+
+ private void StartCounting()
+ {
+ int count = 0;
+ timer = new Timer(TickIntervalInMilliseconds);
+ Text = messages[count++];
+
+ timer.Tick += (sender, args) =>
+ {
+ Text = messages[count++];
+
+ if (count == messages.Length)
+ {
+ Services.NavigationService.Instance.NavigateToExercisingView();
+ return false;
+ }
+
+ return true;
+ };
+
+ timer.Start();
+ }
+ }
+}
{
public WorkoutViewModel()
{
- WatchPreview = new Command(() => { NavigationService.Instance.NavigateToExercisePreviewView(); });
+ WatchPreview = new Command(() => { NavigationService.Instance.NavigateToLoadingView(); });
StartWorkout = new Command(() => { NavigationService.Instance.NavigateToScanningView(); });
}
xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:ctrl="clr-namespace:Fitness.Controls"
- HeightResizePolicy="FillToParent" WidthResizePolicy="FillToParent" BackgroundColor="#EEEFF1" ParentOrigin="Center" PivotPoint="Center" PositionUsesPivotPoint="true">
+ xmlns:vm="clr-namespace:Fitness.ViewModels"
+ BackgroundColor="#EEEFF1"
+ >
+ <ctrl:Page.BindingContext>
+ <vm:LoadingViewModel x:Name="context"/>
+ </ctrl:Page.BindingContext>
+ <ctrl:Page.Layout>
+ <AbsoluteLayout/>
+ </ctrl:Page.Layout>
+ <ImageView PositionUsesPivotPoint="true" ParentOrigin="Center" PivotPoint="Center" HeightResizePolicy="SizeRelativeToParent" WidthForHeight="true" SizeModeFactor="0.0,0.8,1.0" ResourceUrl="*Resource*/layout/images/circle.svg" x:Name="image" Opacity="0.48"/>
+ <TextLabel Text="{Binding Text}" PointSize="60" WidthResizePolicy="FillToParent" HeightResizePolicy="FillToParent" PositionUsesPivotPoint="true" PivotPoint="Center" ParentOrigin="Center" VerticalAlignment="Center" HorizontalAlignment="Center" TextColor="#000C2B"/>
</ctrl:Page>
--- /dev/null
+<svg height="748" width="748">
+ <circle cx="374" cy="374" r="374" stroke="#707070" stroke-width="3" fill="white" />
+</svg>