private void DeletePropertyGroup(object sender, RoutedEventArgs e) { GroupElement groupElement = PropertyGroups.SelectedItem as GroupElement; if (groupElement != null) { PropertyGroupElement selElm = groupElement.ElementBase as PropertyGroupElement; if (selElm != null) { if (!selElm.IsImported) { DeleteQuestionDialog dialog = new DeleteQuestionDialog(); bool?dialogResult = dialog.ShowDialog(); if (dialogResult.Value) { m_Project.DeletePropertyGroup(groupElement); } } } else { DeletePropertyGroupBtn.IsEnabled = false; } } }
private void PropertyGroupsChanged(object sender, RoutedEventArgs e) { GroupElement groupElement = PropertyGroups.SelectedItem as GroupElement; if (groupElement != null) { PropertyGroupElement selElm = groupElement.ElementBase as PropertyGroupElement; DeletePropertyGroupBtn.IsEnabled = (selElm != null); AddPropertyBtn.IsEnabled = (selElm != null); } }
private void AddProperty(object sender, RoutedEventArgs e) { GroupElement groupElement = PropertyGroups.SelectedItem as GroupElement; if (groupElement != null) { PropertyGroupElement selElm = groupElement.ElementBase as PropertyGroupElement; if (selElm != null) { if (!selElm.IsImported) { AddPropertyDialog dialog = new AddPropertyDialog(); bool?dialogResult = dialog.ShowDialog(); if (!dialogResult.HasValue) { return; } if (dialogResult.Value) { //Catch any errors and display them to the user try { selElm.PropertyGroup.AddNewProperty(dialog.PropertyName, ""); groupElement.Refresh(); } catch (System.Xml.XmlException ex) { ErrorDialog errorMessage = new ErrorDialog(ex.Message); errorMessage.ShowDialog(); } catch (ArgumentException ex) { ErrorDialog errorMessage = new ErrorDialog(ex.Message); errorMessage.ShowDialog(); } } } } else { AddPropertyBtn.IsEnabled = false; } } }