public async Task NotifyAction(mNotify item)
        {
            if (item.Why == Keys.NotifyWhys[1])// new-question
            {
                mQuestion question = await QuestionService.Instance.FetchQuestion(item.Objecter);

                if (question == null || question.Answer != Strings.No_Answer || QuestionAnswered)
                {
                    return;
                }

                var result = await DialogService.DisplayAlert(Strings.Answer, Strings.Close, Strings.Answer_Question, question.Question);

                if (!result)
                {
                    return;
                }

                var answer = await DialogService.ShowInputPrompt(Strings.Answer, Strings.Close, Strings.Answer_Question, "Q: " + question.Question, "", Acr.UserDialogs.InputType.Default);

                if (string.IsNullOrEmpty(answer))
                {
                    return;
                }

                AnswerQuestion(answer, question);
            }
        }
        private async void ClearNotfiy()
        {
            if (NotifyList.Count < 1)
            {
                DialogService.ShowToast(Strings.No_Item_To_Clear);
                return;
            }

            var verify = await DialogService.DisplayAlert(Strings.Yes, Strings.No, Strings.Clear_List, Strings.Are_You_Sure_To_Clear);

            if (!verify)
            {
                return;
            }

            try
            {
                var result = await NotifyService.Instance.DeleteNotify(AccountService.Instance.Current_Account.Email);

                if (!result)
                {
                    return;
                }

                NotifyList = new ObservableCollection <mNotify>();

                DialogService.ShowToast(Strings.List_Cleared);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(Keys.TAG + ex);
                DialogService.ShowError(Strings.SomethingWrong);
                Crashes.TrackError(ex);
            }
        }
Example #3
0
        private async void OnAddIncomeType()
        {
            try
            {
                string name = await DialogService.Prompt("Add income type", "Introduce the name of the new income type", StringConstants.Ok, "cancel", "Name");

                if (!string.IsNullOrWhiteSpace(name))
                {
                    if (await DatabaseService.GetIncomeTypeByName(name) == null)
                    {
                        IncomeType newIncomeType = await DatabaseService.InsertIncomeType(name);

                        if (newIncomeType != null)
                        {
                            await DialogService.DisplayAlert("Add income type", $"{newIncomeType.Name} add as an income type", StringConstants.Ok);
                        }
                        else
                        {
                        }
                    }
                    else
                    {
                        await DialogService.DisplayAlert(StringConstants.Error, $"There's already an income type with the name: {name}", StringConstants.Ok);
                    }
                }
            }
            catch (Exception ex)
            {
                await DialogService.DisplayAlert(StringConstants.Error, $"There was an error trying to insert the income type. {StringConstants.Error}: {ex.Message}", StringConstants.Ok);
            }
        }
Example #4
0
        private void NavigateToChat()
        {
            if (IsBusy)
            {
                return;
            }

            try
            {
                IsBusy = true;

                Criticize();

                App.User.Id = MyUserId;

                var targetUser = new User
                {
                    Id   = TargetUserId,
                    Name = TargetName
                };

                NavigationService.NavigateToAsync <ConversationViewModel>(targetUser);
            }
            catch (FoException fo)
            {
                DialogService.DisplayAlert("Atention", fo.Message, "Ok");
            }
            finally
            {
                IsBusy = false;
            }
        }
        public void DisplaysAlert()
        {
            var page          = new Mock <IPage>();
            var dialogService = new DialogService(page.Object);

            dialogService.DisplayAlert("Alert", "You have been alerted", "OK");
            page.Verify(x => x.DisplayAlert("Alert", "You have been alerted", "OK"));
        }
        private async void CancelAction()
        {
            var result = await DialogService.DisplayAlert("Yes", "No", "Cancel Item", "Are You Sure You Want To Cancel?");

            if (result)
            {
                await _pageService.PopAsync();
            }
        }
        private async Task ProfileImage_NextAction()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            DialogService.ShowLoading("Please wait");

            try
            {
                if (bProfileImage == null || bProfileImage.Length < 1)
                {
                    DialogService.HideLoading();

                    var res = await DialogService.DisplayAlert("Yes", "Later", "Profile Image", "Do you want to add a profile image?");

                    if (res)
                    {
                        DialogService.ShowToast("Please Tap the circle image");
                        return;
                    }
                    //DialogService.HideLoading();
                    //DialogService.ShowError("Please Add An Image");return;
                }
                if (Displayname.Length < 1 || Displayname == null)
                {
                    DialogService.HideLoading();
                    DialogService.ShowError("Please Enter Display Name"); return;
                }

                mAccount updated_Account = UpdateAccount("ProfileImage");

                var result = await AccountService.Instance.UpdateAccount(updated_Account);

                DialogService.HideLoading();

                if (result == "true")
                {
                    await _pageService.PushModalAsync(new ProfileInterest());
                }
                else
                {
                    DialogService.ShowError(result);
                }
            }
            catch (Exception ex)
            {
                DialogService.ShowError(Strings.SomethingWrong);
                Debug.WriteLine(Keys.TAG + ex);
                Crashes.TrackError(ex);
            }
            finally { IsBusy = false; }
        }
