Ejemplo n.º 1
0
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIApplication            uiapp     = commandData.Application;
            UIDocument               uidoc     = uiapp.ActiveUIDocument;
            Application              app       = uiapp.Application;
            Document                 doc       = uidoc.Document;
            ReadWriteSettingsCommand readWrite = new ReadWriteSettingsCommand();

            FindTemplateType(uiapp);

            string path;
            string searchString = "A0.70";

            thisCommand = this;

            RetrieveTitleBlockHeight(uiapp, searchString);
            path = ShowForm(uiapp);

            if (path != "")
            {
                string imagePath = Path.GetDirectoryName(path);
                readWrite.WriteFilePath(doc, path);
            }

            uidoc.RefreshActiveView();
            return(Result.Succeeded);
        }
Ejemplo n.º 2
0
        public string ShowForm(UIApplication uiapp)
        {
            UIDocument  uidoc = uiapp.ActiveUIDocument;
            Application app   = uiapp.Application;
            Document    doc   = uidoc.Document;
            ReadWriteSettingsCommand readWrite = new ReadWriteSettingsCommand();

            string filePath = readWrite.ReadFilePath(doc);

            // If we do not have a dialog yet, create and show it
            if (dialog == null || dialog.IsDisposed)
            {
                // A new handler to handle request posting by the dialog
                RequestHandler handler = new RequestHandler();

                // External Event for the dialog to use (to post requests)
                ExternalEvent exEvent = ExternalEvent.Create(handler);
                //uiapp.Idling += IdlingHandler;
                dialog = new SheetSpecForm(doc, filePath, exEvent, handler);
                var result = dialog.ShowDialog();


                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    string returnVal = dialog.returnPath;
                    //convertWord(doc, returnVal);
                    //readWrite.WriteFilePath(doc, returnVal);
                    return(returnVal);
                }
                else
                {
                    string returnVal = dialog.returnPath;
                    return(returnVal);
                }
            }
            else
            {
                return(filePath);
            }
        }