Check if diagram is modified


https://www.nevron.com/Forum/Topic8792.aspx
Print Topic | Close Window

By Cristianf - 10 Years Ago
Is there a method to know if the diagram is been modified by the user?

I want to enable or disable a button in relation to the diagram: if a shape is changed or added I want to enable the button, otherwise let it disabled.


By Nevron Support - 10 Years Ago
Hi,

It depends on what changes you are interested in. If you are interested in any change of the drawing document, you can check the value of its IsModified property.

If you are interested only in moving, resizing and rotating of shapes, then you can subscribe to the NodeBoundsChanged event of the drawing document's even sink service:

document.EventSinkService.NodeBoundsChanged += OnNodeBoundsChanged;
private void OnNodeBoundsChanged(NNodeEventArgs args)
{
}


If you are interested in any property change then you should subscribe to the NodePropertyChanged event of the drawing documents even sink service:

document.EventSinkService.NodePropertyChanged += OnNodePropertyChanged;
private void OnNodePropertyChanged(NNodePropertyEventArgs args)
{
    string changedPropertyName = args.PropertyName;
}

By Cristianf - 10 Years Ago
I tried like you said and the event doesn't fire Sad

I put the following code:


private void main_Load(object sender, EventArgs e)
{
nDrawingDocument1.EventSinkService.NodePropertyChanged += OnNodePropertyChanged;
}


private void OnNodePropertyChanged(NNodePropertyEventArgs args)
{
string changedPropertyName = args.PropertyName;
Messagebox.Show(changedPropertyName);
}


And the messagebox doesn't apprear...  any help? my code is wrong?
By Cristianf - 10 Years Ago
Sorry, I just screwed up my code... I made it working like support team wrote up here, so I solved my problem, thank you again! +1