[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class App : Application
{
- private const string ServiceAppId = "org.tizen.example.MapMyRunService";
- //private const string ServiceAppId = "org.tizen.mapmyrunservice";
- private readonly Loading loading;
+ //private const string ServiceAppId = "org.tizen.example.MapMyRunService";
+ private const string ServiceAppId = "org.tizen.mapmyrunservice";
public Workout workout;
public SettingManager settingManager;
public App()
InitializeComponent();
var dispatcher = MapMyRun.Models.Dispatcher.Instance;
settingManager = new SettingManager(dispatcher);
- loading = new Loading(new AppLauncher(), new MessagePortHandler(),
- dispatcher, new PhoneService(dispatcher, new TizenPlatformService()), settingManager, ServiceAppId);
- MainPage = new LoadingPage(loading);
workout = new Workout(dispatcher, new PermissionManager(dispatcher));
- workout.StartListenWorkoutData();
+ MainPage = new NavigationPage(new LoadingPage());
}
- protected override void OnStart()
+ protected override void OnStart()
{
Console.WriteLine("OnStart!========================");
- loading.StartLoading();
}
protected override void OnSleep()
public partial class LoadingPage : CirclePage
{
private readonly Loading _loading;
+ private const string ServiceAppId = "org.tizen.mapmyrunservice";
public static readonly BindableProperty ProgressProperty =
BindableProperty.Create("Progress",
typeof(double),
propertyChanged: (b, o, n) =>
ProgressBarProgressChanged((CircleProgressBarSurfaceItem)b, (double)n));
- public LoadingPage(Loading loading)
+ public LoadingPage()
{
InitializeComponent();
- _loading = loading;
- BindingContext = new LoadingPageModel(_loading);
ProgressBar.SetBinding(ProgressProperty, "Progress");
+
+ var dispatcher = MapMyRun.Models.Dispatcher.Instance;
+ _loading = new Loading(new AppLauncher(), new MessagePortHandler(),
+ dispatcher, new PhoneService(dispatcher, new TizenPlatformService()), ((App)Application.Current).settingManager, ServiceAppId);
+
+ BindingContext = new LoadingPageModel(_loading);
+ Appearing += (s, e) =>
+ {
+ _loading.StartLoading();
+ (Application.Current as App).workout.StartListenWorkoutData();
+ };
}
- private static void ProgressBarProgressChanged(CircleProgressBarSurfaceItem progressBar, double progress)
+ private static void ProgressBarProgressChanged(CircleProgressBarSurfaceItem progressBar, double progress)
{
progressBar.CancelAnimation();
progressBar.ProgressTo(progress, 200);
if (progress >= 1)
{
- Device.StartTimer(TimeSpan.FromSeconds(0.3), () =>
- {
- Application.Current.MainPage = new NavigationPage(new MainPage());
- return false;
- });
+ Device.BeginInvokeOnMainThread(() =>
+ {
+ ((App)Application.Current).MainPage.Navigation.PushAsync(new MainPage());
+ });
}
}
}
await Task.Delay(500);
image.FadeTo(ZERO_OPACITY, 300);
await image.ScaleTo(10, 300);
- Application.Current.MainPage = new WorkoutMainIndexPage();
+ await ((App)Application.Current).MainPage.Navigation.PushAsync(new WorkoutMainIndexPage());
// TODO : Move proper position
Workout workout = (Application.Current as App).workout;
{
Workout workout = (Application.Current as App).workout;
workout.FinishWorkout();
- Application.Current.MainPage = new NavigationPage(new MainPage());
- };
+ ((App)Application.Current).MainPage.Navigation.PushAsync(new MainPage());
+ };
}
void OnPageClick(object s, EventArgs e)
Workout workout = (Application.Current as App).workout;
workout.FinishWorkout();
- Application.Current.MainPage = new NavigationPage(new MainPage());
+ ((App)Application.Current).MainPage.Navigation.PushAsync(new MainPage());
};
Device.StartTimer(TimeSpan.FromMilliseconds(100), () =>
public class Dispatcher : IDispatcher
{
IMessagePortHandler _messagePortHandler = null;
- private const string ServiceAppId = "org.tizen.example.MapMyRunService";
- //private const string ServiceAppId = "org.tizen.mapmyrunservice";
+ //private const string ServiceAppId = "org.tizen.example.MapMyRunService";
+ private const string ServiceAppId = "org.tizen.mapmyrunservice";
private const string LocalPort = "APP_PORT";
private const string RemotePort = "SERVICE_PORT";
public const string OperationKey = "operation";