Exemplo n.º 1
1
        private void ExportToMSProjectButtonClick(object sender, RoutedEventArgs e)
        {
            Microsoft.Office.Interop.MSProject.Application msApplication = null;
            try
            {
                msApplication = new Microsoft.Office.Interop.MSProject.Application();
            }
            catch (COMException)
            {
                MessageBox.Show("You need to have MSProject installed on your computer in order to use the export functionality of the example.", "No Installation");
                return;
            }

            try
            {
                msApplication.AppMaximize();
                msApplication.FileNew(Missing.Value, Missing.Value, Missing.Value, Missing.Value);

                var msProject = msApplication.ActiveProject;
                msProject.ManuallyScheduledTasksAutoRespectLinks = false;
                FillProjectWithTasks(msProject, this.radGanttView1.TasksSource.OfType<IGanttTask>(), null, false);
                FillTasksWithDependencies(msProject.Tasks.OfType<Task>(), this.radGanttView1.TasksSource.OfType<IGanttTask>());
                msApplication.Visible = true;
            }
            catch (COMException)
            {
                try
                {
                    msApplication.Quit(PjSaveType.pjDoNotSave);
                }
                catch (COMException)
                {
                    return;
                }
                MessageBox.Show("You should not interact with MSProject while Exporting is performed! Please, export again.", "Interaction exception");
            }
        }
Exemplo n.º 2
0
        private void ExportToMSProjectButtonClick(object sender, RoutedEventArgs e)
        {
            var msApplication = new Microsoft.Office.Interop.MSProject.Application();
            msApplication.AppMaximize();
            msApplication.FileNew(Missing.Value, Missing.Value, Missing.Value, Missing.Value);

            var msProject = msApplication.ActiveProject;
            msProject.ManuallyScheduledTasksAutoRespectLinks = false;
            FillProjectWithTasks(msProject, this.radGanttView1.TasksSource.OfType<IGanttTask>(), null, false);
            FillTasksWithDependencies(msProject.Tasks.OfType<Task>(), this.radGanttView1.TasksSource.OfType<IGanttTask>());
            msApplication.Visible = true;
        }
Exemplo n.º 3
0
        private void ExportToMSProjectButtonClick(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("MSProject will start exporting RadGanttView soon. While the process in running we do not recommend interacting with MS Project because the export might break.", "Start Exporting", MessageBoxButton.OK, MessageBoxImage.Information);

            try
            {
                msApplication = new Microsoft.Office.Interop.MSProject.Application();
            }
            catch (COMException)
            {
                MessageBox.Show("You need to have MSProject installed on your computer in order to use the export functionality of the example.", "No Installation");
                return;
            }

            System.Windows.Application.Current.MainWindow.WindowState = WindowState.Minimized;

            try
            {
                msApplication.AppMaximize();
                msApplication.FileNew(Missing.Value, Missing.Value, Missing.Value, Missing.Value);

                var msProject = msApplication.ActiveProject;
                msProject.ManuallyScheduledTasksAutoRespectLinks = false;
                FillProjectWithTasks(msProject, this.radGanttView1.TasksSource.OfType <IGanttTask>(), null, false);
                FillTasksWithDependencies(msProject.Tasks.OfType <Task>(), this.radGanttView1.TasksSource.OfType <IGanttTask>());
                msApplication.Visible = true;
            }
            catch (COMException)
            {
                try
                {
                    msApplication.Quit(PjSaveType.pjDoNotSave);
                }
                catch (COMException)
                {
                    return;
                }
                System.Windows.Application.Current.MainWindow.WindowState = WindowState.Normal;
                MessageBox.Show("Export has failed. Please, do not interact with MSProject while Exporting is performed.", "Interaction exception");
            }
        }