示例#1
0
        /// <summary>
        /// Constructor for dialog
        /// </summary>
        /// <param name="coreProps"></param>
        public PropertyConfigDialog(IEnumerable <int> coreProps, TypeBase source, string title)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            InitializeComponent();

            this.Title = string.Format(CultureInfo.InvariantCulture,
                                       Properties.Resources.PropertyConfigDialog_TitleFormat, title);
            this.ctrlPropertySelect.LeftColumnTitle = string.Format(CultureInfo.InvariantCulture,
                                                                    Properties.Resources.PropertyConfigDialog_AllItemsFormat, title);
            this.ctrlPropertySelect.RightColumnTitle = string.Format(CultureInfo.InvariantCulture,
                                                                     Properties.Resources.PropertyConfigDialog_SelectedItemsFormat, title);

            var list = (from kv in source.GetKeyValuePairList()
                        where !DesktopElement.IsExcludedProperty(kv.Key, kv.Value)
                        select new RecordEntitySetting {
                Id = kv.Key,
                Name = kv.Value,
                IsRecorded = coreProps.Contains(kv.Key),
                Type = RecordEntityType.Property
            }).ToList();

            var selList = coreProps.Select(l => list.Where(r => r.Id == l).FirstOrDefault()).ToList();

            CoreProperties = selList.ToList();// generate base list here.
            ctrlPropertySelect.SetLists(list.ToList(), selList);
            ((INotifyCollectionChanged)ctrlPropertySelect.lvRight.Items).CollectionChanged += lvRight_CollectionChanged;
        }
示例#2
0
        /// <summary>
        /// Constructor for dialog
        /// </summary>
        /// <param name="coreProps"></param>
        public PropertyConfigDialog(IEnumerable <int> coreProps, TypeBase source, string title)
        {
            InitializeComponent();

            this.Title = $"{title} Configuration";
            this.ctrlPropertySelect.LeftColumnTitle  = $"All {title}";
            this.ctrlPropertySelect.RightColumnTitle = $"Selected {title}";

            var list = (from kv in source.GetKeyValuePairList()
                        where !DesktopElement.IsExcludedProperty(kv.Key, kv.Value)
                        select new RecordEntitySetting {
                Id = kv.Key,
                Name = kv.Value,
                IsRecorded = coreProps.Contains(kv.Key),
                Type = RecordEntityType.Property
            }).ToList();

            var selList = coreProps.Select(l => list.Where(r => r.Id == l).FirstOrDefault()).ToList();

            CoreProperties = selList.ToList();// generate base list here.
            ctrlPropertySelect.SetLists(list.ToList(), selList);
            ((INotifyCollectionChanged)ctrlPropertySelect.lvRight.Items).CollectionChanged += lvRight_CollectionChanged;
        }
 private static TemplateData CreateTemplateData <T>(int id, TypeBase typeBase)
 {
     return(CreateTemplateData <T>(id, typeBase.GetKeyValuePairList()));
 }