Exemple #1
0
        /*
         *
         *      private void PopUpNotification(int id, string title, string message){
         *              Notification.Builder mBuilder =
         *                      new Notification.Builder (this)
         *                              .SetSmallIcon (Resource.Drawable.ic_notification)
         *                              .SetContentTitle (title)
         *                              .SetContentText (message)
         *                              .SetAutoCancel (true);
         *              // Creates an explicit intent for an Activity in your app
         *              Intent resultIntent = new Intent(this, typeof(MainActivity));
         *              resultIntent.SetFlags(ActivityFlags.NewTask|ActivityFlags.ClearTask);
         *              // The stack builder object will contain an artificial back stack for the
         *              // started Activity.
         *              // This ensures that navigating backward from the Activity leads out of
         *              // your application to the Home screen.
         *              var stackBuilder = Android.App.TaskStackBuilder.Create(this);
         *              // Adds the back stack for the Intent (but not the Intent itself)
         *              //stackBuilder.AddParentStack();
         *              // Adds the Intent that starts the Activity to the top of the stack
         *              stackBuilder.AddNextIntent(resultIntent);
         *              PendingIntent resultPendingIntent =
         *                      stackBuilder.GetPendingIntent(
         *                              0,
         *                              PendingIntentFlags.UpdateCurrent
         *                      );
         *              mBuilder.SetContentIntent(resultPendingIntent);
         *
         *
         *
         *              NotificationManager mNotificationManager =
         *                      (NotificationManager) GetSystemService(Context.NotificationService);
         *              // mId allows you to update the notification later on.
         *              mNotificationManager.Notify(id, mBuilder.Build());
         *      }
         */

        private void CrunchDates(bool startup = false)
        {
            if (!Utils.IsSameDay)
            {
                //save our day from yesterday, we dont' do datetime.adddays(-1) because phone might have been off
                //for more then 1 day and it would not be correct!
                var yesterday = Helpers.Settings.CurrentDay;
                var dayEntry  = StepEntryManager.GetStepEntry(yesterday);
                if (dayEntry == null || dayEntry.Date.DayOfYear != yesterday.DayOfYear)
                {
                    dayEntry = new StepEntry();
                }

                dayEntry.Date  = yesterday;
                dayEntry.Steps = Helpers.Settings.CurrentDaySteps;

                Helpers.Settings.CurrentDay       = DateTime.Today;
                Helpers.Settings.CurrentDaySteps  = 0;
                Helpers.Settings.StepsBeforeToday = Helpers.Settings.TotalSteps;
                StepsToday = 0;
                try{
                    StepEntryManager.SaveStepEntry(dayEntry);
                }catch (Exception ex) {
                    Console.WriteLine("Something horrible has gone wrong attempting to save database entry, it is lost forever :(");
                }
            }
            else if (startup)
            {
                StepsToday = Helpers.Settings.TotalSteps - Helpers.Settings.StepsBeforeToday;
            }
        }
Exemple #2
0
        private void MovePanelRight(int panelIndex)
        {
            if (panelIndex >= Steps.Count - 1)
            {
                throw new InternalError("Invalid panel index");
            }
            StepEntry panel = Steps[panelIndex];

            Steps.RemoveAt(panelIndex);
            Steps.Insert(panelIndex + 1, panel);
            _ActiveTab = panelIndex + 1;
        }
Exemple #3
0
        private void MovePanelLeft(int panelIndex)
        {
            if (panelIndex <= 0)
            {
                throw new InternalError("Invalid panel index");
            }
            StepEntry panel = Steps[panelIndex];

            Steps.RemoveAt(panelIndex);
            Steps.Insert(panelIndex - 1, panel);
            _ActiveTab = panelIndex - 1;
        }