Example #8
0
        public async Task <byte[]> GetProfileImage()
        {
            await CrossMedia.Current.Initialize();

            if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
            {
                await DialogService.DisplayAlert(Strings.Ok, null, Strings.No_Camera, Strings.Camera_Not_Available);

                return(null);
            }

            MediaFile file = null;

            var action = await DialogService.DisplayActionSheet("Image Options", "Cancel", null, "Selected Picture", "Take Picture");

            if (action == "Selected Picture")
            {
                file = await CrossMedia.Current.PickPhotoAsync(new Plugin.Media.Abstractions.PickMediaOptions
                {
                    CompressionQuality = 50,
                    PhotoSize          = PhotoSize.Medium
                });
            }
            else if (action == "Take Picture")
            {
                // DialogService.ShowToast("Not Available");
                file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions
                {
                    CompressionQuality = 100,
                    PhotoSize          = PhotoSize.Full
                });
            }

            if (file == null)
            {
                return(null);
            }

            byte[] resizedImage = await CrossImageResizer.Current.ResizeImageWithAspectRatioAsync(file.GetStream(), 1000, 1000);

            bProfileImage = resizedImage;
            return(resizedImage);

            //var stream = file.GetStream();
            //byte[] buffer = new byte[stream.Length];
            //using (MemoryStream ms = new MemoryStream())
            //{
            //    stream.CopyTo(ms);
            //    buffer = ms.ToArray();
            //    file.Dispose();

            //    bProfileImage = buffer;
            //    return buffer;
            //}
        }
Example #9
0
        private async void UpdateAction()
        {
            if (BgUpdateBtn == "Gray")
            {
                return;
            }

            if (_order.Status == Keys.OrderStatus[3] || _order.Status == Keys.OrderStatus[4] || _order.Status == Keys.OrderStatus[5])
            {
                var ans = await DialogService.DisplayAlert("Ok", null, "Notice", "Order can not be updated at this stage");

                return;
            }

            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                DialogService.ShowLoading("Updating Order");

                mOrder updateOrder = new mOrder()
                {
                    OrderId      = _order.OrderId,
                    OwnerEmail   = AccountService.Instance.Current_Account.Email,
                    DeliveryTime = DeliveryTime,
                    Address1     = Address1,
                    Address2     = Address2,
                    PhoneNumber  = PhoneNumber,
                    Name         = Name
                };

                var result = await OrderService.Instance.UpdateDetail(updateOrder);

                DialogService.HideLoading();

                if (result != "true")
                {
                    DialogService.ShowError(result);
                    return;
                }
                CrossSettings.Current.AddOrUpdateValue <bool>("StatusUpdate", true);
                DialogService.ShowSuccess("Order Updated");
            }
            catch (Exception ex)
            {
                Crashes.TrackError(ex);
            }
            finally { IsBusy = true; isUpdatable = false; }
        }
