Esempio n. 1
0
        /// <summary>
        /// Invoked when application execution is being suspended.  Application state is saved
        /// without knowing whether the application will be terminated or resumed with the contents
        /// of memory still intact.
        /// </summary>
        /// <param name="sender">The source of the suspend request.</param>
        /// <param name="e">Details about the suspend request.</param>
        private void OnSuspending(object sender, SuspendingEventArgs e)
        {
            var deferral = e.SuspendingOperation.GetDeferral();

            //TODO: Save application state and stop any background activity
            SharedInfo.saveSessions();
            Paramaters.savePreferencesData();
            deferral.Complete();
        }
Esempio n. 2
0
 private void App_Suspending(object sender, SuspendingEventArgs e)
 {
     try
     {
         SharedInfo.saveSessions();
         Paramaters.savePreferencesData();
         //  Paramaters.saveTime(hours, minutes);
     }
     catch (Exception) { }
 }
Esempio n. 3
0
        private void endingWorkSession()
        {
            //ending worksession
            dispatcherTimer.Stop();

            //TODO  -------end Worksession
            wks = new WorkSession();
            wks.StartWorkTime     = WorkSessionStartTime;
            wks.Title             = "Work";
            wks.Description       = "Same Stuff , Different Day : converting coffee and food into service and code";
            wks.EndWorkTime       = DateTime.Now;
            wks.TimeLeftInMinutes = (hours * 60 + minutes + 1);
            wks.DurationInMinutes = timesTicked / 60;
            wks.percentageOfWork  = (timesTicked * 100)
                                    / (hours * 3600 + minutes * 60 + seconds + timesTicked);

            //check states
            wks.overallState = 0;

            if (comfortableToggleButton.IsChecked.Value)
            {
                wks.Comfortable = true; wks.overallState++; wks.comforImage = "Assets/cutomPics/Sofa-c.png";
            }
            else
            {
                wks.Comfortable = false; wks.overallState--;
            }

            if (noiseToggleButton.IsChecked.Value)
            {
                wks.Noise = true; wks.overallState--; wks.noiseImage = "Assets/cutomPics/Horn-02-WF-c.png";
            }
            else
            {
                wks.Noise = false; wks.overallState++;
            }

            if (stressedToggleButton.IsChecked.Value)
            {
                wks.Stressed = true; wks.overallState--; wks.stressImage = "Assets/cutomPics/stressed-c.png";
            }
            else
            {
                wks.Stressed = false; wks.overallState++;
            }

            if (tiredToggleButton.IsChecked.Value)
            {
                wks.Tired = true; wks.overallState--; wks.tiredImage = "Assets/cutomPics/tired-c.png";
            }
            else
            {
                wks.Tired = false; wks.overallState++;
            }

            if (onDeskToggleButton.IsChecked.Value)
            {
                wks.OnDesk = true; wks.overallState++; wks.deskImage = "Assets/cutomPics/Student-Laptop-c.png";
            }
            else
            {
                wks.OnDesk = false; wks.overallState--;
            }


            //--- add to  sessions list in DB
            //  DataBaseController.insertData(wks);
            if (SharedInfo.myWorkSessions == null)
            {
                SharedInfo.myWorkSessions = new System.Collections.Generic.List <WorkSession>();
            }

            SharedInfo.myWorkSessions.Insert(0, wks);
            SharedInfo.saveSessions();
        }
Esempio n. 4
0
        private void goBack(object sender, TappedRoutedEventArgs e)
        {
            SharedInfo.saveSessions();

            Frame.Navigate(typeof(MainPage));
        }