C#: Understand if a document is modified or not

Hi all!
I'm failing when trying to understand if a document has been modified after adding or updating a custom property.

I've a small piece of code which works on the current active document inside the Application and tries to update an existing custom property and add a new one.
Then it askes if the document is modified or not... but I always get that it is not modified, even though update and add routines have worked correctly.

public static void TestModify()
{
    BRAPP BrxApp = (BRAPP)Marshal.GetActiveObject("BricscadApp.AcadApplication.21.0");
    BRDOC BrxDoc = BrxApp.ActiveDocument;
    AcadSummaryInfo Metadata = BrxDoc.SummaryInfo;
    Metadata.SetCustomByKey("ExistingPr", DateTime.Now.ToString("HHmmssfff")); // it updates existing 'CompDes' property correctly
    string pN = DateTime.Now.ToString("HHmmssfff");
    Metadata.AddCustomInfo(pN, DateTime.Now.ToString("HHmmssfff")); // it creates this new property correctly

    bool m = BrxDoc.Saved; // 'm' is always TRUE
}

What I've noted is that by adding or updating properties directly thru Bricscad GUI command (Menu\Drawing properties) the document is always modified (a '*' character is visible at the end of active file name... see attached image).

My questions are:
1. Is there another way for getting the modification status?
2. Is there a way for setting the document as modified/raising the document modification flag programmatically?

T&R,
LemonXXX

Comments

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Click one of the buttons on the top bar to get involved!