예제 #1
0
        private void addToGroupButton_Click(object sender, EventArgs e)
        {
            // This can be null if the category was selected.
            var selectedPropertyDescriptor = propertyGrid.SelectedGridItem.PropertyDescriptor as ProxyPropertyDescriptor;

            if (selectedPropertyDescriptor == null)
            {
                return;
            }

            DashboardNodePropertyBase property = DashboardViewModel.GetProperty(selectedPropertyDescriptor.Proxy.PropertyId);

            ProxyPropertyDescriptor selectedGroupDescriptor = GetCurrentGroupDescriptor();
            DashboardPropertyGroup  groupProperty           =
                GroupedDashboardViewModel.GetProperty(selectedGroupDescriptor.Proxy.PropertyId);

            try
            {
                groupProperty.Add(property);

                SetPropertyGridButtonsEnabled(false);
                RefreshAll();

                m_mainForm.ProjectStateChanged(string.Format("Dashboard property {0} added to group: {1}",
                                                             property.DisplayName, groupProperty.DisplayName));
            }
            catch (InvalidOperationException)
            {
                errorText.Text = string.Format("Cannot add a {0} property to a {1} group",
                                               selectedPropertyDescriptor.Proxy.TypeName,
                                               selectedGroupDescriptor.Proxy.TypeName);
            }
        }
예제 #2
0
 private void LoadGroupedProperties(ProxyPropertyDescriptor groupDescriptor)
 {
     foreach (ProxyPropertyBase proxy in GroupedDashboardViewModel.GetProperty(groupDescriptor.Proxy.PropertyId)
              .GroupedProperties.Select(property => property.GenericProxy))
     {
         memberListBox.Items.Add(proxy);
     }
 }
예제 #3
0
        private void removeButton_Click(object sender, EventArgs e)
        {
            ProxyPropertyDescriptor descriptor = GetCurrentPropertyDescriptor();

            DashboardViewModel.RemoveProperty(descriptor.Proxy);

            m_mainForm.ProjectStateChanged(string.Format("Dashboard property removed: {0}", descriptor.Name));
        }
예제 #4
0
        private void OnPropertyValueChanged(object s, PropertyValueChangedEventArgs e)
        {
            ProxyPropertyDescriptor descriptor = GetCurrentPropertyDescriptor();
            MyNode node = DashboardViewModel.GetProperty(descriptor.Proxy.PropertyId).Node;

            RefreshNode(node);

            RefreshAll();
        }
예제 #5
0
        private void editGroupButton_Click(object sender, EventArgs e)
        {
            ProxyPropertyDescriptor descriptor = GetCurrentGroupDescriptor();

            var dialog = new DashboardGroupNameDialog(propertyGridGrouped,
                                                      GroupedDashboardViewModel.GetProperty(descriptor.Proxy.PropertyId),
                                                      m_mainForm.Project.GroupedDashboard);

            dialog.ShowDialog();
        }
예제 #6
0
        private void removeGroupButton_Click(object sender, EventArgs e)
        {
            ProxyPropertyDescriptor descriptor = GetCurrentGroupDescriptor();

            GroupedDashboardViewModel.RemoveProperty(descriptor.Proxy);
            propertyGrid.Refresh();
            memberListBox.Items.Clear();

            m_mainForm.ProjectStateChanged(string.Format("Dashboard property group removed: {0}", descriptor.Name));
        }
예제 #7
0
        private void OnGroupPropertyValueChanged(object s, PropertyValueChangedEventArgs e)
        {
            ProxyPropertyDescriptor descriptor = GetCurrentGroupDescriptor();

            foreach (MyNode node in GroupedDashboardViewModel.GetProperty(descriptor.Proxy.PropertyId).GroupedProperties.Select(member => member.Node))
            {
                RefreshNode(node);
            }

            RefreshAll();
        }
예제 #8
0
        public void DescriptorHasCorrectType()
        {
            var node = new Node();

            var property = GetDirectProperty(node);

            var proxy      = property.GenericProxy;
            var descriptor = new ProxyPropertyDescriptor(ref proxy, new Attribute[0]);

            Assert.Equal(descriptor.PropertyType, typeof(string));
        }
예제 #9
0
        public void GroupDescriptorHasCorrectType()
        {
            var node = new Node();

            var property = GetDirectProperty(node);

            var group = new DashboardPropertyGroup("Foo");

            group.Add(property);

            var proxy      = group.GenericProxy;
            var descriptor = new ProxyPropertyDescriptor(ref proxy, new Attribute[0]);

            Assert.Equal(descriptor.PropertyType, typeof(string));
        }