|
5 | 5 | using System.Text.RegularExpressions; |
6 | 6 | using System.Threading.Tasks; |
7 | 7 | using System.Timers; |
8 | | -using System.Windows; |
9 | 8 |
|
10 | 9 | using CommunityToolkit.Mvvm.ComponentModel; |
11 | 10 | using CommunityToolkit.Mvvm.Input; |
@@ -69,7 +68,7 @@ public void Receive(PropertyChangedMessage<Nic> message) |
69 | 68 | #region Relay Commands |
70 | 69 |
|
71 | 70 | [RelayCommand] |
72 | | - private void CopyAllContentsAsText() |
| 71 | + private async Task CopyAllContentsAsTextAsync() |
73 | 72 | { |
74 | 73 | string iPv4Header = Nic.SupportsIPv4 ? Lang.TcpIPv4_Header : $"{Lang.AdapterNotSupported} {Lang.TcpIPv4_Header}"; |
75 | 74 | string iPv6Header = Nic.SupportsIPv6 ? Lang.TcpIPv6_Header : $"{Lang.AdapterNotSupported} {Lang.TcpIPv6_Header}"; |
@@ -104,51 +103,51 @@ private void CopyAllContentsAsText() |
104 | 103 | {Lang.NotSupported} |
105 | 104 | """; |
106 | 105 |
|
107 | | - Clipboard.SetText(text); |
| 106 | + await ClipboardHelper.SetTextAsync(text); |
108 | 107 | } |
109 | 108 |
|
110 | 109 | [RelayCommand] |
111 | | - private void CopyContentsAsText(string tag) |
| 110 | + private async Task CopyContentsAsTextAsync(string tag) |
112 | 111 | { |
113 | 112 | if (tag == Lang.AdapterProperties_Header) |
114 | 113 | { |
115 | | - Clipboard.SetText(Nic.ToString()); |
| 114 | + await ClipboardHelper.SetTextAsync(Nic.ToString()); |
116 | 115 | } |
117 | 116 | else if (tag == Lang.TcpIPv4_Header) |
118 | 117 | { |
119 | | - Clipboard.SetText(GetIPv4PropertyContents()); |
| 118 | + await ClipboardHelper.SetTextAsync(GetIPv4PropertyContents()); |
120 | 119 | } |
121 | 120 | else if (tag == Lang.IPv4GeneralProperties_Header) |
122 | 121 | { |
123 | | - Clipboard.SetText(IPv4AdvancedCofnig.FormatGeneralProperties()); |
| 122 | + await ClipboardHelper.SetTextAsync(IPv4AdvancedCofnig.FormatGeneralProperties()); |
124 | 123 | } |
125 | 124 | else if (tag == Lang.IPv4Lifetimes_Header) |
126 | 125 | { |
127 | | - Clipboard.SetText(IPv4AdvancedCofnig.FormatLifetimes()); |
| 126 | + await ClipboardHelper.SetTextAsync(IPv4AdvancedCofnig.FormatLifetimes()); |
128 | 127 | } |
129 | 128 | else if (tag == Lang.IPv4AdvancedProperties_Header) |
130 | 129 | { |
131 | | - Clipboard.SetText(FormatIPv4InterfaceProperties()); |
| 130 | + await ClipboardHelper.SetTextAsync(FormatIPv4InterfaceProperties()); |
132 | 131 | } |
133 | 132 | else if (tag == Lang.IPv4Statistics_Header) |
134 | 133 | { |
135 | | - Clipboard.SetText(FormatIPv4InterfaceStatistics()); |
| 134 | + await ClipboardHelper.SetTextAsync(FormatIPv4InterfaceStatistics()); |
136 | 135 | } |
137 | 136 | else if (tag == Lang.TcpIPv6_Header) |
138 | 137 | { |
139 | | - Clipboard.SetText(GetIPv6PropertyContents()); |
| 138 | + await ClipboardHelper.SetTextAsync(GetIPv6PropertyContents()); |
140 | 139 | } |
141 | 140 | else if (tag == Lang.IPv6GeneralProperties_Header) |
142 | 141 | { |
143 | | - Clipboard.SetText(IPv6AdvancedCofnig.FormatGeneralProperties()); |
| 142 | + await ClipboardHelper.SetTextAsync(IPv6AdvancedCofnig.FormatGeneralProperties()); |
144 | 143 | } |
145 | 144 | else if (tag == Lang.IPv6Lifetimes_Header) |
146 | 145 | { |
147 | | - Clipboard.SetText(IPv6AdvancedCofnig.FormatLifetimes()); |
| 146 | + await ClipboardHelper.SetTextAsync(IPv6AdvancedCofnig.FormatLifetimes()); |
148 | 147 | } |
149 | 148 | else if (tag == Lang.IPv6AdvancedProperties_Header) |
150 | 149 | { |
151 | | - Clipboard.SetText(FormatIPv6InterfaceProperties()); |
| 150 | + await ClipboardHelper.SetTextAsync(FormatIPv6InterfaceProperties()); |
152 | 151 | } |
153 | 152 | else if (tag == Lang.IPv6Statistics_Header) |
154 | 153 | { |
|
0 commit comments