private void Current_TaskActivitiesChangedEvent(object sender, TaskActivityEventArgs e)
        {
            if (e == TaskActivityEventArgs.Empty)
            {
                return;
            }

            _days = _engine.TaskActivitiesProvider.DiscoverDateMetrics(
                BritishMicro.TaskClerk.Providers.TaskActivitiesProvider.MetricQuestion.AvailableDays);

            if ((treeView.SelectedNode != null) && (treeView.SelectedNode.Tag != null))
            {
                if (treeView.SelectedNode.Tag.GetType() == typeof(DateTime))
                {
                    if (e.TaskActivity.StartDate.ToShortDateString() !=
                        ((DateTime)treeView.SelectedNode.Tag).ToShortDateString())
                    {
                        RebuildTree(treeView.SelectedNode.Name);
                    }
                    if (treeView.SelectedNode != null)
                    {
                        RefreshViews(treeView.SelectedNode.Tag);
                    }
                }
            }
            else
            {
                RebuildTree();
            }
            //_currentActivity = e.TaskActivity;
            UpdateStatusBarText();
        }
 void TaskActivitiesProvider_TaskActivitiesChanged(object sender, TaskActivityEventArgs e)
 {
     _isReadyForEdit = false;
     dateTimePickerStartDate.Text = e.TaskActivity.StartDate.ToLongDateString();
     dateTimePickerStartTime.Text = e.TaskActivity.StartDate.ToString("HH:mm");
     dateTimePickerEndDate.Text   = e.TaskActivity.EndDate.ToLongDateString();
     dateTimePickerEndTime.Text   = e.TaskActivity.EndDate.ToString("HH:mm");
     numericUpDown.Value          = e.TaskActivity.Duration;
     _isReadyForEdit = true;
 }
示例#3
0
 private void Current_TaskActivitiesChangedEvent(object o, TaskActivityEventArgs e)
 {
     if (e != TaskActivityEventArgs.Empty)
     {
         if (e.TaskActivity.StartDate.ToShortDateString() == _effectiveDate.ToShortDateString())
         {
             Activities =
                 AppContext.Current.TaskActivitiesProvider.LoadActivities(_effectiveDate);
             dataGridView_CurrentCellChanged(this, EventArgs.Empty);
         }
     }
 }
示例#4
0
        /// <summary>
        /// Removes an activity.
        /// </summary>
        /// <param name="activity"></param>
        public void RemoveActivity(TaskActivity activity)
        {
            TaskActivityEventArgs taea = new TaskActivityEventArgs(activity);

            OnRemovingActivityEvent(taea);
            if (taea.Cancel == false)
            {
                DateTime timerStart = DateTime.Now;
                ProviderRemoveActivity(activity);
                RaiseTimingEvent(MethodInfo.GetCurrentMethod(), timerStart);

                OnTaskActivitiesChangedEvent(new TaskActivityEventArgs(activity));
            }
        }
示例#5
0
        /// <summary>
        /// Starts an activity.
        /// </summary>
        /// <param name="activity">The activity.</param>
        public void BeginActivity(TaskActivity activity)
        {
            if (activity == null)
            {
                throw new ArgumentNullException("activity");
            }
            TaskActivityEventArgs taea = new TaskActivityEventArgs(activity);

            OnBeginActivityEvent(taea);
            if (taea.Cancel == false)
            {
                DateTime timerStart = DateTime.Now;
                ProviderBeginActivity(taea.TaskActivity);
                RaiseTimingEvent(MethodInfo.GetCurrentMethod(), timerStart);

                OnTaskActivitiesChangedEvent(taea);
            }
        }
        /// <summary>
        /// Handles the BeginningActivity event of the TaskActivitiesProvider control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="BritishMicro.TaskClerk.TaskActivityEventArgs"/> instance containing the event data.</param>
        void TaskActivitiesProvider_BeginningActivity(object sender, TaskActivityEventArgs e)
        {
            TaskDescription      description = e.TaskActivity.TaskDescription;
            MostRecentlyUsedItem targetItem  = this._items.Find(
                delegate(MostRecentlyUsedItem item)
            {
                return(item.Id.Equals(description.Id));
            });

            if (targetItem == null)
            {
                targetItem = new MostRecentlyUsedItem(description.Id);
            }

            this._items.Remove(targetItem);
            this._items.Insert(0, targetItem);
            targetItem.Usage++;
        }
 /// <summary>
 /// Raises the <see cref="E:RemovingActivityEvent"/> event.
 /// </summary>
 /// <param name="e">The <see cref="BritishMicro.TaskClerk.TaskActivityEventArgs"/> instance containing the event data.</param>
 private void OnRemovingActivityEvent(TaskActivityEventArgs e)
 {
     EventHandler<TaskActivityEventArgs> handler = RemovingActivity;
     if (handler != null)
     {
         handler(this, e);
     }
 }
示例#8
0
 private void Current_TaskActivitiesChangedEvent(object o, TaskActivityEventArgs e)
 {
     if (e != TaskActivityEventArgs.Empty)
     {
         if (e.TaskActivity.StartDate.ToShortDateString() == _effectiveDate.ToShortDateString())
         {
             Activities =
                 AppContext.Current.TaskActivitiesProvider.LoadActivities(_effectiveDate);
             dataGridView_CurrentCellChanged(this, EventArgs.Empty);
         }
     }
 }
示例#9
0
 /// <summary>
 /// Raises the <see cref="E:StartingActivityEvent"/> event.
 /// </summary>
 /// <param name="e">The <see cref="BritishMicro.TaskClerk.TaskActivityEventArgs"/> instance containing the event data.</param>
 private void OnBeginActivityEvent(TaskActivityEventArgs e)
 {
     BeginningActivity?.Invoke(this, e);
 }