Example #10
0
 public async void OnSelectedPage(Page page)
 {
     if (_selectedPage.NavigationUri != page.NavigationUri)
     {
         _selectedPage = page;
         await NavigationService.NavigateAsync($"{NavigationConstants.NavigationPage}/{page.NavigationUri}");
     }
     else
     {
         await DialogService.DisplayAlert(StringConstants.Error, $"{page.Name} is already on screen", StringConstants.Ok);
     }
 }
Example #11
0
        private async void NavigateNotfiy(mPushNotify note)
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            DialogService.ShowLoading("Please wait");

            if (note.Type == Keys.NotifyTypes[0])//item
            {
            }
            else if (note.Type == Keys.NotifyTypes[1]) //question
            {
                if (note.Why == Keys.NotifyWhys[2])    //answer-question
                {
                    var question = await QuestionService.Instance.FetchQuestion(note.Objecter);

                    DialogService.HideLoading();

                    var response = await DialogService.DisplayAlert("View item", "Dismiss", "Q:" + question.Question, "A:" + question.Answer);

                    if (!response)
                    {
                        return;
                    }

                    DialogService.ShowLoading("Relocating");

                    var item = await ItemService.Instance.FetchItem(question.ProductId);

                    DialogService.HideLoading();

                    await Current.MainPage.Navigation.PushAsync(new ItemView(item));
                }
            }
            else if (note.Type == Keys.NotifyTypes[2]) //order
            {
                if (note.Why == Keys.NotifyWhys[8])    //order-update
                {
                    var order = await OrderService.Instance.FetchOrder(note.Objecter);

                    DialogService.HideLoading();

                    DialogService.ShowToast(order.Status);
                    //await Current.MainPage.Navigation.PushAsync(new OrderDetail(order));
                    return;
                }
            }
        }
        public SettingsViewModel(IAppService appService)
        {
            AppService = appService;
            LoadSettings(appService.AppSettings);


            ClearStatistic = new Command(
                execute: async() =>
            {
                var displayAlert = new DialogService(Page);
                var changeTask   = await displayAlert.DisplayAlert("Clear Task Statistics", "All statistics about finished task will be deleted. Did you want to continue.", "ok", "cancel");
                if (!changeTask)
                {
                    return;
                }
                AppService.ClearStatistics();
            }
                );

            Save = new Command(
                execute: async() =>
            {
                var settings = this.CreatePomodoroSettings();
                if (settings != null)
                {
                    IsBusy      = true;
                    var isSaved = await AppService.SaveSettingsAsync(settings);
                    if (isSaved)
                    {
                        var notificator = DependencyService.Get <INotification>();
                        notificator.Show("Saved.");
                    }
                    IsBusy = false;
                }
            }
                );

            LoadDefault = new Command(
                execute: async() =>
            {
                var settings = AppConstants.DEFAULT_APP_SETTINGS;
                if (settings != null)
                {
                    this.IsBusy = true;
                    await AppService.SaveSettingsAsync(settings);
                    this.LoadSettings(settings);
                    this.IsBusy = false;
                }
            }
                );
        }
Example #13
0
        public async void Cancel_Order()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                DialogService.ShowLoading("Canceling Order");
                var result = await OrderService.Instance.CancelOrder(_order);

                DialogService.HideLoading();

                if (result == "true")
                {
                    _order.Status = Keys.NotifyWhys[4];
                    CrossSettings.Current.AddOrUpdateValue <bool>("StatusUpdate", true);
                    //DialogService.HideLoading();
                    DialogService.ShowSuccess("Order Canceled");
                    await _pageService.PopAsync();

                    return;
                }

                if (result == "Grace Peroid Is Finish")   //Client Side State still giving cancel status
                {
                    // DialogService.HideLoading();
                    var res = await DialogService.DisplayAlert(Strings.Contact_Us, Strings.Close, Strings.Cancelation, Strings.Cancelation_Period_Ended);

                    if (res)
                    {
                        await _pageService.PushAsync(new ContactUs());
                    }

                    return;
                }

                DialogService.ShowError(result);
            }catch (Exception ex)
            {
                Debug.WriteLine(Keys.TAG + ex);
                DialogService.ShowError(Strings.SomethingWrong);
                Crashes.TrackError(ex);
                await _pageService.PopAsync();
            }
            finally { IsBusy = false; }
        }
