Example #1
0
        private void OnDayViewMouseClick(object sender, MouseEventArgs e)
        {
            if (m_DayView.ReadOnly)
            {
                return;
            }

            Calendar.Appointment appointment = m_DayView.GetAppointmentAt(e.Location.X, e.Location.Y);

            if (appointment == null)
            {
                return;
            }

            var taskItem = (appointment as CalendarItem);

            if ((taskItem == null) || taskItem.IsLocked)
            {
                return;
            }

            if (taskItem.IconRect.Contains(e.Location))
            {
                var notify = new UIExtension.ParentNotify(m_HwndParent);

                notify.NotifyEditIcon();
            }
        }
Example #2
0
        private void HandleDayViewMouseClick(MouseEventArgs e, bool doubleClick)
        {
            if (m_DayView.ReadOnly)
            {
                return;
            }

            var appointment = m_DayView.GetRealAppointmentAt(e.Location.X, e.Location.Y);

            if (appointment == null)
            {
                return;
            }

            var taskItem = (appointment as CalendarItem);

            if ((taskItem == null) || taskItem.Locked)
            {
                return;
            }

            if (taskItem.IconRect.Contains(e.Location))
            {
                var notify = new UIExtension.ParentNotify(m_HwndParent);
                notify.NotifyEditIcon();
            }
            else if (doubleClick)
            {
                var notify = new UIExtension.ParentNotify(m_HwndParent);
                notify.NotifyEditLabel();
            }
        }
        private Boolean OnTaskMatchesEditTaskDone(object sender, UInt32 taskId, bool completed)
        {
            var notify = new UIExtension.ParentNotify(m_HwndParent);

            return(notify.NotifyMod(Task.Attribute.DoneDate,
                                    (completed ? DateTime.Now : DateTime.MinValue)));
        }
Example #4
0
        void OnMindMapSelectionChange(object sender, object itemData)
        {
            var taskItem = (itemData as MindMapTaskItem);
            var notify   = new UIExtension.ParentNotify(m_HwndParent);

            notify.NotifySelChange(taskItem.ID);
        }
Example #5
0
        Boolean OnMindMapEditTaskCompletion(object sender, UInt32 taskId, bool completed)
        {
            var notify = new UIExtension.ParentNotify(m_hwndParent);

            return(notify.NotifyMod(UIExtension.TaskAttribute.DoneDate,
                                    (completed ? DateTime.Now : DateTime.MinValue)));
        }
Example #6
0
        private void OnDayViewSelectionChanged(object sender, Calendar.AppointmentEventArgs args)
        {
            UIExtension.ParentNotify notify = new UIExtension.ParentNotify(m_HwndParent);

            if (m_DayView.Selection != Calendar.SelectionType.None)
            {
                UpdatedSelectedTaskDatesText();

                notify.NotifySelChange(m_DayView.GetSelectedTaskID());
            }
        }
Example #7
0
        private void OnDayViewSelectionChanged(object sender, Calendar.AppointmentEventArgs args)
        {
            UIExtension.ParentNotify notify = new UIExtension.ParentNotify(m_HwndParent);

            if (m_DayView.Selection != Calendar.SelectionType.None)
            {
                if (args.Appointment != null)
                {
                    notify.NotifySelChange(args.Appointment.Id);
                }
                else
                {
                    notify.NotifySelChange(0);
                }
            }
        }
Example #8
0
        Boolean OnMindMapDragDrop(object sender, MindMapDragEventArgs e)
        {
            var notify = new UIExtension.ParentNotify(m_HwndParent);

            if (e.copyItem)
            {
                return(notify.NotifyCopy(e.dragged.uniqueID,
                                         e.targetParent.uniqueID,
                                         e.afterSibling.uniqueID));
            }

            // else
            return(notify.NotifyMove(e.dragged.uniqueID,
                                     e.targetParent.uniqueID,
                                     e.afterSibling.uniqueID));
        }
