private void CreateAdornments(ITextDocument document, IWpfTextView textView) { string fileName = document.FilePath; if (Path.GetFileName(fileName) == Constants.CONFIG_FILENAME) { LogoAdornment highlighter = new LogoAdornment(textView, _isVisible, _initOpacity); } else if (Path.IsPathRooted(fileName)) { try { var item = WebCompilerPackage._dte.Solution.FindProjectItem(fileName); if (item == null || item.ContainingProject == null) { return; } string configFile = item.ContainingProject.GetConfigFile(); if (string.IsNullOrEmpty(configFile)) { return; } string extension = Path.GetExtension(fileName.Replace(".map", "")); string normalizedFilePath = fileName.Replace(".map", "").Replace(".min" + extension, extension); var configs = ConfigHandler.GetConfigs(configFile); foreach (Config config in configs) { if (GlobHelper.IsGlobPattern(config.InputFile)) { continue; } if (config.GetAbsoluteOutputFile().FullName.Equals(normalizedFilePath, StringComparison.OrdinalIgnoreCase)) { GeneratedAdornment generated = new GeneratedAdornment(textView, _isVisible, _initOpacity); textView.Properties.AddProperty("generated", true); break; } } } catch (Exception ex) { Logger.Log(ex); } } }
private void CreateImage() { _adornment = new TextBlock(); _adornment.Text = "Generated"; _adornment.FontSize = 75; _adornment.FontWeight = FontWeights.Bold; _adornment.Foreground = Brushes.Gray; _adornment.ToolTip = "Click to toggle visibility"; _adornment.Opacity = _currentOpacity; _adornment.MouseEnter += (s, e) => { _adornment.Opacity = 1; }; _adornment.MouseLeave += (s, e) => { _adornment.Opacity = _currentOpacity; }; _adornment.MouseLeftButtonUp += (s, e) => { LogoAdornment.OnVisibilityChanged(_currentOpacity == 0); }; }
private void CreateImage() { _adornment = new TextBlock(); _adornment.Text = "Generated"; _adornment.FontSize = 75; _adornment.FontWeight = FontWeights.Bold; _adornment.Foreground = Brushes.Gray; _adornment.ToolTip = "Click to toggle visibility"; _adornment.Opacity = _currentOpacity; _adornment.SetValue(TextOptions.TextRenderingModeProperty, TextRenderingMode.Aliased); _adornment.SetValue(TextOptions.TextFormattingModeProperty, TextFormattingMode.Ideal); _adornment.MouseEnter += (s, e) => { _adornment.Opacity = 1; }; _adornment.MouseLeave += (s, e) => { _adornment.Opacity = _currentOpacity; }; _adornment.MouseLeftButtonUp += (s, e) => { LogoAdornment.OnVisibilityChanged(_currentOpacity == 0); }; }
private void CreateAdornments(ITextDocument document, IWpfTextView textView) { string fileName = document.FilePath; if (Path.GetFileName(fileName) == Constants.CONFIG_FILENAME) { LogoAdornment highlighter = new LogoAdornment(textView, _isVisible, _initOpacity); } else if (Path.IsPathRooted(fileName)) { try { var item = WebCompilerPackage._dte.Solution.FindProjectItem(fileName); if (item == null || item.ContainingProject == null) return; string configFile = item.ContainingProject.GetConfigFile(); if (string.IsNullOrEmpty(configFile)) return; string extension = Path.GetExtension(fileName.Replace(".map", "")); string normalizedFilePath = fileName.Replace(".map", "").Replace(".min" + extension, extension); var configs = ConfigHandler.GetConfigs(configFile); foreach (Config config in configs) { if (config.GetAbsoluteOutputFile().FullName.Equals(normalizedFilePath, StringComparison.OrdinalIgnoreCase)) { GeneratedAdornment generated = new GeneratedAdornment(textView, _isVisible, _initOpacity); textView.Properties.AddProperty("generated", true); break; } } } catch (Exception ex) { Logger.Log(ex); } } }