Example #1
0
        public static void HighlightCurrentItem(Window window, CodeDocumentViewModel codeDocumentViewModel)
        {
            if (Settings.Default.DisableHighlight)
            {
                return;
            }

            System.Windows.Threading.Dispatcher.CurrentDispatcher.VerifyAccess();

            try
            {
                if (!(window?.Selection is TextSelection))
                {
                    return;
                }
            }
            catch (Exception)
            {
                return;
            }

            HighlightCurrentItem(codeDocumentViewModel, ((TextSelection)window.Selection).CurrentLine,
                                 ColorHelper.ToMediaColor(EnvironmentColors.ToolWindowTabSelectedTextColorKey),
                                 GetBackgroundBrush().Color,
                                 ColorHelper.ToMediaColor(EnvironmentColors.FileTabButtonDownSelectedActiveColorKey),
                                 ColorHelper.ToMediaColor(EnvironmentColors.ToolWindowTextColorKey));
        }
Example #2
0
        /// <summary>
        /// Revert code item foreground and background to previous state
        /// </summary>
        /// <param name="codeItem">code item</param>
        public static void ClearBookmark(CodeItem codeItem)
        {
            if (codeItem == null)
            {
                return;
            }

            codeItem.BackgroundColor = Brushes.Transparent.Color;
            codeItem.ForegroundColor = ColorHelper.ToMediaColor(EnvironmentColors.ToolWindowTextColorKey);
        }
Example #3
0
        public static void SetBookmarkStyles(CodeDocumentViewModel codeDocumentViewModel, ControlCollection controls, string solutionFilePath)
        {
            var styles = new List <BookmarkStyle>();

            foreach (var item in controls)
            {
                var label = item as Label;
                styles.Add(new BookmarkStyle(ColorHelper.ToMediaColor(label.BackColor), ColorHelper.ToMediaColor(label.ForeColor)));
            }

            codeDocumentViewModel.BookmarkStyles = styles;

            SolutionStorageHelper.SaveToSolutionStorage(solutionFilePath, codeDocumentViewModel);
        }
Example #4
0
        public static void SetForeground(IEnumerable <CodeItem> items)
        {
            if (items == null)
            {
                return;
            }

            foreach (var item in items)
            {
                item.ForegroundColor = ColorHelper.ToMediaColor(EnvironmentColors.ToolWindowTextColorKey);

                if (item is IMembers)
                {
                    var hasMembersItem = (IMembers)item;
                    if (hasMembersItem.Members.Any())
                    {
                        SetForeground(hasMembersItem.Members);
                    }
                }
            }
        }