// change in properties Grid, a Byte in the Raw Data // send it to the device if it's an attribut value private void propertyGrid_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) { if ((e.ChangedItem.Parent != null) && (e.ChangedItem.Parent.Label == "RawData") && (devicesTreeView.SelectedNode.Tag is EnIPAttribut)) { EnIPAttribut v = (EnIPAttribut)devicesTreeView.SelectedNode.Tag; if (v.WriteDataToNetwork() == EnIPNetworkStatus.OnLine) { Trace.WriteLine("Write OK"); } } else if ((e.ChangedItem.Parent != null) && (e.ChangedItem.Parent.Label == "DecodedMembers") && (devicesTreeView.SelectedNode.Tag is EnIPAttribut)) { EnIPAttribut v = (EnIPAttribut)devicesTreeView.SelectedNode.Tag; if (v.EncodeFromDecodedMembers() == true) // encoding is done into the previous RawByte (and same size) { if (v.WriteDataToNetwork() == EnIPNetworkStatus.OnLine) { Trace.WriteLine("Write OK"); } } else { Trace.WriteLine("Encoding not allow here or error during the encoding process, nothing written"); } } else { Trace.WriteLine("Modifications are not taken into account here"); } readAgainToolStripMenuItem_Click(null, null); }
private void propertyGridConfig_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) { // Modification in a Decoded field : copy it into the Raw field if ((e.ChangedItem.Parent != null) && (e.ChangedItem.Parent.Label == "DecodedMembers")) { Config.EncodeFromDecodedMembers(); propertyGridConfig.Refresh(); } }