Пример #1
0
        }//end uxGroupView_CellEditFinished event handler

        /// <summary>
        /// Updates the group manager based off of a list of timedInstances
        /// </summary>
        private void UpdateGroupManager(TypedObjectListView<TimedInstance> times,
            TimeGroupManager timeGroupManager)
        {
            TimeGroupManager newManager = new TimeGroupManager();

            foreach(TimedInstance time in times.Objects)
            {
                newManager.AddTime(time, time.CurrentGroup.GroupName);
            }//end looping over all the times from the listview

            timeGroupManager = newManager;
        }//end UpdateGroupManager
Пример #2
0
        }//end constructor

        /// <summary>
        /// handler for adding previous times from the stuff
        /// </summary>
        private void uxAddPrevTimeBtn_Click(object sender, EventArgs e)
        {
            DateTime start;
            DateTime end;

            DateTime startDate;
            DateTime endDate;

            TimeSpan startTime;
            TimeSpan endTime;

            TimedInstance timedInstance;

            

            if (specifyDate)
            {
                //get our stuff from DateTimePickers
                startDate = uxStartDatePicker.Value.Date;
                endDate = uxEndDatePicker.Value.Date;
                startTime = uxStartTimePicker.Value.TimeOfDay;
                endTime = uxEndTimePicker.Value.TimeOfDay;
                
                //put that stuff into start and end DateTimes
                start = startDate.Add(startTime);
                end = endDate.Add(endTime);

                //make sure we don't have a negative
                while (start.Ticks > end.Ticks)
                    end = end.AddDays(1);

                //create our timed instance
                timedInstance = new TimedInstance(start, end)
                {
                    printDate = true
                };
            }//end if we're specifying the date
            else
            {
                if (specifyBeginEnd)
                {
                    //get our stuff from DateTimePickers
                    startDate = DateTime.Now;
                    endDate = DateTime.Now;
                    startTime = uxStartTimePicker.Value.TimeOfDay;
                    endTime = uxEndTimePicker.Value.TimeOfDay;

                    //put that stuff into start and end DateTimes
                    start = startDate.Add(startTime);
                    end = endDate.Add(endTime).AddMinutes(1);

                    //make sure we don't have a negative
                    while (start.Ticks > end.Ticks)
                        end = end.AddDays(1);

                    //create our timed instance
                    timedInstance = new TimedInstance(start, end)
                    {
                        printDate = false
                    };
                }//end if we care about the beginning and end
                else
                {
                    //create our timed instance
                    timedInstance = new TimedInstance((int)uxPrevHourInputNUD.Value, (int)uxPrevMinuteInputNUD.Value)
                    {
                        printDate = false
                    };
                }//end else we don't care about beginning and end
            }//end else we don't care about the date

            //get the name of the instance
            timedInstance.InstanceName = uxTimeNameTextBox.Text == "" ? "Unnamed Instance" : uxTimeNameTextBox.Text;
            //reset text in the textbox
            uxTimeNameTextBox.ResetText();

            if (uxGroupsGroup.Visible)
            {
                string groupText = uxGroupNameTextBox.Text;

                //figure out if it's just white space
                bool foundNonSpace = false;
                foreach (char chr in groupText)
                {
                    if (!Char.IsWhiteSpace(chr))
                    {
                        foundNonSpace = true;
                        break;
                    }//end if this is not white space
                }//end foreach

                //make changes if it is just white space
                if (!foundNonSpace) groupText = "Ungrouped";

                groupManager.AddTime(timedInstance, groupText);

                UpdateListViews(true);
            }//end if we're doing groups right now
            else
            {
                groupManager.AddTime(timedInstance, "Ungrouped");

                UpdateListViews(false);
            }//end else we aren't doing groups rn
        }//end uxAddPrevTimeBtn Click event handler