示例#1
0
 private void Reset()
 {
     codeLocation         = null;
     achievementUiElement = null;
     adornmentVisible     = false;
     layer.RemoveAllAdornments();
     descriptionLayer.RemoveAllAdornments();
 }
            protected void UnlockWith(AbstractNode location)
            {
                CodeLocation = new AchievementCodeLocation();

                CodeLocation.From.Line   = location.StartLocation.Line;
                CodeLocation.From.Column = location.StartLocation.Column;

                CodeLocation.To.Line   = location.EndLocation.Line;
                CodeLocation.To.Column = location.EndLocation.Column;

                IsAchievementUnlocked = true;
            }
示例#3
0
        public AchievementAdornments(IWpfTextView view)
        {
            this.view             = view;
            this.layer            = view.GetAdornmentLayer("AchievementAdornments");
            this.descriptionLayer = view.GetAdornmentLayer("AchievementAdornmentsDescription");

            view.LayoutChanged += OnLayoutChanged;

            Brush brush = new SolidColorBrush(Color.FromArgb(0x20, 0x00, 0x00, 0xff));

            brush.Freeze();

            Brush penBrush = new SolidColorBrush(Colors.Red);

            penBrush.Freeze();

            Pen pen = new Pen(penBrush, 0.5);

            pen.Freeze();

            this.brush = brush;
            this.pen   = pen;

            AchievementContext.AchievementClicked += (sender, args) =>
            {
                Reset();

                var filePath = GetFilePath(view);
                if (args.AchievementDescriptor.CodeLocation.FileName != filePath)
                {
                    return;
                }

                codeLocation         = args.AchievementDescriptor.CodeLocation;
                achievementUiElement = (UIElement)args.UIElement;

                CreateAdornment();
            };
        }