private void OnRemove(Object sender, EventArgs e)
        {
            ChoiceTreeNode choice = (ChoiceTreeNode)_appliedFiltersList.TvList.SelectedNode;

            if (ChoiceHasContent(choice.RuntimeChoice))
            {
                if (!GenericUI.ConfirmYesNo(
                        SR.GetString(SR.AppliedDeviceFiltersDialog_Title),
                        SR.GetString(
                            SR.AppliedDeviceFiltersDialog_AssociatedItemsWillBeLost
                            )
                        ))
                {
                    return;
                }
            }
            _appliedFiltersList.TvList.Nodes.Remove(_appliedFiltersList.TvList.SelectedNode);

            // If it was the default filter, and it a duplicate is not still
            // still applied (error in HTML view), return it to the list of
            // available filters.
            if (IsDefaultFilter(choice.Name))
            {
                EnsureDefaultFilterAvailableXorApplied();
            }
            _appliedFiltersList.UpdateButtonsEnabling();
            SetDirty(true);
            UpdateUI();
        }
示例#2
0
        private void UpdateUI()
        {
            if (_cbChoices.SelectedItem == null && _cbChoices.Items.Count > 0)
            {
                _cbChoices.SelectedItem = _cbChoices.Items[0];
            }

            ChoiceTreeNode choice           = (ChoiceTreeNode)_cbChoices.SelectedItem;
            bool           isChoiceSelected = (choice != null);

            if (isChoiceSelected)
            {
                _cbChoices.Text = choice.ToString();
                _pgProperties.SelectedObject =
                    choice.Choice;
            }
            else
            {
                _cbChoices.Text = "";
                _pgProperties.SelectedObject = null;
            }
            _cbChoices.Enabled      = isChoiceSelected;
            _pgProperties.Enabled   = isChoiceSelected;
            _btnEditFilters.Enabled = (_currentDeviceSpecificID != null);
        }
        private void LoadChoice(DeviceSpecificChoice runtimeChoice)
        {
            DeviceFilterNode filterUsed =
                FindAvailableFilter(runtimeChoice.Filter);

            ChoiceTreeNode choice = new ChoiceTreeNode(
                filterUsed,
                runtimeChoice,
                _designer
                );

            _appliedFiltersList.TvList.Nodes.Add(choice);
        }
