Пример #1
0
 protected void RaisePunchPressed(PunchType punch)
 {
     if (PunchPressed != null)
     {
         PunchPressed(this, punch);
     }
 }
Пример #2
0
        private void OnPunchPressed(object sender, PunchType punch)
        {
            App.Inst.Workday.Punch(punch);
            App.Inst.LastPunch = punch;

            if (punch.PunchCategory == Category.Meta && punch.StartorEnd == StartEnd.End)
            {
                EndWorkday();
            }

            WorkdayView.Workday = App.Inst.Workday;
            WorkdayView.ScrollToEnd();
        }
Пример #3
0
        private void LayoutRoot_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count != 1)
            {
                return;
            }
            //else
            PunchType punch = (PunchType)e.AddedItems[0];

            VisiblePunchTypes = punch.FilterNext(PunchTypes);
            RaisePunchPressed(punch);
            LayoutRoot.SelectedIndex = -1;
            LayoutRoot.ScrollIntoView(LayoutRoot.Items[0]);
        }
Пример #4
0
 public void Punch(PunchType p)
 {
     if (p.PunchCategory == Category.Meta)
     {
         if (p.StartorEnd == StartEnd.Start)
         {
             StartTime = DateTime.Now;
         }
         else
         {
             EndTime = DateTime.Now;
         }
     }
     else if (p.StartorEnd == StartEnd.Start) //we've started a project or break.
     {
         //check that there aren't any unended segments.
         if (WorkSegments.Count > 0)
         {
             PunchSegment segment = WorkSegments[WorkSegments.Count - 1];
             if (!segment.Ended)
             {
                 //auto-fill in the blank.
                 segment.EndTime  = DateTime.Now;
                 segment.EndLabel = "End " + (p.PunchCategory == Category.Break ? "Break" : "Project");
             }
         }
         //make a new segment and start it.
         PunchSegment newSeg = new PunchSegment();
         newSeg.StartLabel      = p.Label;
         newSeg.SegmentCategory = p.PunchCategory;
         newSeg.StartTime       = DateTime.Now;
         WorkSegments.Add(newSeg);
     }
     else if (p.StartorEnd == StartEnd.End)
     {
         //if the segment types don't match throw an exception.
         PunchSegment segment = WorkSegments[WorkSegments.Count - 1];
         if (segment.SegmentCategory != p.PunchCategory)
         {
             throw new Exception("Current Segment Type does not match the punch type.");
         }
         //otherwise
         if (!segment.Ended)
         {
             segment.EndLabel = p.Label;
             segment.EndTime  = DateTime.Now;
         }
     }
 }
Пример #5
0
 protected void RaisePunchPressed(PunchType punch)
 {
     if (PunchPressed != null)
         PunchPressed(this, punch);
 }
Пример #6
0
 public void SetLastPunch(PunchType punch)
 {
     VisiblePunchTypes = punch.FilterNext(PunchTypes);
 }
Пример #7
0
        private void OnPunchPressed(object sender, PunchType punch)
        {
            App.Inst.Workday.Punch(punch);
            App.Inst.LastPunch = punch;

            if (punch.PunchCategory == Category.Meta && punch.StartorEnd == StartEnd.End)
            {
                EndWorkday();
            }

            WorkdayView.Workday = App.Inst.Workday;
            WorkdayView.ScrollToEnd();
        }
Пример #8
0
 public void Punch(PunchType p)
 {
     if (p.PunchCategory == Category.Meta)
     {
         if (p.StartorEnd == StartEnd.Start)
         {
             StartTime = DateTime.Now;
         }
         else
         {
             EndTime = DateTime.Now;
         }
     }
     else if (p.StartorEnd == StartEnd.Start) //we've started a project or break.
     {
         //check that there aren't any unended segments.
         if (WorkSegments.Count > 0)
         {
             PunchSegment segment = WorkSegments[WorkSegments.Count - 1];
             if (!segment.Ended)
             {
                 //auto-fill in the blank.
                 segment.EndTime = DateTime.Now;
                 segment.EndLabel = "End " + (p.PunchCategory == Category.Break ? "Break" : "Project");
             }
         }
         //make a new segment and start it.
         PunchSegment newSeg = new PunchSegment();
         newSeg.StartLabel = p.Label;
         newSeg.SegmentCategory = p.PunchCategory;
         newSeg.StartTime = DateTime.Now;
         WorkSegments.Add(newSeg);
     }
     else if (p.StartorEnd == StartEnd.End)
     {
         //if the segment types don't match throw an exception.
         PunchSegment segment = WorkSegments[WorkSegments.Count - 1];
         if (segment.SegmentCategory != p.PunchCategory)
             throw new Exception("Current Segment Type does not match the punch type.");
         //otherwise
         if (!segment.Ended)
         {
             segment.EndLabel = p.Label;
             segment.EndTime = DateTime.Now;
         }
     }
 }
Пример #9
0
 public void SetLastPunch(PunchType punch)
 {
     VisiblePunchTypes = punch.FilterNext(PunchTypes);
 }