/// <summary> /// Called when the thread starts. /// </summary> protected override void _startJob(CadKit.Threads.Jobs.Job job) { // Should be true. System.Diagnostics.Debug.Assert(false == CadKit.Threads.Tools.MainThread.Instance.IsMainThread); // Make sure there is a document. if (null == this.Document) { return; } // See if the document can insert files. CadKit.Interfaces.IFileInsert insert = this.Document as CadKit.Interfaces.IFileInsert; if (null == insert) { return; } // Feedback. System.Console.WriteLine(System.String.Format("Inserting file '{0}' into '{1}'", this.File, this.Document.Name)); // Insert the file. insert.insert(this.File, this); // The document is now modified. this.Document.Modified = true; }
/// <summary> /// Determine if the button should be enabled. /// </summary> protected override bool _shouldBeEnabled() { CadKit.Interfaces.IFileInsert insert = CadKit.Documents.Manager.Instance.ActiveDocument as CadKit.Interfaces.IFileInsert; return(null != insert); }