Exemplo n.º 1
0
        private async Task ScanAsync()
        {
            var scanner = new ZXing.Mobile.MobileBarcodeScanner();

            var result = await scanner.Scan();

            if (result != null)
            {
                AppProperties.SetToken(result.ToString());
                await NavService.NavigateToViewModel <MapPageViewModel>(false);
            }
        }
Exemplo n.º 2
0
 private async Task ShowTimetableAsync()
 {
     NavService.ClearAllViewsFromStack();
     await NavService.NavigateToViewModel <TimetablePageViewModel>(false);
 }
Exemplo n.º 3
0
        private async Task Login(User user)
        {
            if (!await AskForPermissionAsync())
            {
                return;
            }
            if (string.IsNullOrEmpty(user.Login) || string.IsNullOrEmpty(user.Password))
            {
                if (string.IsNullOrEmpty(user.Login))
                {
                    Device.BeginInvokeOnMainThread(() => MessagingCenter.Send <string>("OrlenLogin", "wrongLogin"));
                }
                if (string.IsNullOrEmpty(user.Password))
                {
                    Device.BeginInvokeOnMainThread(() => MessagingCenter.Send <string>("OrlenLogin", "wrongPassword"));
                }
                return;
            }

            Device.BeginInvokeOnMainThread(() => MessagingCenter.Send <string>("OrlenLogin", "animateStart"));

            Busy = true;

            WebStatusData webstatus = new WebStatusData();

            if (user != null)
            {
                webstatus = await LoginService.LoginAsync(user);
            }
            if (webstatus != null)
            {
                if (!string.IsNullOrEmpty(webstatus.Token))
                {
                    AppPropertiesService.SetToken(webstatus.Token);
                }
            }
            else
            {
                Device.BeginInvokeOnMainThread(() => MessagingCenter.Send <string, string>("OrlenLogin", "scalePromptUp", "Zły login lub hasło"));
                Busy = false;
                return;
            }
            //await Task.Delay(4000);
            await FetchApplicationDataAsync();

            await NavService.NavigateToViewModel <TimetablePageViewModel>(false);

            //if (webstatus.Status.Equals(Status.OK))
            //{
            //    AppPropertiesService.SetUserProperties(webstatus.Token, webstatus.Client_id, webstatus.User_id);
            //    UserDataService.SaveUserData(user.Login, user.Password);
            //    DataService = new EkajetDataService(webstatus.Token, webstatus.User_id, webstatus.Client_id);
            //    await NavService.NavigateToViewModelMasterDetail<MainPageViewModel>(false, Variables.Variables.CALENDAR);
            //    DependencyService.Get<IMessage>().LongAlert(string.Format("Witaj {0}", UserDataService.GetUserLogin()));


            //}
            //else
            //{
            //    if (webstatus.Errcode.Equals("10008") || webstatus.Errcode.Equals("10006"))
            //    {
            //        Device.BeginInvokeOnMainThread(() => MessagingCenter.Send<string, string>("OrlenLogin", "scalePromptUp", "Zły login lub hasło"));
            //        return;
            //    }
            //    else
            //    {
            //        Device.BeginInvokeOnMainThread(() => MessagingCenter.Send<string, string>("OrlenLogin", "scalePromptUp", "Nieznany bład"));
            //        return;
            //    }
            //}


            //Busy = false;
            //Device.BeginInvokeOnMainThread(() => MessagingCenter.Send("OrlenLogin", "animateStop"));
        }
Exemplo n.º 4
0
 private async Task ShowMapAsync()
 {
     NavService.ClearAllViewsFromStack();
     await NavService.NavigateToViewModel <MapPageViewModel>(false);
 }