Example #14
0
        public async void DisplaysAlertWithResponse()
        {
            var page = new Mock <IPage>();

            page.Setup(x => x.DisplayAlert(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()))
            .ReturnsAsync(true);

            var dialogService = new DialogService(page.Object);

            var answer = await dialogService.DisplayAlert("Question?", "Would you like to play a game", "Yes", "No");

            page.Verify(x => x.DisplayAlert("Question?", "Would you like to play a game", "Yes", "No"));
            Assert.That(answer, Is.True);
        }
Example #15
0
 public async Task GetIncomesTypes()
 {
     try
     {
         Types = new List <IncomeType>(await DatabaseService.GetAllIncomeTypes());
         IncomeTypeSelected = Types.FirstOrDefault();
     }
     catch (ArgumentException ex)
     {
         await DialogService.DisplayAlert(StringConstants.Error, $"Cannot get all the income types. {StringConstants.Error}: {ex.Message}", StringConstants.Ok);
     }
     catch (Exception ex)
     {
         await DialogService.DisplayAlert(StringConstants.Error, ex.Message, StringConstants.Ok);
     }
 }
        private async void DeleteItem(object item)
        {
            var displayAlert = new DialogService(Page);
            var changeTask   = await displayAlert.DisplayAlert("Delete Task", "Task will be deleted. Did you want to continue.", "ok", "cancel");

            if (!changeTask)
            {
                return;
            }

            var deletedTask = item as UserTask;
            var result      = await AppService.RemoveUserTask(deletedTask);

            if (result)
            {
                UserTasks.Remove(deletedTask);
            }
        }
        public async Task <byte[]> GetProfileImage(string action)
        {
            await CrossMedia.Current.Initialize();


            MediaFile file = null;

            // var action = await DialogService.DisplayActionSheet("Image Options", "Cancel", null, "Selected Picture", "Take Picture");

            if (action == "Selected Picture")
            {
                file = await CrossMedia.Current.PickPhotoAsync(new Plugin.Media.Abstractions.PickMediaOptions
                {
                    CompressionQuality = 50,
                    PhotoSize          = PhotoSize.Medium
                });
            }
            else if (action == "Take Picture")
            {
                if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
                {
                    await DialogService.DisplayAlert("Ok", "OK", "No Camera", ":( No camera available");

                    return(null);
                }
                // DialogService.ShowToast("Not Available");
                file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions
                {
                    CompressionQuality = 100,
                    PhotoSize          = PhotoSize.Full
                });
            }

            if (file == null)
            {
                return(null);
            }

            byte[] resizedImage = await CrossImageResizer.Current.ResizeImageWithAspectRatioAsync(file.GetStream(), 1000, 1000);

            file.Dispose();
            bProfileImage = resizedImage;
            return(resizedImage);
        }
