/* +==== Creating/Removing (new) Moveable Object(s) ====+ */ /* Using the new button on the Moveable tab to open the CreateNewObject_Moveable * Sends a custom ObjectEvent that retrieves the Object details from the CreateNewObject_Moveable * And removes it when the CreateNewObject_Moveable has been terminated (closed) */ #region Creating/Removing Moveable Object(s) #region Create a new Moveable Object private void btn_newObject_moveable_Click(object sender, RoutedEventArgs e) { if (createMoveableWindow == null) { createMoveableWindow = new CreateNewObject_Moveable(); createMoveableWindow.RaiseCreateObjectEvent += new EventHandler <Events.ObjectEvent>(collectMoveableObject); createMoveableWindow.Show(); } }
public void collectMoveableObject(object sender, Events.ObjectEvent e) { if (e != null) { listview_moveableObjectList.Items.Add(e.getObject); listview_moveableObjectList.SelectedItem = e.getObject; /* <-- sets the index to be the newely created object */ xmlFileHandler.add(e.getObject, "MOVEABLE"); xmlFileHandler.save(); } createMoveableWindow.RaiseCreateObjectEvent -= new EventHandler <Events.ObjectEvent>(collectMoveableObject); createMoveableWindow = null; }