File tree 3 files changed +53
-9
lines changed
3 files changed +53
-9
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,7 @@ public IdentityLookup(DeviceIdentification deviceIdentification)
81
81
82
82
VendorName = "Unknown Vendor" ;
83
83
Model = "Unknown Model" ;
84
+ VendorCode = BitConverter . ToString ( deviceIdentification . VendorCode . ToArray ( ) ) ;
84
85
85
86
var foundDevice = ( ( IEnumerable ) _lookup ) . Cast < dynamic > ( ) . FirstOrDefault ( device =>
86
87
device . VendorCode . ToString ( ) == BitConverter . ToString ( deviceIdentification . VendorCode . ToArray ( ) ) ) ;
@@ -104,6 +105,8 @@ public IdentityLookup(DeviceIdentification deviceIdentification)
104
105
$ "{ deviceIdentification . FirmwareMajor } .{ deviceIdentification . FirmwareMinor } .{ deviceIdentification . FirmwareBuild } ";
105
106
}
106
107
108
+ [ ObservableProperty ] private string _vendorCode = string . Empty ;
109
+
107
110
[ ObservableProperty ] private string _vendorName = string . Empty ;
108
111
109
112
[ ObservableProperty ] private string _model = string . Empty ;
Original file line number Diff line number Diff line change 49
49
TextAlignment =" Center"
50
50
TextWrapping =" Wrap"
51
51
Text =" Device Information" />
52
- <TextBlock
53
- FontSize =" 24"
54
- Margin =" 20 10 20 0"
55
- HorizontalAlignment =" Center"
56
- TextAlignment =" Center"
57
- TextWrapping =" Wrap"
58
- Text =" {Binding Path=ViewModel.IdentityLookup.VendorName}"
59
- d : Text =" ABC Corporation" />
52
+ <StackPanel Orientation =" Horizontal"
53
+ Margin =" 20 0 20 0"
54
+ HorizontalAlignment =" Center" >
55
+ <TextBlock
56
+ FontSize =" 24"
57
+ TextAlignment =" Left"
58
+ TextWrapping =" Wrap"
59
+ Text =" {Binding Path=ViewModel.IdentityLookup.VendorName}"
60
+ d : Text =" ABC Corporation" />
61
+ <TextBlock
62
+ FontSize =" 24"
63
+ TextAlignment =" Left"
64
+ TextWrapping =" Wrap"
65
+ Text =" (" />
66
+ <TextBlock
67
+ FontSize =" 24"
68
+ TextAlignment =" Left"
69
+ TextWrapping =" Wrap" >
70
+ <Hyperlink Click =" Hyperlink_OnClick" >
71
+ <Run Text =" {Binding Path=ViewModel.IdentityLookup.VendorCode}" />
72
+ </Hyperlink >
73
+ </TextBlock >
74
+ <TextBlock
75
+ FontSize =" 24"
76
+ TextAlignment =" Left"
77
+ TextWrapping =" Wrap"
78
+ Text =" )" />
79
+ </StackPanel >
60
80
<TextBlock
61
81
FontSize =" 20"
62
82
Margin =" 20 0 20 0"
Original file line number Diff line number Diff line change 1
- using System . Windows ;
1
+ using System . Net . Http ;
2
+ using System . Windows ;
2
3
using System . Windows . Controls ;
3
4
using System . Windows . Data ;
5
+ using System . Windows . Documents ;
4
6
using OSDPBench . Core . Actions ;
5
7
using OSDPBench . Core . Models ;
6
8
using OSDPBench . Core . ViewModels . Pages ;
@@ -159,4 +161,23 @@ private void SetReaderLedActionControl()
159
161
160
162
DeviceActionControl . Children . Add ( actionControl ) ;
161
163
}
164
+
165
+ private async void Hyperlink_OnClick ( object sender , RoutedEventArgs eventArgs )
166
+ {
167
+ string vendorCode = ( ( Run ) ( ( Hyperlink ) sender ) . Inlines . FirstInline ) . Text ;
168
+ string url = $ "https://macvendors.com/query/{ vendorCode } ";
169
+
170
+ using var client = new HttpClient ( ) ;
171
+
172
+ try
173
+ {
174
+ string result = await client . GetStringAsync ( url ) ;
175
+
176
+ MessageBox . Show ( result , "Vendor Information" ) ;
177
+ }
178
+ catch ( Exception exception )
179
+ {
180
+ MessageBox . Show ( $ "Unable to open OUI lookup: { exception . Message } ") ;
181
+ }
182
+ }
162
183
}
You can’t perform that action at this time.
0 commit comments