Exemplo 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();
     }
 }
Exemplo 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);
            }
        }
Exemplo n.º 4
0
 private void RhinoDoc_BeginSaveDocument(object sender, DocumentSaveEventArgs e)
 {
     Debug.WriteLine("BEGIN SAVE DOC");
     SaveFileClients();
 }
Exemplo 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();
 }
Exemplo 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 **");
 }