Ejemplo n.º 1
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);
            }
        }