protected void SaveChoices(
            IDeviceSpecificDesigner designer,
            String deviceSpecificID,
            ICollection choices
            )
        {
            DeviceSpecific deviceSpecific;

            if (!designer.GetDeviceSpecific(deviceSpecificID, out deviceSpecific))
            {
                return;
            }

            if (choices.Count == 0)
            {
                designer.SetDeviceSpecific(deviceSpecificID, null);
                return;
            }

            if (deviceSpecific == null)
            {
                deviceSpecific = new DeviceSpecific();
            }
            else
            {
                deviceSpecific.Choices.Clear();
            }
            foreach (ChoiceTreeNode node in choices)
            {
                node.CommitChanges();
                DeviceSpecificChoice choice = node.Choice.RuntimeChoice;
                deviceSpecific.Choices.Add(choice);
            }
            designer.SetDeviceSpecific(deviceSpecificID, deviceSpecific);
        }
        protected bool IsHTMLSchema(DeviceSpecificChoice choice)
        {
            Debug.Assert(choice != null);

            return(choice.Xmlns != null &&
                   choice.Xmlns.ToLower(CultureInfo.InvariantCulture).IndexOf(_htmlString, StringComparison.Ordinal) != -1);
        }
 internal ChoiceTreeNode(
     DeviceFilterNode filter,
     DeviceSpecificChoice runtimeChoice,
     IDeviceSpecificDesigner designer
     ) : base()
 {
     _designer      = designer;
     _runtimeChoice = runtimeChoice;
     Name           = _runtimeChoice.Filter;
     Argument       = _runtimeChoice.Argument;
 }
示例#4
0
 private void debug_CheckChoicesForDuplicate(DeviceSpecificChoice runtimeChoice)
 {
     foreach (ChoiceTreeNode choiceNode in _cbChoices.Items)
     {
         if (choiceNode.Name == runtimeChoice.Filter &&
             choiceNode.RuntimeChoice.Argument == runtimeChoice.Argument)
         {
             Debug.Fail("Loaded duplicate choice: " +
                        DesignerUtility.ChoiceToUniqueIdentifier(runtimeChoice));
         }
     }
 }
示例#5
0
        internal ChoicePropertyFilter(
            DeviceSpecificChoice choice,
            IDeviceSpecificDesigner designer,
            ISite site
            )
        {
            _events   = new EventHandlerList();
            _choice   = choice;
            _site     = site;
            _designer = designer;

            CreateLocalCopiesOfObjects();
        }
示例#6
0
 private void SetSchemaValue()
 {
     if (_ds != null &&
         _cmbChoices.SelectedIndex >= 0)
     {
         String currentChoiceIdentifier = _cmbChoices.SelectedItem as String;
         if (currentChoiceIdentifier != null && !currentChoiceIdentifier.Equals(SR.GetString(SR.DeviceFilter_NoChoice)))
         {
             DeviceSpecificChoice dsc = GetChoiceFromIdentifier((String)currentChoiceIdentifier, _ds);
             _cmbSchemas.Text = UrlToFriendlySchema(dsc.Xmlns);
         }
     }
 }
        private void LoadChoice(DeviceSpecificChoice runtimeChoice)
        {
            DeviceFilterNode filterUsed =
                FindAvailableFilter(runtimeChoice.Filter);

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

            _appliedFiltersList.TvList.Nodes.Add(choice);
        }
示例#8
0
        private void OnLostFocusSchemasComboBox(Object sender, EventArgs e)
        {
            Debug.Assert(_ds != null);
            Debug.Assert(_cmbChoices.SelectedIndex >= 0);
            DeviceSpecificChoice choice = GetChoiceFromIdentifier((String)_cmbChoices.SelectedItem, _ds);
            String urlSchema            = FriendlyToUrlSchema(_cmbSchemas.Text);

            if (0 != String.Compare(choice.Xmlns, urlSchema, false, CultureInfo.InvariantCulture))
            {
                String previousUrlSchema = choice.Xmlns;
                if (!_strCollSchemas.Contains(previousUrlSchema))
                {
                    int previousSchemaOccurrences = 0;
                    foreach (DeviceSpecificChoice choiceTmp in _ds.Choices)
                    {
                        if (0 == String.Compare(choiceTmp.Xmlns, previousUrlSchema, false, CultureInfo.InvariantCulture))
                        {
                            previousSchemaOccurrences++;
                        }
                    }
                    Debug.Assert(previousSchemaOccurrences > 0);
                    if (previousSchemaOccurrences == 1)
                    {
                        bool standardSchema = false;
                        for (int i = 0; i < _standardSchemaNumber; i++)
                        {
                            if (0 == String.Compare(_schemasUrl[i], previousUrlSchema, false, CultureInfo.InvariantCulture))
                            {
                                standardSchema = true;
                                break;
                            }
                        }
                        if (!standardSchema)
                        {
                            _cmbSchemas.Items.Remove(UrlToFriendlySchema(previousUrlSchema));
                        }
                    }
                }
                choice.Xmlns = urlSchema;
                String friendlySchema = UrlToFriendlySchema(urlSchema);
                if (friendlySchema != String.Empty &&
                    !CaseSensitiveComboSearch(_cmbSchemas, friendlySchema))
                {
                    _cmbSchemas.AddItem(friendlySchema);
                }
            }
        }
示例#9
0
        bool IDeviceSpecificDesigner.GetDeviceSpecific(String deviceSpecificParentID, out DeviceSpecific ds)
        {
            Debug.Assert(deviceSpecificParentID == _currentDeviceSpecificID);

            ds = null;
            if (_cbChoices.Items.Count > 0)
            {
                ds = new DeviceSpecific();
                foreach (ChoiceTreeNode choiceNode in _cbChoices.Items)
                {
                    DeviceSpecificChoice choice = choiceNode.Choice.RuntimeChoice;
                    ds.Choices.Add(choice);
                }
            }

            return(true);
        }
        internal ChoiceTreeNode(
            DeviceFilterNode filter,
            IDeviceSpecificDesigner designer
            ) : base()
        {
            Name                  = filter.Name;
            _designer             = designer;
            _runtimeChoice        = new DeviceSpecificChoice();
            _runtimeChoice.Filter = filter.Name;

            if (
                // This looks like circular reasoning, but the designer is a
                // IDeviceSpecificDesigner and we are interested in the
                // type of the designer's parent control.
                Adapters.DesignerAdapterUtil.ControlDesigner(designer.UnderlyingControl)
                is MobileTemplatedControlDesigner
                )
            {
                _runtimeChoice.Xmlns = SR.GetString(SR.MarkupSchema_HTML32);
            }
        }
	public void AddAt(int index, DeviceSpecificChoice choice) {}
	// Methods
	public void Add(DeviceSpecificChoice choice) {}
 private bool ChoiceHasContent(DeviceSpecificChoice runtimeChoice)
 {
     return((runtimeChoice.Contents.Count > 0) || runtimeChoice.HasTemplates);
 }
 // Methods
 public void Add(DeviceSpecificChoice choice)
 {
 }
 public void AddAt(int index, DeviceSpecificChoice choice)
 {
 }
	public void Remove(DeviceSpecificChoice choice) {}
 internal static String ChoiceToUniqueIdentifier(DeviceSpecificChoice choice)
 {
     Debug.Assert(choice != null);
     return(ChoiceToUniqueIdentifier(choice.Filter, choice.Argument));
 }
 public void Remove(DeviceSpecificChoice choice)
 {
 }