示例#4
0
 private void LoadChoices(DeviceSpecific deviceSpecific)
 {
     if (deviceSpecific != null)
     {
         foreach (DeviceSpecificChoice runtimeChoice in deviceSpecific.Choices)
         {
             debug_CheckChoicesForDuplicate(runtimeChoice);
             ChoiceTreeNode newChoiceNode = new ChoiceTreeNode(
                 null,
                 runtimeChoice,
                 _designer
                 );
             newChoiceNode.IncludeArgument = true;
             _cbChoices.Items.Add(newChoiceNode);
         }
     }
     UpdateUI();
 }
 private void LoadChoices(DeviceSpecific deviceSpecific)
 {
     if(deviceSpecific != null)
     {
         foreach(DeviceSpecificChoice runtimeChoice in deviceSpecific.Choices)
         {
             debug_CheckChoicesForDuplicate(runtimeChoice);
             ChoiceTreeNode newChoiceNode = new ChoiceTreeNode(
                 null,
                 runtimeChoice,
                 _designer
             );
             newChoiceNode.IncludeArgument = true;
             _cbChoices.Items.Add(newChoiceNode);
         }
     }
     UpdateUI();
 }
        private void OnApplyFilter(Object sender, EventArgs e)
        {
            DeviceFilterNode filter = (DeviceFilterNode)_cbAvailableFilters.SelectedItem;

            if (filter == null)
            {
                String name = _cbAvailableFilters.Text;
                Debug.Assert(
                    ((name != null) && (name.Length > 0)),
                    "Should not be trying to apply a filter with none selected. "
                    + "Missed a call to UpdateUI()?"
                    );

                // If the user typed the name of a filter which exists in their
                // web.config, we need to find the original rather than create
                // a new external filter.
                filter = FindAvailableFilter(name);
                if (filter == null)
                {
                    /* Removed for DCR 4240
                     * if (!DesignerUtility.IsValidName(name))
                     * {
                     *  GenericUI.ShowWarningMessage(
                     *      SR.GetString(SR.AppliedDeviceFiltersDialog_Title),
                     *      SR.GetString(
                     *          SR.AppliedDeviceFiltersDialog_InvalidFilterName,
                     *          _cbAvailableFilters.Text
                     *      )
                     *  );
                     *  return;
                     * }
                     */

                    filter = CreateExternalFilter(_cbAvailableFilters.Text);
                }
            }
            ChoiceTreeNode choice = new ChoiceTreeNode(
                filter,
                _designer
                );

            if (IsDefaultFilter(filter.Name))
            {
                if (DefaultFilterIsApplied)
                {
                    // Do not allow user to apply default filter if already
                    // been applied.
                    GenericUI.ShowWarningMessage(
                        SR.GetString(SR.AppliedDeviceFiltersDialog_Title),
                        SR.GetString(SR.AppliedDeviceFiltersDialog_DefaultFilterAlreadyApplied)
                        );
                }
                else
                {
                    // Add the default filter to the end of the list and
                    // remove it from list of available filters.
                    _appliedFiltersList.TvList.Nodes.Add(choice);
                    RemoveAvailableFilter(filter);
                }
            }
            else
            {
                // All other filters are added to the beginning
                _appliedFiltersList.TvList.Nodes.Insert(0, choice);
            }
            SetDirty(true);
            UpdateUI();
        }
        private void OnApplyFilter(Object sender, EventArgs e)
        {
            DeviceFilterNode filter = (DeviceFilterNode) _cbAvailableFilters.SelectedItem;
            if(filter == null)
            {
                String name = _cbAvailableFilters.Text;
                Debug.Assert(
                    ((name != null) && (name.Length > 0)),
                    "Should not be trying to apply a filter with none selected. "
                    + "Missed a call to UpdateUI()?"
                );

                // If the user typed the name of a filter which exists in their
                // web.config, we need to find the original rather than create
                // a new external filter.
                filter = FindAvailableFilter(name);
                if(filter == null)
                {
                    /* Removed for DCR 4240
                    if (!DesignerUtility.IsValidName(name))
                    {
                        GenericUI.ShowWarningMessage(
                            SR.GetString(SR.AppliedDeviceFiltersDialog_Title),
                            SR.GetString(
                                SR.AppliedDeviceFiltersDialog_InvalidFilterName,
                                _cbAvailableFilters.Text
                            )
                        );
                        return;
                    }
                    */

                    filter = CreateExternalFilter(_cbAvailableFilters.Text);
                }
            }
            ChoiceTreeNode choice = new ChoiceTreeNode(
                filter,
                _designer
            );
            if(IsDefaultFilter(filter.Name))
            {
                if(DefaultFilterIsApplied)
                {
                    // Do not allow user to apply default filter if already
                    // been applied.
                    GenericUI.ShowWarningMessage(
                        SR.GetString(SR.AppliedDeviceFiltersDialog_Title),
                        SR.GetString(SR.AppliedDeviceFiltersDialog_DefaultFilterAlreadyApplied)
                    );
                }
                else
                {
                    // Add the default filter to the end of the list and
                    // remove it from list of available filters.
                    _appliedFiltersList.TvList.Nodes.Add(choice);
                    RemoveAvailableFilter(filter);
                }
            }
            else
            {
                // All other filters are added to the beginning
                _appliedFiltersList.TvList.Nodes.Insert(0, choice);
            }
            SetDirty(true);
            UpdateUI();
        }
 private void LoadChoice(DeviceSpecificChoice runtimeChoice)
 {
     DeviceFilterNode filterUsed =
         FindAvailableFilter(runtimeChoice.Filter);
     
     ChoiceTreeNode choice = new ChoiceTreeNode(
         filterUsed,
         runtimeChoice,
         _designer
     );
     _appliedFiltersList.TvList.Nodes.Add(choice);
 }