예제 #1
0
    /// <summary>
    /// OnParametersSet 方法
    /// </summary>
    protected override void OnParametersSet()
    {
        base.OnParametersSet();

        LeftPanelText ??= Localizer[nameof(LeftPanelText)];
        RightPanelText ??= Localizer[nameof(RightPanelText)];

        var list = CurrentValueAsString.Split(',', StringSplitOptions.RemoveEmptyEntries);

        LeftItems.Clear();
        RightItems.Clear();

        Items ??= Enumerable.Empty <SelectedItem>();

        // 左侧移除
        LeftItems.AddRange(Items);
        LeftItems.RemoveAll(i => list.Any(l => l == i.Value));

        // 右侧插入
        foreach (var t in list)
        {
            var item = Items.FirstOrDefault(i => i.Value == t);
            if (item != null)
            {
                RightItems.Add(item);
            }
        }
    }
예제 #2
0
        /// <summary>
        /// OnInitialized 方法
        /// </summary>
        protected override void OnInitialized()
        {
            base.OnInitialized();

            if (Items != null)
            {
                LeftItems.AddRange(Items.Where(i => !i.Active));
                RightItems.AddRange(Items.Where(i => i.Active));
            }
        }
예제 #3
0
        private void ResetItems()
        {
            LeftItems.Clear();
            RightItems.Clear();
            if (Items != null)
            {
                LeftItems.AddRange(Items.Where(i => !i.Active));
            }

            if (Items != null)
            {
                RightItems.AddRange(Items.Where(i => i.Active));
            }
        }