public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var vm  = value as ExceptionVM;
            var tag = parameter as string;

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

            var writer = Cache.GetWriter();

            try {
                var printer = new ExceptionPrinter(writer);
                if (tag == PredefinedTextClassifierTags.ExceptionSettingsWindowName)
                {
                    printer.WriteName(vm);
                }
                else
                {
                    return(null);
                }

                var context = new TextClassifierContext(writer.Text, tag, vm.Context.SyntaxHighlight, writer.Colors);
                return(vm.Context.TextElementProvider.CreateTextElement(vm.Context.ClassificationFormatMap, context, ContentTypes.ExceptionSettingsWindow, TextElementFlags.FilterOutNewLines | TextElementFlags.CharacterEllipsis));
            }
            finally {
                Cache.FreeWriter(writer);
            }
        }
		public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
			var vm = value as ExceptionVM;
			var s = parameter as string;
			if (vm == null || s == null)
				return null;

			var gen = UISyntaxHighlighter.Create(DebuggerSettings.Instance.SyntaxHighlightExceptions);
			var printer = new ExceptionPrinter(gen.TextOutput);
			if (StringComparer.OrdinalIgnoreCase.Equals(s, "Name"))
				printer.WriteName(vm);
			else
				return null;

			return gen.CreateTextBlock(true);
		}
Beispiel #3
0
		public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
			var vm = value as ExceptionVM;
			var s = parameter as string;
			if (vm == null || s == null)
				return null;

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

			return gen.CreateResult(true);
		}
Beispiel #4
0
        public override void Execute(ExceptionsCtxMenuContext context)
        {
            var output = new NoSyntaxHighlightOutput();

            foreach (var vm in context.SelectedItems)
            {
                var printer = new ExceptionPrinter(output);
                printer.WriteName(vm);
                output.WriteLine();
            }
            var s = output.ToString();

            if (s.Length > 0)
            {
                Clipboard.SetText(s);
            }
        }
Beispiel #5
0
        public override void Execute(ExceptionsCtxMenuContext context)
        {
            var output = new StringBuilderTextColorOutput();

            foreach (var vm in context.SelectedItems)
            {
                var printer = new ExceptionPrinter(output);
                printer.WriteName(vm);
                output.WriteLine();
            }
            var s = output.ToString();

            if (s.Length > 0)
            {
                try {
                    Clipboard.SetText(s);
                }
                catch (ExternalException) { }
            }
        }
		public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
			var vm = value as ExceptionVM;
			var tag = parameter as string;
			if (vm == null || tag == null)
				return null;

			var writer = Cache.GetWriter();
			try {
				var printer = new ExceptionPrinter(writer);
				if (tag == PredefinedTextClassifierTags.ExceptionSettingsWindowName)
					printer.WriteName(vm);
				else
					return null;

				var context = new TextClassifierContext(writer.Text, tag, vm.Context.SyntaxHighlight, writer.Colors);
				return vm.Context.TextElementProvider.CreateTextElement(vm.Context.ClassificationFormatMap, context, ContentTypes.ExceptionSettingsWindow, TextElementFlags.FilterOutNewLines | TextElementFlags.CharacterEllipsis);
			}
			finally {
				Cache.FreeWriter(writer);
			}
		}
Beispiel #7
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var vm = value as ExceptionVM;
            var s  = parameter as string;

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

            var gen     = UISyntaxHighlighter.Create(DebuggerSettings.Instance.SyntaxHighlightExceptions);
            var printer = new ExceptionPrinter(gen.TextOutput);

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

            return(gen.CreateTextBlock(true));
        }
Beispiel #8
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var vm = value as ExceptionVM;
            var s  = parameter as string;

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

            var gen     = ColorizedTextElementProvider.Create(vm.Context.SyntaxHighlight);
            var printer = new ExceptionPrinter(gen.Output);

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

            return(gen.CreateResult(true));
        }