Exemplo n.º 1
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            order = 0;
            order = Int16.Parse(e.Parameter.ToString());
            wks   = new WorkSession();
            wks   = SharedInfo.myWorkSessions.ElementAt(order);

            try
            { titleTextbox.Text       = wks.Title;
              descriptionTextBox.Text = wks.Description; }
            catch (Exception)
            {       }
        }
Exemplo n.º 2
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            order = 0;
            order= Int16.Parse(e.Parameter.ToString());
            wks = new WorkSession();
            wks = SharedInfo.myWorkSessions.ElementAt(order);

            try
            {    titleTextbox.Text = wks.Title;
                descriptionTextBox.Text = wks.Description;
            }
            catch (Exception)
            {       }
        }
Exemplo 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();
        }
        private void OnShareDataRequested(DataTransferManager sender, DataRequestedEventArgs args)
        {
            try
            {
                int indx = historyList.SelectedIndex;
                WorkSession wksession = new WorkSession();
                wksession = SharedInfo.myWorkSessions[indx];

                args.Request.Data.Properties.Title = wksession.Title;
                args.Request.Data.Properties.Description = wksession.Description;
                args.Request.Data.Properties.ApplicationName = "Rest Coach";

                {
                    string Duration_of_work;
                    float hours;
                    int workDurationInMinutes = wksession.DurationInMinutes;
                    if (workDurationInMinutes > 60)
                    {
                        hours = (float)workDurationInMinutes / (float)60;
                        Duration_of_work = hours + " Hours";
                    }
                    else
                    {
                        Duration_of_work = workDurationInMinutes + "Minutes";
                    }
                    string workState = "";

                    if (wksession.Stressed) workState += " Stressed, "; else workState += " Relaxed, ";
                    if (wksession.Tired) workState += " Tired, "; else workState += "Energized, ";
                    if (wksession.Comfortable) workState += "Comfortable, "; else workState += "Uncomfortable, ";
                    if (wksession.Noise) workState += "Annoyed and "; else workState += "In Silence and ";
                    if (wksession.OnDesk) workState += "Sitting on my Desk"; else workState += "Working on the go";

                    args.Request.Data.SetText(" Today, I worked on "+wksession.Title+
                        " and it was basically : \n" + wksession.Description
                        +"\n My work Session for "+wksession.EndWorkTime.Date.ToString("dd/MM/yy")+
                        " lasted  from "+wksession.StartWorkTime.ToString("HH:mm")+" to  "+wksession.EndWorkTime.ToString("HH:mm")
                        +".\n I was "+workState+" and I managed to finish "+ wksession.percentageOfWork+"% of  the total session time I had set for myself ! \n "
                        + "https://www.facebook.com/RestCoachApp/");
                    args.Request.Data.SetApplicationLink(new Uri("https://www.facebook.com/RestCoachApp/"));
                    args.Request.Data.SetWebLink(new Uri("https://www.facebook.com/RestCoachApp/"));
            //      args.Request.Data.SetHtmlFormat("");

                }

            }
            catch (Exception)
            {            }
        }
Exemplo n.º 5
0
        private void loadStats()
        {
            try
            {
                short Mon = 0, Tues = 0, Wed = 0, Thu = 0, Fri = 0, Sat = 0;
                count = SharedInfo.myWorkSessions.Count;
                for (int i = 0; i < count; i++)
                {
                    WorkSession w = new WorkSession();
                    w = SharedInfo.myWorkSessions[i];

                    if (w.Stressed)
                    {
                        Stressed++;
                    }
                    if (w.Tired)
                    {
                        Tired++;
                    }
                    if (w.Comfortable)
                    {
                        Comfortable++;
                    }
                    if (w.Noise)
                    {
                        Noise++;
                    }
                    if (w.OnDesk)
                    {
                        OnDesk++;
                    }

                    int dur = 0;
                    dur = w.DurationInMinutes;
                    int bonus = (int)(w.overallState * 0.2 * dur);

                    short totTime = 0;
                    totTime = (short)(dur + bonus);

                    if (w.EndWorkTime.DayOfWeek == DayOfWeek.Monday)
                    {
                        Mon += totTime;
                    }
                    if (w.EndWorkTime.DayOfWeek == DayOfWeek.Tuesday)
                    {
                        Tues += totTime;
                    }
                    if (w.EndWorkTime.DayOfWeek == DayOfWeek.Wednesday)
                    {
                        Wed += totTime;
                    }
                    if (w.EndWorkTime.DayOfWeek == DayOfWeek.Thursday)
                    {
                        Thu += totTime;
                    }
                    if (w.EndWorkTime.DayOfWeek == DayOfWeek.Friday)
                    {
                        Fri += totTime;
                    }
                    if (w.EndWorkTime.DayOfWeek == DayOfWeek.Saturday)
                    {
                        Sat += totTime;
                    }
                }
                makePieCharts();
                doCollumn(Mon, Tues, Wed, Thu, Fri, Sat);
            }
            catch (Exception)
            { }
        }
