예제 #1
0
 public override void OnShow()
 {
     base.OnShow();
     GpsTracking.StartAsync();
     PushService.Init();
     DynamicScreenRefreshService.Init();
 }
예제 #2
0
        public override void OnCreate()
        {
            base.OnCreate();
            DConsole.WriteLine("DB init...");
            DBHelper.Init();
            DConsole.WriteLine("Settings init...");
            Settings.Init();
            DConsole.WriteLine("Authorization init...");
            DynamicScreenRefreshService.Init();
            Authorization.Init();
            if (Authorization.FastAuthorization() && Settings.UserDetailedInfo != null)
            {
#if DEBUG
                DConsole.WriteLine($"Логин и пароль были сохранены." +
                                   $"{Environment.NewLine}" +
                                   $"Login: {Settings.User} Password: {Settings.Password}{Environment.NewLine}");
#endif
                DConsole.WriteLine("Loading first screen...");
                Navigation.Move(nameof(EventListScreen));
            }
            else
            {
#if DEBUG
                if (Settings.UserDetailedInfo == null)
                {
                    Utils.TraceMessage("Произошло падение базы... извините");
                }
                DConsole.WriteLine($"Логин и пароль НЕ были сохранены." +
                                   $"{Environment.NewLine}" +
                                   $"Login: {Settings.User} Password: {Settings.Password} {Environment.NewLine}");
#endif
                DConsole.WriteLine("Loading first screen...");
                Navigation.Move(nameof(AuthScreen));
            }
        }
예제 #3
0
        private static void SyncHandler(object state, ResultEventArgs <bool> resultEventArgs)
        {
            if (state.Equals("Full"))
            {
                Toast.MakeToast(Translator.Translate(resultEventArgs.Result ? "sync_success" : "sync_fail"));
            }
            else
            {
#if DEBUG
                DConsole.WriteLine($"---------------{Environment.NewLine}"
                                   + Translator.Translate(resultEventArgs.Result ? "sync_success" : "sync_fail"));
                DConsole.WriteLine($"Последняя ошибка: {LastError}");
                DConsole.WriteLine($"Результат синхронизации в callback {resultEventArgs.Result}" +
                                   $"{Environment.NewLine}{nameof(SuccessSync)}: {SuccessSync}" +
                                   $"{Environment.NewLine}---------------");
#endif
            }
            if (!resultEventArgs.Result)
            {
                isPartialSyncRequired = true;
                Utils.TraceMessage($"Full sync = {isPartialSyncRequired}");
#if DEBUG
                DConsole.WriteLine(Parameters.Splitter);
                DConsole.WriteLine($"Новые данные не пришли," +
                                   $"настройки не обновляем" +
                                   $" {nameof(resultEventArgs.Result)} = {resultEventArgs.Result}" +
                                   $"{Environment.NewLine}Last Error {_db.LastError}");
                DConsole.WriteLine(Parameters.Splitter);
#endif
                return;
            }
#if DEBUG
            DConsole.WriteLine(Parameters.Splitter);
            DConsole.WriteLine("Пришли новые настройки. Обновляем их");
            DConsole.WriteLine(Parameters.Splitter);
#endif
            Application.InvokeOnMainThread(() => GpsTracking.Stop());

            Settings.Init();

            Application.InvokeOnMainThread(() => GpsTracking.Start());

            DynamicScreenRefreshService.RefreshScreen();
            isPartialSyncRequired = false;
        }