private bool MigrateShapeFolder(string oldPath, string newPath)
        {
            var loadingDialog = new LoadingDialog(TextCollection.CustomShapeMigratingDialogTitle,
                                                  TextCollection.CustomShapeMigratingDialogContent);
            loadingDialog.Show();
            loadingDialog.Refresh();

            // close the opening presentation
            if (Globals.ThisAddIn.ShapePresentation.Opened)
            {
                Globals.ThisAddIn.ShapePresentation.Close();
            }

            // migration only cares about if the folder has been copied to the new location entirely.
            if (!FileDir.CopyFolder(oldPath, newPath))
            {
                loadingDialog.Dispose();

                MessageBox.Show(TextCollection.CustomShapeMigrationError);

                return false;
            }

            // now we will try our best to delete the original folder, but this is not guaranteed
            // because some of the using files, such as some opening shapes, and the evil thumb.db
            if (!FileDir.DeleteFolder(oldPath))
            {
                MessageBox.Show(TextCollection.CustomShapeOriginalFolderDeletionError);
            }

            ShapeRootFolderPath = newPath;

            // modify shape gallery presentation's path and name, then open it
            Globals.ThisAddIn.ShapePresentation.Path = newPath;
            Globals.ThisAddIn.ShapePresentation.Open(withWindow: false, focus: false);
            Globals.ThisAddIn.ShapePresentation.DefaultCategory = CurrentCategory;

            PaneReload(true);
            loadingDialog.Dispose();

            return true;
        }
예제 #2
0
 private static bool DisplayLoadingDialog(string title, string content)
 {
     // make FT run stably
     if (PowerPointCurrentPresentationInfo.IsInFunctionalTest)
     {
         return false;
     }
     else
     {
         _loadDialog = new LoadingDialog(title, content);
         _loadDialog.Show();
         _loadDialog.Refresh();
         return true;
     }
 }
예제 #3
0
        private void RegisterTaskPane(UserControl control, string title, PowerPoint.DocumentWindow wnd,
            EventHandler visibleChangeEventHandler,
            EventHandler dockPositionChangeEventHandler)
        {
            var loadingDialog = new LoadingDialog();
            loadingDialog.Show();
            loadingDialog.Refresh();

            // note down the control's width
            var width = control.Width;

            // register the user control to the CustomTaskPanes collection and set it as
            // current active task pane;
            var taskPane = CustomTaskPanes.Add(control, title, wnd);

            // task pane UI setup
            taskPane.Visible = false;
            taskPane.Width = width + 20;

            // map the current window with the task pane
            if (!_documentPaneMapper.ContainsKey(wnd))
            {
                _documentPaneMapper[wnd] = new List<CustomTaskPane>();
            }

            _documentPaneMapper[wnd].Add(taskPane);

            Trace.TraceInformation(
                "After Pane Width Change: " +
                string.Format("Pane Width = {0}, Pane Height = {1}, Control Width = {2}, Control Height {3}",
                              taskPane.Width, taskPane.Height, control.Width, control.Height));

            // event handlers register
            if (visibleChangeEventHandler != null)
            {
                taskPane.VisibleChanged += visibleChangeEventHandler;
            }

            if (dockPositionChangeEventHandler != null)
            {
                taskPane.DockPositionChanged += dockPositionChangeEventHandler;
            }

            loadingDialog.Dispose();
        }
예제 #4
0
 private static bool DisplayLoadingDialog(string title, string content)
 {
     _loadDialog = new LoadingDialog(title, content);
     _loadDialog.Show();
     _loadDialog.Refresh();
     return true;
 }