Nevron Forum

Check if diagram is modified

https://www.nevron.com/Forum/Topic8792.aspx

By Cristian Cojocaru 1 - Monday, November 17, 2014

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 - Tuesday, November 18, 2014

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 Cristian Cojocaru 1 - Thursday, November 20, 2014

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 Cristian Cojocaru 1 - Friday, November 21, 2014

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