コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        public override void execute()
        {
            try
            {
                CadKit.Interfaces.IDocument document = CadKit.Documents.Manager.Instance.ActiveDocument;
                if (null != document)
                {
                    // Only save if the document is modified.
                    // This function should never get called if this is false, but it can't hurt to have the check.
                    if (document.Modified)
                    {
                        // If the document has a name.
                        if (false == document.HasDefaultName)
                        {
                            CadKit.Interfaces.IFileSave save = document as CadKit.Interfaces.IFileSave;
                            if (null != save)
                            {
                                save.save(_caller);
                            }
                        }

                        // We need to have the user choose a name.
                        else
                        {
                            CadKit.Helios.Commands.SaveAsDocumentCommand saveAs = new SaveAsDocumentCommand(_caller);
                            saveAs.execute();
                        }
                    }
                }
            }
            catch (System.Exception e)
            {
                System.Console.WriteLine("Error 1903003532: {0}", e.Message);
            }
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        public override void execute()
        {
            try
            {
                CadKit.Interfaces.IFiltersSave filtersSave = CadKit.Documents.Manager.Instance.ActiveDocument as CadKit.Interfaces.IFiltersSave;

                if (null != filtersSave)
                {
                    CadKit.Tools.AskForFilename ask = new CadKit.Tools.AskForFilename("Save As", CadKit.Helios.Application.Instance.Name, this.PersistentName, filtersSave.Filters);
                    string filename = ask.Filename;

                    CadKit.Interfaces.IFileSave fileSave = CadKit.Documents.Manager.Instance.ActiveDocument as CadKit.Interfaces.IFileSave;
                    if (null != fileSave)
                    {
                        fileSave.saveAs(filename, _caller);
                    }
                }
            }
            catch (System.Exception e)
            {
                System.Console.WriteLine("Error 933316032: {0}", e.Message);
            }
        }