Esempio n. 1
0
        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;
                }
            }
        }
Esempio n. 2
0
        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);
            }
        }
Esempio n. 3
0
        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;
                }
            }
        }