Example #9
0
        private void OnDayViewAppointmentChanged(object sender, Calendar.AppointmentEventArgs args)
        {
            Calendar.MoveAppointmentEventArgs move = args as Calendar.MoveAppointmentEventArgs;

            // Ignore moves whilst they are occurring
            if ((move == null) || !move.Finished)
            {
                return;
            }

            CalendarItem item = args.Appointment as CalendarItem;

            if (item == null)
            {
                return;
            }

            UIExtension.ParentNotify notify = new UIExtension.ParentNotify(m_hwndParent);

            switch (move.Mode)
            {
            case Calendar.SelectionTool.Mode.Move:
                if ((item.StartDate - item.OrgStartDate).TotalSeconds != 0.0)
                {
                    item.OrgStartDate = item.StartDate;
                    notify.NotifyMod(UIExtension.TaskAttribute.OffsetTask, args.Appointment.StartDate);
                }
                break;

            case Calendar.SelectionTool.Mode.ResizeTop:
                if ((item.StartDate - item.OrgStartDate).TotalSeconds != 0.0)
                {
                    item.OrgStartDate = item.StartDate;
                    notify.NotifyMod(UIExtension.TaskAttribute.StartDate, args.Appointment.StartDate);
                }
                break;

            case Calendar.SelectionTool.Mode.ResizeBottom:
                if ((item.EndDate - item.OrgEndDate).TotalSeconds != 0.0)
                {
                    item.OrgEndDate = item.EndDate;
                    notify.NotifyMod(UIExtension.TaskAttribute.DueDate, args.Appointment.EndDate);
                }
                break;
            }
        }
Example #10
0
        private void OnDayViewSelectionChanged(object sender, Calendar.AppointmentEventArgs args)
        {
            UIExtension.ParentNotify notify = new UIExtension.ParentNotify(m_HwndParent);

            switch (m_DayView.Selection)
            {
            case Calendar.SelectionType.DateRange:
                break;

            case Calendar.SelectionType.Appointment:
                if (args.Appointment != null)
                {
                    notify.NotifySelChange(args.Appointment.Id);
                }
                break;
            }
        }
Example #11
0
        private void ProcessTaskAppointmentChange(CalendarItem item, Calendar.SelectionTool.Mode mode)
        {
            var notify = new UIExtension.ParentNotify(m_HwndParent);

            if (PrepareTaskNotify(item, mode, notify))
            {
                bool modifyTimeEst = WantModifyTimeEstimate(item);

                if (notify.NotifyMod())
                {
                    item.UpdateOriginalDates();

                    if (modifyTimeEst)
                    {
                        item.TimeEstimate = item.LengthAsTimeEstimate(m_WorkWeek, false);
                    }

                    return;
                }
            }

            item.RestoreOriginalDates();
            m_DayView.Invalidate();
        }
        private void NotifyParentSelChange(UInt32 taskId)
        {
            var parent = new UIExtension.ParentNotify(m_HwndParent);

            parent.NotifySelChange(taskId);
        }
        private Boolean OnTaskMatchesEditTaskLabel(object sender, UInt32 taskId)
        {
            var notify = new UIExtension.ParentNotify(m_HwndParent);

            return(notify.NotifyEditLabel());
        }
Example #14
0
        protected void OnHelp(object sender, EventArgs e)
        {
            UIExtension.ParentNotify notify = new UIExtension.ParentNotify(m_HwndParent);

            notify.NotifyDoHelp(m_HelpID);
        }
