コード例 #1
0
ファイル: SqliteWordList.cs プロジェクト: aata/szotar
        /// <summary>Get a property of an entry from the database.</summary>
        public override T GetProperty <T>(WordListEntry entry, EntryProperty property)
        {
            int index = IndexOf(entry);

            Debug.Assert(index >= 0);
            return((T)worker.GetProperty(index, property.ToString()));
        }
コード例 #2
0
ファイル: SqliteWordList.cs プロジェクト: aata/szotar
        /// <summary>Set a property of an entry in the database (but not in the in-memory list).</summary>
        public override void SetProperty(WordListEntry entry, EntryProperty property, object value)
        {
            int index = IndexOf(entry);

            Debug.Assert(index >= 0);
            worker.SetProperty(index, property.ToString(), value);
        }
コード例 #3
0
ファイル: SqliteWordList.cs プロジェクト: aata/szotar
 public SetValue(SqliteWordList owner, int index, EntryProperty property, T oldValue, T newValue)
     : base(owner)
 {
     this.index    = index;
     this.oldValue = oldValue;
     this.newValue = newValue;
     this.property = property;
 }
コード例 #4
0
        protected EntryProperty GetEntryProperty(bool createIfN = false)
        {
            var result = Entry.GetProperty(PropertyName);

            if (result == null && createIfN)
            {
                result = new EntryProperty(PropertyName);
                Entry.Properties.Add(result);
            }
            return(result);
        }
コード例 #5
0
        /// <summary>
        /// Initializes a new instance of the PropertyItemViewModel class.
        /// </summary>
        public PropertyItemViewModel(DescriptorProperty descriptorProperty, EntryItemViewModel parent,
                                     ManifestEditorViewModel editor)
            : base(parent)
        {
            if (descriptorProperty == null)
            {
                throw new ArgumentNullException("descriptorProperty", "descriptorProperty is null.");
            }
            if (parent == null)
            {
                throw new ArgumentNullException("parent", "parent is null.");
            }
            if (editor == null)
            {
                throw new ArgumentNullException("editor", "editor is null.");
            }

            var referencedType = descriptorProperty.ReferencedType;

            if (!descriptorProperty.AsContainment || string.IsNullOrWhiteSpace(referencedType))
            {
                throw new ArgumentException("Invalid descriptor property");
            }

            _descriptorProperty = descriptorProperty;
            _editor             = editor;
            TreeItemLabel       = descriptorProperty.Label;

            var childDescriptors = new List <Descriptor>(
                _editor.AllDescriptors.Values.Where(
                    d => !d.IsVirtual && (
                        d.Type == referencedType ||
                        d.Supertypes.Contains(referencedType) ||
                        d.Interfaces.Contains(referencedType))));

            _entryProperty = parent.Entry.GetPropertyAndCreateIfN(descriptorProperty.Name);

            IsExpanded = true;

            MenuItems = new List <MenuItemViewModel>
            {
                new MenuItemViewModel(Properties.Resources.EDITOR_NEW_CI, null, new List <MenuItemViewModel>(
                                          from descriptor in childDescriptors
                                          select new MenuItemViewModel(descriptor.Type, new DelegateCommand(() => DoAdd(descriptor)), null)
                                          ))
            };
        }
コード例 #6
0
        public BooleanPropertyEntryEditorViewModel(ManifestEditorViewModel manifestEditor,
                                                   DescriptorProperty propertyDescriptor, Entry entry)
            : base(manifestEditor, propertyDescriptor, entry)
        {
            AvailableValues = new List <KeyValuePair <string, bool?> >
            {
                new KeyValuePair <string, bool?>(Resources.PROPERTY_BOOL_TRUE, true),
                new KeyValuePair <string, bool?>(Resources.PROPERTY_BOOL_FALSE, false),
                new KeyValuePair <string, bool?>(Resources.PROPERTY_BOOL_ND, null)
            };
            EntryProperty property = GetEntryProperty();

            if (property != null)
            {
                Value = property.GetBoolValue();
            }
        }
コード例 #7
0
        public EnumPropertyEntryEditorViewModel(ManifestEditorViewModel manifestEditor,
                                                DescriptorProperty propertyDescriptor, Entry entry)
            : base(manifestEditor, propertyDescriptor, entry)
        {
            var values = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>(Resources.PROPERTY_ENUM_ND, null)
            };

            values.AddRange(propertyDescriptor.EnumValues.Select(_ => new KeyValuePair <string, string>(_, _)));

            AvailableValues = values;

            EntryProperty property = GetEntryProperty();

            if (property != null)
            {
                Value = property.GetEnumValue();
            }
        }
コード例 #8
0
 get => (PaddedEntry)GetValue(EntryProperty); set => SetValue(EntryProperty, value);
 set => SetValue(EntryProperty, value);
コード例 #10
0
ファイル: WordList.cs プロジェクト: aata/szotar
 /// <summary>Set a property of an entry in the database (but not in the in-memory list).</summary>
 public abstract void SetProperty(WordListEntry entry, EntryProperty property, object value);
コード例 #11
0
ファイル: WordList.cs プロジェクト: aata/szotar
 // These should be probably protected, since they don't set the in-memory values,
 // but WordListEntry uses them.
 /// <summary>Get a property of an entry in the database (but not in the in-memory list).</summary>
 public abstract T GetProperty <T>(WordListEntry entry, EntryProperty property);