Esempio n. 1
0
        virtual public void SaveDocument()
        {
            if ((isDocumentModified && documentFileName == string.Empty))
            {
                if (OnSaveDocumentPrompt != null)
                {
                    DocumentSavePromptEventArgs args = new DocumentSavePromptEventArgs();

                    OnSaveDocumentPrompt(this, args);

                    if (args.IsHandled)
                    {
                        DocumentFileName = args.FileName;
                    }
                    else
                    {
                        return;
                    }
                }
            }

            if (OnSaveDocument != null)
            {
                DocumentSaveEventArgs args = new DocumentSaveEventArgs();

                args.FileName = DocumentFileName;

                OnSaveDocument(this, args);
            }
        }
 private void RhinoDoc_BeginSaveDocument(object sender, DocumentSaveEventArgs e)
 {
     //currently there is one object is double clicked,
     //it is under editing, exit editing model before saving document.
     if (this.m_mc.IsEditingRoom)
     {
         this.m_mc.ExitEditing();
     }
 }
Esempio n. 3
0
        virtual public bool NewDocument(string fileName = "")
        {
            if (isDocumentModified && !string.IsNullOrEmpty(documentFileName))
            {
                DocumentNewPromptEventArgs newPromptArgs = new DocumentNewPromptEventArgs();

                OnNewDocumentPrompt?.Invoke(this, newPromptArgs);

                switch (newPromptArgs.DialogResult)
                {
                case DialogResult.Cancel:
                    return(false);

                case DialogResult.No:
                    break;

                case DialogResult.Yes:
                    DocumentSaveEventArgs saveArgs = new DocumentSaveEventArgs();
                    saveArgs.FileName = documentFileName;
                    OnSaveDocument?.Invoke(this, saveArgs);

                    break;

                default:
                    break;
                }
            }

            if (OnNewDocument != null)
            {
                DocumentNewEventArgs args = new DocumentNewEventArgs();
                args.FileName = fileName;
                args.Handled  = false;
                OnNewDocument(this, args);

                if (args.Handled)
                {
                    DocumentFileName   = args.FileName;
                    IsDocumentModified = true;
                    SaveDocument();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Esempio n. 4
0
 private void RhinoDoc_BeginSaveDocument(object sender, DocumentSaveEventArgs e)
 {
     Debug.WriteLine("BEGIN SAVE DOC");
     SaveFileClients();
 }
Esempio n. 5
0
 /// <summary>
 /// Called when Rhino finishes saving a document
 /// </summary>
 public static void OnEndSaveDocument(object sender, DocumentSaveEventArgs e)
 {
     DebugWriteMethod();
     //RhinoEventListeners.g_instance.WriteLayers();
 }
Esempio n. 6
0
 /// <summary>
 /// Called when Rhino begins to save the active document
 /// </summary>
 public static void OnBeginSaveDocument(object sender, DocumentSaveEventArgs e)
 {
     DebugWriteMethod();
 }
 /// <summary>
 /// Called when Rhino finishes saving a document
 /// </summary>
 public static void OnEndSaveDocument(object sender, DocumentSaveEventArgs e)
 {
     RhinoApp.WriteLine("** EVENT: End Save Document **");
 }