Example #15
0
        private bool PrepareTaskNotify(CalendarItem item, Calendar.SelectionTool.Mode mode, UIExtension.ParentNotify notify, bool includeTimeEstimate = true)
        {
            switch (mode)
            {
            case Calendar.SelectionTool.Mode.Move:
                if (item.LengthDiffersFromOriginal())
                {
                    // Start date WITHOUT TIME ESTIMATE
                    PrepareTaskNotify(item, Calendar.SelectionTool.Mode.ResizeLeft, notify, false);

                    // End date WITHOUT TIME ESTIMATE
                    PrepareTaskNotify(item, Calendar.SelectionTool.Mode.ResizeRight, notify, false);

                    if (includeTimeEstimate && WantModifyTimeEstimate(item))
                    {
                        notify.AddMod(Task.Attribute.TimeEstimate, item.LengthAsTimeEstimate(m_WorkWeek, false), item.TimeEstUnits);
                    }

                    return(true);
                }
                else if (item.StartDateDiffersFromOriginal())
                {
                    notify.AddMod(Task.Attribute.OffsetTask, item.StartDate);

                    return(true);
                }
                break;

            case Calendar.SelectionTool.Mode.ResizeLeft:
            case Calendar.SelectionTool.Mode.ResizeTop:
                if (item.StartDateDiffersFromOriginal())
                {
                    notify.AddMod(Task.Attribute.StartDate, item.StartDate);

                    if (includeTimeEstimate && WantModifyTimeEstimate(item))
                    {
                        notify.AddMod(Task.Attribute.TimeEstimate, item.LengthAsTimeEstimate(m_WorkWeek, false), item.TimeEstUnits);
                    }

                    return(true);
                }
                break;

            case Calendar.SelectionTool.Mode.ResizeRight:
            case Calendar.SelectionTool.Mode.ResizeBottom:
                if (item.EndDateDiffersFromOriginal())
                {
                    // Allow for end of day
                    var endDate = item.EndDate;

                    if (endDate == endDate.Date)
                    {
                        endDate = endDate.AddDays(-1);
                    }

                    if (item.IsDone)
                    {
                        notify.AddMod(Task.Attribute.DoneDate, endDate);
                    }
                    else
                    {
                        notify.AddMod(Task.Attribute.DueDate, endDate);
                    }

                    if (includeTimeEstimate && WantModifyTimeEstimate(item))
                    {
                        notify.AddMod(Task.Attribute.TimeEstimate, item.LengthAsTimeEstimate(m_WorkWeek, false), item.TimeEstUnits);
                    }

                    return(true);
                }
                break;
            }

            return(false);
        }
        private void OnDayViewAppointmentChanged(object sender, Calendar.AppointmentEventArgs args)
        {
            var move = args as Calendar.MoveAppointmentEventArgs;

            // Ignore moves whilst they are occurring
            if ((move == null) || !move.Finished)
            {
                return;
            }

            var item = args.Appointment as CalendarItem;

            if (item == null)
            {
                return;
            }

            var notify = new UIExtension.ParentNotify(m_HwndParent);

            switch (move.Mode)
            {
            case Calendar.SelectionTool.Mode.Move:
                if (item.StartDateDiffersFromOriginal())
                {
                    if (notify.NotifyMod(Task.Attribute.OffsetTask, item.StartDate))
                    {
                        item.UpdateOriginalDates();
                        m_DayView.FixupSelection(true, false);
                    }
                    else
                    {
                        item.RestoreOriginalDates();
                        m_DayView.Invalidate();
                    }
                }
                break;

            case Calendar.SelectionTool.Mode.ResizeLeft:
            case Calendar.SelectionTool.Mode.ResizeTop:
                if (item.StartDateDiffersFromOriginal())
                {
                    notify.AddMod(Task.Attribute.StartDate, item.StartDate);

                    // Update the Time estimate if it is zero or
                    // it used to match the previous date range
                    bool modifyTimeEst = WantModifyTimeEstimate(item);

                    if (modifyTimeEst)
                    {
                        notify.AddMod(Task.Attribute.TimeEstimate, item.LengthAsTimeEstimate(m_WorkWeek, false), item.TimeEstUnits);
                    }

                    if (notify.NotifyMod())
                    {
                        item.UpdateOriginalDates();

                        if (modifyTimeEst)
                        {
                            item.TimeEstimate = item.LengthAsTimeEstimate(m_WorkWeek, false);
                        }
                    }
                    else
                    {
                        item.RestoreOriginalDates();
                        m_DayView.Invalidate();
                    }
                }
                break;

            case Calendar.SelectionTool.Mode.ResizeRight:
            case Calendar.SelectionTool.Mode.ResizeBottom:
                if (item.EndDateDiffersFromOriginal())
                {
                    // Allow for end of day
                    var endDate = item.EndDate;

                    if (endDate == endDate.Date)
                    {
                        endDate = endDate.AddDays(-1);
                    }

                    if (item.IsDone)
                    {
                        notify.AddMod(Task.Attribute.DoneDate, endDate);
                    }
                    else
                    {
                        notify.AddMod(Task.Attribute.DueDate, endDate);
                    }

                    // Update the Time estimate if used to match the previous date range
                    bool modifyTimeEst = WantModifyTimeEstimate(item);

                    if (modifyTimeEst)
                    {
                        notify.AddMod(Task.Attribute.TimeEstimate, item.LengthAsTimeEstimate(m_WorkWeek, false), item.TimeEstUnits);
                    }

                    if (notify.NotifyMod())
                    {
                        item.UpdateOriginalDates();

                        if (modifyTimeEst)
                        {
                            item.TimeEstimate = item.LengthAsTimeEstimate(m_WorkWeek, false);
                        }
                    }
                    else
                    {
                        item.RestoreOriginalDates();
                        m_DayView.Invalidate();
                    }
                }
                break;
            }
        }
Example #17
0
        private void OnHelp(object sender, EventArgs e)
        {
            UIExtension.ParentNotify notify = new UIExtension.ParentNotify(m_HwndParent);

            notify.NotifyDoHelp(m_TypeId);
        }
Example #18
0
        Boolean OnMindMapEditTaskIcon(object sender, UInt32 taskId)
        {
            var notify = new UIExtension.ParentNotify(m_HwndParent);

            return(notify.NotifyEditIcon());
        }