Beispiel #1
0
        virtual public bool OpenDocument(string fileName)
        {
            if (isDocumentModified && documentFileName != string.Empty)
            {
                var args = new OpenDocumentSavePromptEventArgs();
                OnOpenDocumentSavePrompt?.Invoke(this, args);
            }

            if (OnOpenDocument != null)
            {
                var args = new OpenDocumentEventArgs();
                OnOpenDocument?.Invoke(this, args);

                DocumentFileName   = fileName;
                IsDocumentModified = false;

                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
        virtual public bool OpenDocument()
        {
            if (isDocumentModified && documentFileName != string.Empty)
            {
                if (OnOpenDocumentSavePrompt != null)
                {
                    var args = new OpenDocumentSavePromptEventArgs();

                    OnOpenDocumentSavePrompt(this, args);

                    if (!args.IsHandled)
                    {
                        return(false);
                    }
                }
            }

            if (OnOpenDocument != null)
            {
                var args = new OpenDocumentEventArgs();

                OnOpenDocument(this, args);

                if (args.IsHandled)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }