예제 #1
0
 public virtual NetOffice.MSProjectApi.TaskDependency Add(NetOffice.MSProjectApi.Task from, object type)
 {
     return(InvokerService.InvokeInternal.ExecuteKnownReferenceMethodGet <NetOffice.MSProjectApi.TaskDependency>(this, "Add", typeof(NetOffice.MSProjectApi.TaskDependency), from, type));
 }
예제 #2
0
        public TestResult DoTest()
        {
            NetOffice.Settings.Default.MessageFilter.Enabled = true;
            MSProject.Application application = null;
            DateTime startTime = DateTime.Now;

            try
            {
                application = new MSProject.Application();

                application.ProjectTaskNewEvent          += new MSProject.Application_ProjectTaskNewEventHandler(ApplicationProjectTaskNewEvent);
                application.ProjectBeforeCloseEvent      += new MSProject.Application_ProjectBeforeCloseEventHandler(ApplicationProjectBeforeCloseEvent);
                application.ProjectBeforeTaskChangeEvent += new MSProject.Application_ProjectBeforeTaskChangeEventHandler(ApplicationProjectBeforeTaskChangeEvent);
                application.ProjectBeforeTaskDeleteEvent += new MSProject.Application_ProjectBeforeTaskDeleteEventHandler(ApplicationProjectBeforeTaskDeleteEvent);

                MSProject.Project newProject = application.Projects.Add();
                MSProject.Task    task1      = newProject.Tasks.Add("Task 1");
                MSProject.Task    task2      = newProject.Tasks.Add("Task 2");

                task2.Delete();

                application.FileCloseAll(PjSaveType.pjDoNotSave);

                if (TaskDeleteEventCalled && TaskChangeEventCalled && BeforeCloseEventCalled && TaskChangeEventCalled)
                {
                    return(new TestResult(true, DateTime.Now.Subtract(startTime), "", null, ""));
                }
                else
                {
                    string errorMessage = "";
                    if (!TaskDeleteEventCalled)
                    {
                        errorMessage += "ProjectBeforeTaskDeleteEvent failed ";
                    }
                    if (!TaskChangeEventCalled)
                    {
                        errorMessage += "ProjectBeforeTaskChangeEvent failed ";
                    }
                    if (!BeforeCloseEventCalled)
                    {
                        errorMessage += "ProjectBeforeCloseEvent failed ";
                    }
                    if (!TaskNewEventCalled)
                    {
                        errorMessage += "ProjectTaskNewEvent failed ";
                    }

                    return(new TestResult(false, DateTime.Now.Subtract(startTime), errorMessage, null, ""));
                }
            }
            catch (Exception exception)
            {
                return(new TestResult(false, DateTime.Now.Subtract(startTime), exception.Message, exception, ""));
            }
            finally
            {
                NetOffice.Settings.Default.MessageFilter.Enabled = false;

                if (null != application)
                {
                    application.Quit(PjSaveType.pjDoNotSave);
                    application.Dispose();
                }
            }
        }
예제 #3
0
 void ApplicationProjectBeforeTaskChangeEvent(MSProject.Task tsk, PjField Field, object NewVal, ref bool Cancel)
 {
     TaskChangeEventCalled = true;
 }
예제 #4
0
 void ApplicationProjectBeforeTaskDeleteEvent(MSProject.Task tsk, ref bool Cancel)
 {
     TaskDeleteEventCalled = true;
 }
예제 #5
0
 public virtual void ProjectBeforeTaskChange(NetOffice.MSProjectApi.Task tsk, NetOffice.MSProjectApi.Enums.PjField field, object newVal, bool cancel)
 {
     InvokerService.InvokeInternal.ExecuteMethod(this, "ProjectBeforeTaskChange", tsk, field, newVal, cancel);
 }
예제 #6
0
 public virtual void ProjectBeforeTaskDelete(NetOffice.MSProjectApi.Task tsk, bool cancel)
 {
     InvokerService.InvokeInternal.ExecuteMethod(this, "ProjectBeforeTaskDelete", tsk, cancel);
 }