Example #18
0
        private async Task DeleteItemAction(mUserItem item)
        {
            var response = await DialogService.DisplayAlert("Yes", "No", "Delete Item", "Are you sure?");

            if (!response)
            {
                return;
            }

            try
            {
                if (IsBusy)
                {
                    return;
                }
                IsBusy = true;


                DialogService.ShowLoading("Deleting Item");

                var result = await ItemService.Instance.DeleteItem(item.Id);

                DialogService.HideLoading();
                if (result == "true")
                {
                    DialogService.ShowToast("Item Deleted");
                    return;
                }
                else
                {
                    DialogService.ShowError(result);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(Keys.TAG + ex);
                DialogService.ShowError(Strings.SomethingWrong);
                Crashes.TrackError(ex);
            }
            finally { IsBusy = false; }
        }
Example #19
0
        protected override bool OnBackButtonPressed()
        {
            bool exitapp  = true;;
            var  previous = PageProvider.Back();

            if (previous == null)
            {
                if (AppMainService.Instance.PomodoroStatus?.TimerState == Enums.TimerState.Running)
                {
                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        var displayAlert      = new DialogService(Detail);
                        var cancelRunnigTimer = await displayAlert.DisplayAlert("Cancel Timer", "Running timer will be stopped. Do you want to continue ?", "ok", "cancel");
                        if (cancelRunnigTimer)
                        {
                            AppMainService.Instance.StopPomodoro();
                            exitapp = true;
                        }
                        else
                        {
                            exitapp = false;
                        }
                        if (exitapp)
                        {
                            OnBackButtonPressed();
                        }
                    });
                    return(true);
                }
                else
                {
                    base.OnBackButtonPressed();
                    return(false);
                }
            }
            else
            {
                Detail = previous;
                return(true);
            }
        }
Example #20
0
        public async void OnInsertIncome()
        {
            try
            {
                double value = Math.Round(Convert.ToDouble(Value), 2);

                Income newIncome = await DatabaseService.InsertIncome(IncomeTypeSelected.TypeId, Concept, value, Date);

                newIncome.IncomeType = IncomeTypeSelected;

                _incomes.Add(newIncome);

                await DialogService.DisplayAlert("Add income", "Income added succesfully", StringConstants.Ok);

                OnClear();
            }
            catch (ArgumentException ex)
            {
                await DialogService.DisplayAlert(StringConstants.Error, $"{StringConstants.AddIncomeErrorMsg} {StringConstants.Error}: {ex.Message}", StringConstants.Ok);
            }
        }
        private async Task DeleteCategoryAsync()
        {
            var delete = await DialogService.DisplayAlert("Delete category", "Are you sure you want to delete category", "Ok", "Cancel");

            if (delete)
            {
                await DialogService.DisplayPopupAsync();

                await FirebaseService.DeleteCategoryAsync(Category);

                IsUpdated = true;

                var parameters = new NavigationParameters
                {
                    { "IsUpdated", IsUpdated }
                };

                await DialogService.DisplayPopupAsync();

                await NavigationService.GoBackToRootAsync(parameters);
            }
        }
