コード例 #1
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var vm = value as GACFileVM;
            var s  = parameter as string;

            if (vm == null || s == null)
            {
                return(null);
            }

            var gen     = UISyntaxHighlighter.Create(vm.Owner.SyntaxHighlight);
            var printer = new GACFilePrinter(gen.Output);

            if (StringComparer.OrdinalIgnoreCase.Equals(s, "Name"))
            {
                printer.WriteName(vm);
            }
            else if (StringComparer.OrdinalIgnoreCase.Equals(s, "Version"))
            {
                printer.WriteVersion(vm);
            }
            else
            {
                return(null);
            }

            return(gen.CreateResult(true));
        }
コード例 #2
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var vm = value as GACFileVM;
            var s = parameter as string;
            if (vm == null || s == null)
                return null;

            var gen = UISyntaxHighlighter.Create(vm.Owner.SyntaxHighlight);
            var printer = new GACFilePrinter(gen.Output);
            if (StringComparer.OrdinalIgnoreCase.Equals(s, "Name"))
                printer.WriteName(vm);
            else if (StringComparer.OrdinalIgnoreCase.Equals(s, "Version"))
                printer.WriteVersion(vm);
            else
                return null;

            return gen.CreateResult(true);
        }