Skip to content

Commit 2812930

Browse files
committed
Add 'HighlightOnly' click action and fix incorrect command name.
1 parent 06beaa7 commit 2812930

File tree

3 files changed

+48
-5
lines changed

3 files changed

+48
-5
lines changed

MdXaml/LinkActions/DiaplayCommand.cs renamed to MdXaml/LinkActions/DisplayCommand.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
namespace MdXaml.LinkActions
88
{
99
// set `public` access level for #29.
10-
public class DiaplayCommand : ICommand
10+
public class DisplayCommand : ICommand
1111
{
1212
private MarkdownScrollViewer Owner;
1313
private bool OpenBrowserWithAbsolutePath;
1414
private ICommand OpenCommand;
1515

16-
public DiaplayCommand(MarkdownScrollViewer owner, bool openBrowserWithAbsolutePath, bool safety)
16+
public DisplayCommand(MarkdownScrollViewer owner, bool openBrowserWithAbsolutePath, bool safety)
1717
{
1818
Owner = owner;
1919
OpenBrowserWithAbsolutePath = openBrowserWithAbsolutePath;
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using System;
2+
using System.Windows.Input;
3+
4+
namespace MdXaml.LinkActions
5+
{
6+
public class HighlightOnlyCommand : ICommand
7+
{
8+
public event EventHandler? CanExecuteChanged;
9+
10+
private bool _isExecutable = true;
11+
public bool IsExecutable
12+
{
13+
get => _isExecutable;
14+
set
15+
{
16+
if (_isExecutable != value)
17+
{
18+
_isExecutable = value;
19+
CanExecuteChanged?.Invoke(this, new EventArgs());
20+
}
21+
}
22+
}
23+
24+
public bool CanExecute(object? parameter) => _isExecutable;
25+
26+
public void Execute(object? parameter)
27+
{
28+
//var path = parameter?.ToString();
29+
//if (path is null) throw new ArgumentNullException(nameof(parameter));
30+
31+
//Process.Start(new ProcessStartInfo(path)
32+
//{
33+
// UseShellExecute = true,
34+
// Verb = "open"
35+
//});
36+
}
37+
}
38+
}

MdXaml/MarkdownScrollViewer.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,19 +443,23 @@ private void UpdateClickAction()
443443
break;
444444

445445
case ClickAction.DisplayWithRelativePath:
446-
command = new DiaplayCommand(this, true, false);
446+
command = new DisplayCommand(this, true, false);
447447
break;
448448

449449
case ClickAction.DisplayAll:
450-
command = new DiaplayCommand(this, false, false);
450+
command = new DisplayCommand(this, false, false);
451451
break;
452452

453453
case ClickAction.SafetyOpenBrowser:
454454
command = new SafetyOpenCommand();
455455
break;
456456

457457
case ClickAction.SafetyDisplayWithRelativePath:
458-
command = new DiaplayCommand(this, true, true);
458+
command = new DisplayCommand(this, true, true);
459+
break;
460+
461+
case ClickAction.HighlightOnly:
462+
command = new HighlightOnlyCommand();
459463
break;
460464

461465
default:
@@ -641,6 +645,7 @@ public enum ClickAction
641645
DisplayAll,
642646
SafetyOpenBrowser,
643647
SafetyDisplayWithRelativePath,
648+
HighlightOnly,
644649
}
645650

646651
public enum SyntaxVersion

0 commit comments

Comments
 (0)