Example #1
0
        public bool ShouldRefreshColumn(PlaylistGridViewColumn column, IEnumerable <string> names)
        {
            if (names == null || !names.Any())
            {
                return(true);
            }
            switch (column.PlaylistColumn.Type)
            {
            case PlaylistColumnType.Script:
                return(names.Any(name => column.PlaylistColumn.Script.Contains(name, true)));

            case PlaylistColumnType.Plugin:
                var provider = PlaylistColumnProviderManager.GetProvider(column.PlaylistColumn.Plugin);
                if (provider != null)
                {
                    return(names.Any(name => provider.MetaData.Contains(name, StringComparer.OrdinalIgnoreCase)));
                }
                break;
            }
            return(true);
        }
Example #2
0
        public PlaylistGridViewColumn Create(PlaylistColumn column)
        {
            var gridViewColumn = new PlaylistGridViewColumn(column);

            switch (column.Type)
            {
            case PlaylistColumnType.Script:
                if (!string.IsNullOrEmpty(column.Script))
                {
                    gridViewColumn.DisplayMemberBinding = new PlaylistScriptBinding()
                    {
                        ScriptingContext = this.ScriptingContext.Value,
                        Script           = column.Script
                    };
                }
                break;

            case PlaylistColumnType.Plugin:
                if (!string.IsNullOrEmpty(column.Plugin))
                {
                    var provider = PlaylistColumnProviderManager.GetProvider(column.Plugin);
                    if (provider != null)
                    {
                        gridViewColumn.CellTemplate = provider.CellTemplate;
                    }
                }
                break;

            case PlaylistColumnType.Tag:
                if (!string.IsNullOrEmpty(column.Tag))
                {
                    gridViewColumn.DisplayMemberBinding = new PlaylistMetaDataBinding()
                    {
                        Name   = column.Tag,
                        Format = column.Format
                    };
                }
                break;
            }
            BindingHelper.Create(
                gridViewColumn,
                GridViewColumn.WidthProperty,
                typeof(GridViewColumn),
                column,
                "Width",
                ColumnWidthConverter.Instance,
                (sender, e) =>
            {
                if (IsAutoSizing(gridViewColumn))
                {
                    //Don't raise events while auto sizing is in progress.
                    return;
                }
                this.OnWidthChanged(column);
            }
                );
            BindingHelper.Create(
                gridViewColumn,
                GridViewColumnExtensions.PositionProperty,
                typeof(GridViewColumn),
                column,
                "Sequence",
                (sender, e) => this.OnPositionChanged(column)
                );
            return(gridViewColumn);
        }