示例#10
0
 /// <summary>
 /// Raises the <see cref="E:CompletingActivityEvent"/> event.
 /// </summary>
 /// <param name="e">The <see cref="BritishMicro.TaskClerk.TaskActivityEventArgs"/> instance containing the event data.</param>
 private void OnCompletingActivityEvent(TaskActivityEventArgs e)
 {
     CompletingActivity?.Invoke(this, e);
 }
        private void Current_TaskActivitiesChangedEvent(object sender, TaskActivityEventArgs e)
        {
            if (e == TaskActivityEventArgs.Empty)
            {
                return;
            }

            _days = _engine.TaskActivitiesProvider.DiscoverDateMetrics(
                BritishMicro.TaskClerk.Providers.TaskActivitiesProvider.MetricQuestion.AvailableDays);

            if ((treeView.SelectedNode != null) && (treeView.SelectedNode.Tag != null))
            {
                if (treeView.SelectedNode.Tag.GetType() == typeof (DateTime))
                {
                    if (e.TaskActivity.StartDate.ToShortDateString() !=
                        ((DateTime) treeView.SelectedNode.Tag).ToShortDateString())
                    {
                        RebuildTree(treeView.SelectedNode.Name);
                    }
                    if (treeView.SelectedNode != null)
                    {
                        RefreshViews(treeView.SelectedNode.Tag);
                    }
                }
            }
            else
            {
                RebuildTree();
            }
            //_currentActivity = e.TaskActivity;
            UpdateStatusBarText();
        }
 /// <summary>
 /// Raises the <see cref="E:TaskActivitiesChangedEvent"/> event.
 /// </summary>
 /// <param name="e">The <see cref="BritishMicro.TaskClerk.TaskActivityEventArgs"/> instance containing the event data.</param>
 private void OnTaskActivitiesChangedEvent(TaskActivityEventArgs e)
 {
     EventHandler<TaskActivityEventArgs> handler = TaskActivitiesChanged;
     if (handler != null)
     {
         handler(this, e);
     }
 }
示例#13
0
 void TaskActivitiesProvider_TaskActivitiesChanged(object sender, TaskActivityEventArgs e)
 {
     _isReadyForEdit = false;
     dateTimePickerStartDate.Text = e.TaskActivity.StartDate.ToLongDateString();
     dateTimePickerStartTime.Text = e.TaskActivity.StartDate.ToString("HH:mm");
     dateTimePickerEndDate.Text = e.TaskActivity.EndDate.ToLongDateString();
     dateTimePickerEndTime.Text = e.TaskActivity.EndDate.ToString("HH:mm");
     numericUpDown.Value = e.TaskActivity.Duration;
     _isReadyForEdit = true;
 }
示例#14
0
 /// <summary>
 /// Raises the <see cref="E:RemovingActivityEvent"/> event.
 /// </summary>
 /// <param name="e">The <see cref="BritishMicro.TaskClerk.TaskActivityEventArgs"/> instance containing the event data.</param>
 private void OnRemovingActivityEvent(TaskActivityEventArgs e)
 {
     RemovingActivity?.Invoke(this, e);
 }
 /// <summary>
 /// Raises the <see cref="E:StartingActivityEvent"/> event.
 /// </summary>
 /// <param name="e">The <see cref="BritishMicro.TaskClerk.TaskActivityEventArgs"/> instance containing the event data.</param>
 private void OnBeginActivityEvent(TaskActivityEventArgs e)
 {
     EventHandler<TaskActivityEventArgs> handler = BeginningActivity;
     if (handler != null)
     {
         handler(this, e);
     }
 }
        /// <summary>
        /// Removes an activity.
        /// </summary>
        /// <param name="activity"></param>
        public void RemoveActivity(TaskActivity activity)
        {
            TaskActivityEventArgs taea = new TaskActivityEventArgs(activity);
            OnRemovingActivityEvent(taea);
            if (taea.Cancel == false)
            {
                DateTime timerStart = DateTime.Now;
                ProviderRemoveActivity(activity);
                RaiseTimingEvent(MethodInfo.GetCurrentMethod(), timerStart);

                OnTaskActivitiesChangedEvent(new TaskActivityEventArgs(activity));
            }
        }
        /// <summary>
        /// Completes the activity.
        /// </summary>
        /// <param name="activity">The activity.</param>
        /// <param name="effectiveDate">The effective date.</param>
        public void CompleteActivity(TaskActivity activity, DateTime effectiveDate)
        {
            if (activity == null)
            {
                throw new ArgumentNullException("activity");
            }

            TaskActivityEventArgs taea = new TaskActivityEventArgs(activity, effectiveDate);
            OnCompletingActivityEvent(taea);
            if (taea.Cancel == false)
            {
                DateTime timerStart = DateTime.Now;
                ProviderCompleteActivity(taea.TaskActivity);
                RaiseTimingEvent(MethodInfo.GetCurrentMethod(), timerStart);

                OnTaskActivitiesChangedEvent(new TaskActivityEventArgs(activity));
            }
        }
示例#18
0
 /// <summary>
 /// Raises the <see cref="E:TaskActivitiesChangedEvent"/> event.
 /// </summary>
 /// <param name="e">The <see cref="BritishMicro.TaskClerk.TaskActivityEventArgs"/> instance containing the event data.</param>
 private void OnTaskActivitiesChangedEvent(TaskActivityEventArgs e)
 {
     TaskActivitiesChanged?.Invoke(this, e);
 }