Example #22
0
        private async void DeleteItemAction(object itemName)
        {
            var sure = await DialogService.DisplayAlert("Yes", "No", "Deleting Item", "Are you sure you want to delete the item");

            if (!sure)
            {
                return;
            }

            try
            {
                mUserItem listitem = (from itm in MyItemList
                                      where itm.Name == itemName.ToString()
                                      select itm)
                                     .FirstOrDefault <mUserItem>();

                MyItemList.Remove(listitem);
                OnPropertyChanged("RevMyItems");
                var result = await ItemService.Instance.DeleteItem(listitem.Id);

                if (result == "true")
                {
                    DialogService.ShowToast("Item Deleted");
                    Debug.WriteLine("DELETED");
                    return;
                }
                else
                {
                    DialogService.ShowError(result);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(Keys.TAG + ex);
                DialogService.ShowError(Strings.SomethingWrong);
                Crashes.TrackError(ex);
            }
        }
Example #23
0
        private async void CancelOrder_Tapped(object sender, EventArgs e)
        {
            if (_order.Status == Keys.OrderStatus[6])//Canceled
            {
                DialogService.ShowToast("Item Canceled Already");
                return;
            }
            var result = await DisplayAlert("Cancel Order", "Are You Sure?", "Yes", "No");

            if (!result)
            {
                return;
            }

            if (_order.Status == Keys.OrderStatus[4])//Transit
            {
                var toContact = await DialogService.DisplayAlert("Contact", "Nevermind", "Contact to Cancel", "Item is Already in Transit, Please Contact us ASAP if you would like to cancel");

                if (!toContact)
                {
                    return;
                }

                await Navigation.PushAsync(new ContactUs());

                return;
            }

            if (_order.Status == Keys.OrderStatus[5])//Delivered
            {
                DialogService.ShowToast("Item Already Delivered");
                return;
            }

            viewModel.Cancel_Order();
        }
Example #24
0
        private async void CheckOutAction()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            DialogService.ShowLoading("Proccesing");

            try
            {
                //double AddonTotal = 0;

                //for(var i=0; i < MyCartList.Count; i++)
                //{
                //    if (MyCartList[i].Addon == "true")
                //    {
                //        AddonTotal = AddonTotal + (Convert.ToDouble(MyCartList[i].Price) * Convert.ToInt16(MyCartList[i].Quantity));

                //    }
                //    else   //MAYBE
                //    {
                //        if ((Convert.ToDouble(MyCartList[i].Price) * Convert.ToInt16(MyCartList[i].Quantity)) > 24.00)
                //            break;
                //    }
                //    if ((i + 1) == MyCartList.Count)
                //    {
                //        DialogService.HideLoading();

                //        if (Convert.ToDouble(GrandPrice) > 44.00) break;

                //        if (AddonTotal < 44.00)
                //        {
                //            await DialogService.DisplayAlert(null, Strings.Ok, "Info", "You only have Addons in your Cart, Please add an item over 25 XCD or make addon items addup over 45 XCD");
                //            return;
                //        }

                //    }

                //}

                if (!(Convert.ToDouble(GrandPrice) > 24.00))
                {
                    DialogService.HideLoading();
                    await DialogService.DisplayAlert(null, Strings.Ok, "Info", "Cart Total Most be $25.00 Or Over");

                    return;
                }


                var address = await AddressService.Instance.FetchAddresses(AccountService.Instance.Current_Account.Email, 1, 0);

                DialogService.HideLoading();

                bool   useCard          = false; //temp
                string payment_response = await DialogService.DisplayActionSheet("Payment Methods", "Close", null, Strings.Cash_On_Delivery, Strings.Credit_Debit_Card);

                if (payment_response == Strings.Credit_Debit_Card)
                {
                    useCard = true;
                    //DialogService.ShowToast("Not Available At The Moment");
                    ///return;
                }
                else if (payment_response == Strings.Cash_On_Delivery)
                {
                    useCard = false;
                }
                else
                {
                    return;
                }


                if (address == null)
                {
                    await _pageService.PushAsync(new ConfirmOrder(null, MyCartList, null, useCard));

                    return;
                }
                await _pageService.PushAsync(new ConfirmOrder(address[0], MyCartList, null, useCard));
            }
            catch (Exception ex)
            {
                Debug.WriteLine(Keys.TAG + ex);
                DialogService.ShowError(Strings.SomethingWrong);
                Crashes.TrackError(ex);
            }
            finally { IsBusy = false; }
        }
 private void DisplayAlertDialog()
 {
     DialogService.DisplayAlert(AppResources.HelloWorldMessage);
 }