Exemplo n.º 6
0
        private void OnShareDataRequested(DataTransferManager sender, DataRequestedEventArgs args)
        {
            try
            {
                int         indx      = historyList.SelectedIndex;
                WorkSession wksession = new WorkSession();
                wksession = SharedInfo.myWorkSessions[indx];

                args.Request.Data.Properties.Title           = wksession.Title;
                args.Request.Data.Properties.Description     = wksession.Description;
                args.Request.Data.Properties.ApplicationName = "Rest Coach";

                {
                    string Duration_of_work;
                    float  hours;
                    int    workDurationInMinutes = wksession.DurationInMinutes;
                    if (workDurationInMinutes > 60)
                    {
                        hours            = (float)workDurationInMinutes / (float)60;
                        Duration_of_work = hours + " Hours";
                    }
                    else
                    {
                        Duration_of_work = workDurationInMinutes + "Minutes";
                    }
                    string workState = "";

                    if (wksession.Stressed)
                    {
                        workState += " Stressed, ";
                    }
                    else
                    {
                        workState += " Relaxed, ";
                    }
                    if (wksession.Tired)
                    {
                        workState += " Tired, ";
                    }
                    else
                    {
                        workState += "Energized, ";
                    }
                    if (wksession.Comfortable)
                    {
                        workState += "Comfortable, ";
                    }
                    else
                    {
                        workState += "Uncomfortable, ";
                    }
                    if (wksession.Noise)
                    {
                        workState += "Annoyed and ";
                    }
                    else
                    {
                        workState += "In Silence and ";
                    }
                    if (wksession.OnDesk)
                    {
                        workState += "Sitting on my Desk";
                    }
                    else
                    {
                        workState += "Working on the go";
                    }



                    args.Request.Data.SetText(" Today, I worked on " + wksession.Title +
                                              " and it was basically : \n" + wksession.Description
                                              + "\n My work Session for " + wksession.EndWorkTime.Date.ToString("dd/MM/yy") +
                                              " lasted  from " + wksession.StartWorkTime.ToString("HH:mm") + " to  " + wksession.EndWorkTime.ToString("HH:mm")
                                              + ".\n I was " + workState + " and I managed to finish " + wksession.percentageOfWork + "% of  the total session time I had set for myself ! \n "
                                              + "https://www.facebook.com/RestCoachApp/");
                    args.Request.Data.SetApplicationLink(new Uri("https://www.facebook.com/RestCoachApp/"));
                    args.Request.Data.SetWebLink(new Uri("https://www.facebook.com/RestCoachApp/"));
                    //      args.Request.Data.SetHtmlFormat("");
                }
            }
            catch (Exception)
            {            }
        }
        private void loadStats()
        {
            try
            {
                short Mon = 0, Tues = 0, Wed = 0, Thu = 0, Fri = 0, Sat = 0;
                count = SharedInfo.myWorkSessions.Count;
                for (int i = 0; i < count; i++)
                {
                    WorkSession w = new WorkSession();
                    w = SharedInfo.myWorkSessions[i];

                    if (w.Stressed) Stressed++;
                    if (w.Tired) Tired++;
                    if (w.Comfortable) Comfortable++;
                    if (w.Noise) Noise++;
                    if (w.OnDesk) OnDesk++;

                    int dur = 0;
                    dur = w.DurationInMinutes;
                    int bonus = (int)(w.overallState * 0.2 * dur);

                    short totTime = 0;
                    totTime = (short)(dur + bonus);

                    if (w.EndWorkTime.DayOfWeek == DayOfWeek.Monday) { Mon += totTime; }
                    if (w.EndWorkTime.DayOfWeek == DayOfWeek.Tuesday) { Tues += totTime; }
                    if (w.EndWorkTime.DayOfWeek == DayOfWeek.Wednesday) { Wed += totTime; }
                    if (w.EndWorkTime.DayOfWeek == DayOfWeek.Thursday) { Thu += totTime; }
                    if (w.EndWorkTime.DayOfWeek == DayOfWeek.Friday) { Fri += totTime; }
                    if (w.EndWorkTime.DayOfWeek == DayOfWeek.Saturday) { Sat += totTime; }
                }
                makePieCharts();
                doCollumn(Mon, Tues, Wed, Thu, Fri, Sat);
            }
            catch (Exception)
            { }
        }
Exemplo n.º 8
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();
 

        }