Exemple #1
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            try
            {
                MovementListTbl tbl = await App.mvDatabase.GetItemAsync(MovementPage.SelectedExerciseid);

                if (tbl == null)
                {
                    tbl = new MovementListTbl();
                }
                obj                 = new MovementListMdl(tbl);
                ExeTitle.Text       = obj.MoveTitle;
                ExeImage.Source     = obj.ImageName;
                ExeDescription.Text = obj.Description;
                ExeDuration.Text    = obj.Duration;
                SwitchActive.Source = obj.MoveIcon;
                if (obj.Selected == true)
                {
                    ExeActive.Text = "Select";
                }
                else
                {
                    ExeActive.Text = "Unselect";
                }
            }
            catch (Exception ex)
            {
                StaticMethods.ShowToast(ex.Message);
            }
        }
Exemple #2
0
        public async void LoadData()
        {
            ObservableCollection <MovementListMdl> movementListMdlList = null;

            MainListView.ItemsSource = null;
            try
            {
                // Reset the 'resume' id, since we just want to re-start here
                ((App)App.Current).ResumeAtMoveId = -1;
                List <MovementListTbl> movementListTbl = await App.mvDatabase.GetItemsAsync();

                //foreach (var item in movementListTbl)
                //{
                //    await App.mvDatabase.DeleteItemAsync(item);
                //}
                if (movementListTbl.Count == 0)
                {
                    movementListMdlList = MovementListMdl.GetPerdefinedList();
                    foreach (MovementListMdl movementListMdl in movementListMdlList)
                    {
                        await App.mvDatabase.SaveItemAsync1(movementListMdl.GetTable());
                    }
                    movementListTbl = await App.mvDatabase.GetItemsAsync();
                }
                MainListView.ItemsSource = movementListTbl;
            }
            catch (Exception ex)
            {
                StaticMethods.ShowToast(ex.Message);
            }
            finally
            {
                movementListMdlList = null;
            }
        }
        private async void prepairNotification()
        {
            try
            {
                fillSchedule();
                await fillExercise();

                currentSelectedExercise = movementListMdl.FirstOrDefault();
                if (currentSelectedExercise != null)
                {
                    TimeSpan DayStarts   = new TimeSpan(scheduleMdl.DayStarts.Ticks);
                    TimeSpan DayEnds     = new TimeSpan(scheduleMdl.DayEnds.Ticks);
                    TimeSpan currenttime = DateTime.Now.TimeOfDay;
                    string   currentDay  = DateTime.Now.ToString("dddd");

                    if (DayStarts <= currenttime && DayEnds > currenttime)
                    {
                        if ((currentDay == Sunday && scheduleMdl.Sun == true) || (currentDay == Monday && scheduleMdl.Mon == true) || (currentDay == Tuesday && scheduleMdl.Tue == true) || (currentDay == Wednesday && scheduleMdl.Wed == true) || (currentDay == Thursday && scheduleMdl.Thu == true) || (currentDay == Friday && scheduleMdl.Fri == true) || (currentDay == Saturday && scheduleMdl.Sat == true))
                        {
                            int reminder = (int)(currenttime.TotalMinutes % scheduleMdl.MoveFreq_Int);
                            // reminder = 0;
                            if (reminder == 0 || currenttime == DayStarts)
                            {
                                if (snoozeTime > 0)//skip current selected exercise because it's time is over
                                {
                                    SimpleStartedService.movementListMdl.Remove(SimpleStartedService.currentSelectedExercise);
                                    await fillExercise();

                                    currentSelectedExercise = movementListMdl.FirstOrDefault();
                                }

                                if (currentSelectedExercise != null)
                                {
                                    prepairMessageForNotification();
                                }
                            }
                            else
                            {
                                if (snoozeTime > 0)
                                {
                                    reminder = (int)(currenttime.TotalMinutes % snoozeTime);
                                    if (reminder == 0 || currenttime == DayStarts)
                                    {
                                        prepairMessageForNotification();
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (System.Exception e)
            {
                ExceptioHandler(e.Message, "prepairNotification");
            }
        }
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            try
            {
                MovementListTbl tbl = await App.mvDatabase.GetItemAsync(MovementListMdl.currentSelectedExerciseID);

                if (tbl == null)
                {
                    tbl = new MovementListTbl();
                }
                obj = new MovementListMdl(tbl);


                ExeTitle.Text       = obj.MoveTitle;
                ExeImage.Source     = obj.ImageName;
                ExeDescription.Text = obj.Description;
                ExeDuration.Text    = obj.Duration;
            }
            catch (Exception ex)
            {
            }
        }