Example #26
0
        public HomeViewModel(IAppService appService)
        {
            AppService = appService;
            TickCount  = 90;

            PomodoroDuration = AppService.PomodoroSettings.PomodoroDuration;
            ActiveTask       = AppService.ActiveTask;

            UserTasks = new ObservableCollection <UserTaskViewModel>(AppService.UserTasks.Select(x => new UserTaskViewModel(x)));
            TimerInfo = appService.PomodoroStatus ?? new PomdoroStatus()
            {
                PomodoroState = PomodoroState.Ready, TimerState = TimerState.Stoped
            };

            AppService.UserTaskRemovedEvent            += OnUserTaskRemoved;
            AppService.TimerFinishedEvent              += OnTimerFinished;
            AppService.UserTaskModifiedEvent           += OnUserTaskUpdate;
            AppService.AppResumedEvent                 += OnAppResumed;
            AppService.PomodoroTimerStatusChangedEvent += OnPomodoroStatusChanged;

            LoadState(TimerInfo);
            ChangeTask = new Command(
                execute: async(o) =>
            {
                if (o is UserTaskViewModel userTaskViewModel)
                {
                    if (userTaskViewModel.Id == ActiveTask.Id)
                    {
                        return;
                    }

                    if (TimerInfo.TimerState == TimerState.Running)
                    {
                        var displayAlert = new DialogService(Page);
                        var changeTask   = await displayAlert.DisplayAlert("Change Task", "Pomodoro will be cancelled. Did you want to continue", "ok", "cancel");
                        if (!changeTask)
                        {
                            return;
                        }
                    }

                    ActiveTask = userTaskViewModel.UserTask;
                    AppService.SetActiveTask(userTaskViewModel.UserTask);

                    RemainingTimeValue      = TimeSpan.Zero;
                    TimerInfo.PomodoroState = PomodoroState.Ready;
                    OnPropertyChanged("TimerInfo");
                }
            }
                );

            SetTimerStatus = new Command(
                execute: () =>
            {
                if (TimerInfo.PomodoroState == PomodoroState.Pomodoro && TimerInfo.TimerState == TimerState.Running)
                {
                    TimerInfo = AppService.PausePomodoro();
                    PauseTimerTick();
                }
                else
                {
                    TimerInfo = AppService.StartPomodoro();
                    StartTimerTick();
                }
            }
                );

            StopTimer = new Command(
                execute: () =>
            {
                TimerInfo.TimerState    = TimerState.Stoped;
                TimerInfo.PomodoroState = PomodoroState.Ready;
                OnPropertyChanged("TimerInfo");

                RemainingTimeValue = TimeSpan.Zero;
                Tick = 0;
                AppService.StopPomodoro();
                StopTimerTick();
            }
                );
        }
 private void OnDisplayAlertCommandExecuted()
 {
     DialogService.DisplayAlert("This is sample alert.");
 }
Example #28
0
        private async void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            var item = e.SelectedItem as mNotify;

            if (item != null)
            {
                if (item.Why == Keys.NotifyWhys[9])//rate
                {
                    DialogService.ShowLoading("Please wait");
                    mOrder order = await OrderService.Instance.FetchOrder(item.Objecter);

                    DialogService.HideLoading();

                    if (order == null)
                    {
                        return;
                    }

                    await Navigation.PushAsync(new RateList(order));
                }
                else if (item.Type == Keys.NotifyTypes[2]) //order
                {
                    DialogService.ShowLoading("Please wait");
                    mOrder order = await OrderService.Instance.FetchOrder(item.Objecter);

                    DialogService.HideLoading();

                    if (order == null)
                    {
                        return;
                    }

                    await Navigation.PushAsync(new OrderDetail(order));
                }
                else if (item.Why == Keys.NotifyWhys[2])//answer-question
                {
                    mQuestion question2 = await QuestionService.Instance.FetchQuestion(item.Objecter);

                    var response = await DialogService.DisplayAlert("View item", "Dismiss", "Q:" + question2.Question, "A:" + question2.Answer);

                    listView.SelectedItem = null;
                    if (!response)
                    {
                        return;
                    }

                    DialogService.ShowLoading("Relocating");
                    if (question2.IsItem == "True")
                    {
                        var Titem = await ItemService.Instance.FetchItem(question2.ProductId);

                        DialogService.HideLoading();

                        await Navigation.PushAsync(new ItemView(Titem));
                    }
                    else
                    {
                        var Tproduct = await ProductService.Instance.FetchProduct(question2.ProductId);

                        DialogService.HideLoading();

                        await Navigation.PushAsync(new ProductView(Tproduct));
                    }
                }
                else
                {
                    viewModel.NotifyAction(item);
                }
            }

            listView.SelectedItem = null;
        }