-
Notifications
You must be signed in to change notification settings - Fork 2
/
GroundStation.cs
696 lines (594 loc) · 25.7 KB
/
GroundStation.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
#region "copyright"
/*
Copyright Dale Ghent <[email protected]>
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/
*/
#endregion "copyright"
using CommunityToolkit.Mvvm.Input;
using DaleGhent.NINA.GroundStation.Mqtt;
using DaleGhent.NINA.GroundStation.TTS;
using DaleGhent.NINA.GroundStation.Utilities;
using DaleGhent.NINA.GroundStation.PushoverClient;
using NINA.Core.Enum;
using NINA.Core.Utility;
using NINA.Core.Utility.Notification;
using NINA.Plugin;
using NINA.Plugin.Interfaces;
using NINA.Profile.Interfaces;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Composition;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Threading;
using System.Threading.Tasks;
namespace DaleGhent.NINA.GroundStation {
[Export(typeof(IPluginManifest))]
public partial class GroundStation : PluginBase, ISettings, INotifyPropertyChanged {
private MqttClient mqttClient;
[ImportingConstructor]
public GroundStation() {
if (Properties.Settings.Default.UpgradeSettings) {
Properties.Settings.Default.Upgrade();
Properties.Settings.Default.UpgradeSettings = false;
CoreUtil.SaveSettings(Properties.Settings.Default);
}
}
public override Task Initialize() {
if (MqttLwtEnable) {
LwtStartWorker();
}
Logger.Debug("Init completed");
return Task.CompletedTask;
}
public override async Task Teardown() {
if (MqttLwtEnable) {
await LwtStopWorker();
}
return;
}
[RelayCommand]
private static async Task<bool> PushoverTest(object arg) {
var send = new SendToPushover.SendToPushover() {
Message = "Test Message",
Title = "Test Title",
Attempts = 1
};
await send.Run(default, default);
if (send.Status == SequenceEntityStatus.FAILED) {
Notification.ShowExternalError($"Failed to send message to Pushover:{Environment.NewLine}{string.Join(Environment.NewLine, send.Issues)}", "Pushover Error");
return false;
} else {
Notification.ShowSuccess("Pushover message sent");
return true;
}
}
[RelayCommand]
private static async Task<bool> EmailTest(object arg) {
var send = new SendToEmail.SendToEmail() {
Subject = "Test Subject",
Body = "Test Body",
Attempts = 1
};
if (send.Validate()) {
await send.Run(default, default);
} else {
Notification.ShowExternalError($"Failed to send email:{Environment.NewLine}{string.Join(Environment.NewLine, send.Issues)}", "Email Error");
return false;
}
if (send.Status == SequenceEntityStatus.FINISHED) {
Notification.ShowSuccess("Email sent");
return true;
} else {
// Something bad happened further down and should have produced an error notification. (runtime exception)
return false;
}
}
[RelayCommand]
private static async Task<bool> TelegramTest(object arg) {
var send = new SendToTelegram.SendToTelegram() {
Message = "Test Message",
Attempts = 1
};
await send.Run(default, default);
if (send.Status == SequenceEntityStatus.FAILED) {
Notification.ShowExternalError($"Failed to send message to Telegram:{Environment.NewLine}{string.Join(Environment.NewLine, send.Issues)}", "Telegram Error");
return false;
} else {
Notification.ShowSuccess("Telegram message sent");
return true;
}
}
[RelayCommand]
private static async Task<bool> MQTTTest(object arg) {
var send = new SendToMqtt.SendToMqtt() {
Topic = "Test Topic",
Payload = "Test Payload",
Attempts = 1
};
await send.Run(default, default);
if (send.Status == SequenceEntityStatus.FAILED) {
Notification.ShowExternalError($"Failed to send message to MQTT:{Environment.NewLine}{string.Join(Environment.NewLine, send.Issues)}", "MQTT Error");
return false;
} else {
Notification.ShowSuccess("MQTT message sent");
return true;
}
}
[RelayCommand]
private static async Task<bool> IFTTTTest(object arg) {
var send = new SendToIftttWebhook.SendToIftttWebhook() {
Value1 = "Test Value1",
Value2 = "Test Value2",
Value3 = "Test Value3",
Attempts = 1
};
await send.Run(default, default);
if (send.Status == SequenceEntityStatus.FAILED) {
Notification.ShowExternalError($"Failed to send message to IFTTT:{Environment.NewLine}{string.Join(Environment.NewLine, send.Issues)}", "IFTTT Error");
return false;
} else {
Notification.ShowSuccess("IFTTT message sent");
return true;
}
}
[RelayCommand]
private async Task<bool> TtsTest(object arg) {
var send = new SendToTTS() {
Message = TtsTestMessage,
Attempts = 1
};
await send.Run(default, default);
if (send.Status == SequenceEntityStatus.FAILED) {
Notification.ShowExternalError($"Failed to send message to TTS:{Environment.NewLine}{string.Join(Environment.NewLine, send.Issues)}", "TTS Error");
return false;
}
return true;
}
private Task LwtStartWorker() {
return Task.Run(async () => {
Logger.Info($"Starting MQTT LWT service. Sending to topic {MqttLwtTopic}");
mqttClient = new MqttClient() {
Payload = Utilities.Utilities.ResolveTokens(MqttLwtBirthPayload),
LastWillTopic = MqttLwtTopic,
LastWillPayload = Utilities.Utilities.ResolveTokens(MqttLwtLastWillPayload),
Qos = MqttDefaultFailureQoSLevel,
};
var clientOpts = mqttClient.Prepare();
await mqttClient.Connect(clientOpts, CancellationToken.None);
await mqttClient.Publish(CancellationToken.None);
Logger.Debug("Exiting LwtStartWorker task");
});
}
private async Task LwtStopWorker() {
Logger.Debug("Stopping LWT worker");
mqttClient.Payload = Utilities.Utilities.ResolveTokens(MqttLwtClosePayload);
await mqttClient.Publish(CancellationToken.None);
await mqttClient.Disconnect(CancellationToken.None);
return;
}
public string IFTTTWebhookKey {
get => Security.Decrypt(Properties.Settings.Default.IFTTTWebhookKey);
set {
Properties.Settings.Default.IFTTTWebhookKey = Security.Encrypt(value.Trim());
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public string IftttFailureValue1 {
get => Properties.Settings.Default.IftttFailureValue1;
set {
Properties.Settings.Default.IftttFailureValue1 = value;
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public string IftttFailureValue2 {
get => Properties.Settings.Default.IftttFailureValue2;
set {
Properties.Settings.Default.IftttFailureValue2 = value;
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public string IftttFailureValue3 {
get => Properties.Settings.Default.IftttFailureValue3;
set {
Properties.Settings.Default.IftttFailureValue3 = value;
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public string PushoverAppKey {
get => Security.Decrypt(Properties.Settings.Default.PushoverAppKey);
set {
Properties.Settings.Default.PushoverAppKey = Security.Encrypt(value.Trim());
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public string PushoverUserKey {
get => Security.Decrypt(Properties.Settings.Default.PushoverUserKey);
set {
Properties.Settings.Default.PushoverUserKey = Security.Encrypt(value.Trim());
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public static Priority[] PushoverPriorities => Enum.GetValues(typeof(Priority)).Cast<Priority>().ToArray();
public static NotificationSound[] PushoverNotificationSounds => Enum.GetValues(typeof(NotificationSound)).Cast<NotificationSound>().Where(p => p != NotificationSound.NotSet).ToArray();
public NotificationSound PushoverDefaultNotificationSound {
get => Enum.Parse<NotificationSound>(Properties.Settings.Default.PushoverDefaultNotificationSound);
set {
Properties.Settings.Default.PushoverDefaultNotificationSound = value.ToString();
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public Priority PushoverDefaultNotificationPriority {
get => Enum.Parse<Priority>(Properties.Settings.Default.PushoverDefaultNotificationPriority);
set {
Properties.Settings.Default.PushoverDefaultNotificationPriority = value.ToString();
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public NotificationSound PushoverDefaultFailureSound {
get => Enum.Parse<NotificationSound>(Properties.Settings.Default.PushoverDefaultFailureSound);
set {
Properties.Settings.Default.PushoverDefaultFailureSound = value.ToString();
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public Priority PushoverDefaultFailurePriority {
get => Enum.Parse<Priority>(Properties.Settings.Default.PushoverDefaultFailurePriority);
set {
Properties.Settings.Default.PushoverDefaultFailurePriority = value.ToString();
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public int PushoverEmergRetryInterval {
get => Properties.Settings.Default.PushoverEmergRetryInterval;
set {
if (value >= 30 && value <= 86400) {
Properties.Settings.Default.PushoverEmergRetryInterval = value;
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
} else {
RaisePropertyChanged();
}
}
}
public int PushoverEmergExpireAfter {
get => Properties.Settings.Default.PushoverEmergExpireAfter;
set {
if (value >= 30 && value <= 86400) {
Properties.Settings.Default.PushoverEmergExpireAfter = value;
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
} else {
RaisePropertyChanged();
}
}
}
public string PushoverFailureTitleText {
get => Properties.Settings.Default.PushoverFailureTitleText;
set {
Properties.Settings.Default.PushoverFailureTitleText = value;
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public string PushoverFailureBodyText {
get => Properties.Settings.Default.PushoverFailureBodyText;
set {
Properties.Settings.Default.PushoverFailureBodyText = value;
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public string SmtpFromAddress {
get => Properties.Settings.Default.SmtpFromAddress;
set {
Properties.Settings.Default.SmtpFromAddress = value.Trim();
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public string SmtpDefaultRecipients {
get => Properties.Settings.Default.SmtpDefaultRecipients;
set {
Properties.Settings.Default.SmtpDefaultRecipients = value.Trim();
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public string SmtpHostName {
get => Properties.Settings.Default.SmtpHostName;
set {
Properties.Settings.Default.SmtpHostName = value.Trim();
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public ushort SmtpHostPort {
get => Properties.Settings.Default.SmtpHostPort;
set {
Properties.Settings.Default.SmtpHostPort = value;
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public string SmtpUsername {
get => Security.Decrypt(Properties.Settings.Default.SmtpUsername);
set {
Properties.Settings.Default.SmtpUsername = Security.Encrypt(value.Trim());
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public string SmtpPassword {
get => Security.Decrypt(Properties.Settings.Default.SmtpPassword);
set {
Properties.Settings.Default.SmtpPassword = Security.Encrypt(value.Trim());
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public string EmailFailureSubjectText {
get => Properties.Settings.Default.EmailFailureSubjectText;
set {
Properties.Settings.Default.EmailFailureSubjectText = value;
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public string EmailFailureBodyText {
get => Properties.Settings.Default.EmailFailureBodyText;
set {
Properties.Settings.Default.EmailFailureBodyText = value;
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public string TelegramAccessToken {
get => Security.Decrypt(Properties.Settings.Default.TelegramAccessToken);
set {
Properties.Settings.Default.TelegramAccessToken = Security.Encrypt(value.Trim());
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public string TelegramChatId {
get => Security.Decrypt(Properties.Settings.Default.TelegramChatId);
set {
Properties.Settings.Default.TelegramChatId = Security.Encrypt(value.Trim());
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public string TelegramFailureBodyText {
get => Properties.Settings.Default.TelegramFailureBodyText;
set {
Properties.Settings.Default.TelegramFailureBodyText = value;
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public string MqttBrokerHost {
get => Properties.Settings.Default.MqttBrokerHost;
set {
Properties.Settings.Default.MqttBrokerHost = value.Trim();
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public ushort MqttBrokerPort {
get => Properties.Settings.Default.MqttBrokerPort;
set {
Properties.Settings.Default.MqttBrokerPort = value;
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public int MqttDefaultQoSLevel {
get => Properties.Settings.Default.MqttDefaultQoSLevel;
set {
Properties.Settings.Default.MqttDefaultQoSLevel = value;
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public int MqttDefaultFailureQoSLevel {
get => Properties.Settings.Default.MqttDefaultFailureQoSLevel;
set {
Properties.Settings.Default.MqttDefaultFailureQoSLevel = value;
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public string MqttDefaultTopic {
get => Properties.Settings.Default.MqttDefaultTopic;
set {
Properties.Settings.Default.MqttDefaultTopic = value.Trim();
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public string MqttClientId {
get => Properties.Settings.Default.MqttClientId;
set {
Properties.Settings.Default.MqttClientId = value.Trim();
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public bool MqttBrokerUseTls {
get => Properties.Settings.Default.MqttBrokerUseTls;
set {
Properties.Settings.Default.MqttBrokerUseTls = value;
CoreUtil.SaveSettings(Properties.Settings.Default);
MqttBrokerPort = value ? (ushort)8883 : (ushort)1883;
RaisePropertyChanged();
}
}
public string MqttUsername {
get => Security.Decrypt(Properties.Settings.Default.MqttUsername);
set {
Properties.Settings.Default.MqttUsername = Security.Encrypt(value.Trim());
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public string MqttPassword {
get => Security.Decrypt(Properties.Settings.Default.MqttPassword);
set {
Properties.Settings.Default.MqttPassword = Security.Encrypt(value.Trim());
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public int MqttMaxReconnectAttempts {
get => Properties.Settings.Default.MqttMaxReconnectAttempts;
set {
Properties.Settings.Default.MqttMaxReconnectAttempts = value;
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public bool MqttLwtEnable {
get => Properties.Settings.Default.MqttLwtEnable;
set {
Properties.Settings.Default.MqttLwtEnable = value;
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
if (!mqttClient.IsConnected && value == true) {
LwtStartWorker();
} else if (mqttClient.IsConnected && value == false) {
LwtStopWorker();
}
}
}
public string MqttLwtTopic {
get {
if (string.IsNullOrEmpty(Properties.Settings.Default.MqttLwtTopic)) {
Properties.Settings.Default.MqttLwtTopic = Properties.Settings.Default.MqttDefaultTopic;
}
return Properties.Settings.Default.MqttLwtTopic;
}
set {
Properties.Settings.Default.MqttLwtTopic = value;
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public string MqttLwtBirthPayload {
get => Properties.Settings.Default.MqttLwtBirthPayload;
set {
Properties.Settings.Default.MqttLwtBirthPayload = value;
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public string MqttLwtLastWillPayload {
get => Properties.Settings.Default.MqttLwtLastWillPayload;
set {
Properties.Settings.Default.MqttLwtLastWillPayload = value;
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public string MqttLwtClosePayload {
get => Properties.Settings.Default.MqttLwtClosePayload;
set {
Properties.Settings.Default.MqttLwtClosePayload = value;
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public string TtsTestMessage { get; set; } = "It's full of stars!";
public string TTSFailureMessage {
get => Properties.Settings.Default.TTSFailureMessage;
set {
Properties.Settings.Default.TTSFailureMessage = value;
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public string PlaySoundDefaultFile {
get => Properties.Settings.Default.PlaySoundDefaultFile;
set {
Properties.Settings.Default.PlaySoundDefaultFile = value;
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public string PlaySoundDefaultFailureFile {
get => Properties.Settings.Default.PlaySoundDefaultFailureFile;
set {
Properties.Settings.Default.PlaySoundDefaultFailureFile = value;
CoreUtil.SaveSettings(Properties.Settings.Default);
RaisePropertyChanged();
}
}
public static IList<string> QoSLevels => MqttCommon.QoSLevels;
public static string TokenDate => DateTime.Now.ToString("d");
public static string TokenTime => DateTime.Now.ToString("T");
public static string TokenDateTime => DateTime.Now.ToString("G");
public static string TokenDateUtc => DateTime.UtcNow.ToString("d");
public static string TokenTimeUtc => DateTime.UtcNow.ToString("T");
public static string TokenDateTimeUtc => DateTime.UtcNow.ToString("G");
public static string TokenUnixEpoch => Utilities.Utilities.UnixEpoch().ToString();
public void SetSmtpPassword(SecureString s) {
SmtpPassword = SecureStringToString(s);
}
public void SetMqttPassword(SecureString s) {
MqttPassword = SecureStringToString(s);
}
private static string SecureStringToString(SecureString value) {
IntPtr valuePtr = IntPtr.Zero;
try {
valuePtr = Marshal.SecureStringToGlobalAllocUnicode(value);
return Marshal.PtrToStringUni(valuePtr);
} finally {
Marshal.ZeroFreeGlobalAllocUnicode(valuePtr);
}
}
public static string GetVersion() {
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
System.Diagnostics.FileVersionInfo fvi = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location);
return fvi.FileVersion;
}
public event PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged([CallerMemberName] string propertyName = null) {
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
[RelayCommand]
internal void OpenSelectDefaultSoundFileDialog(object obj) {
Microsoft.Win32.OpenFileDialog dialog = new() {
FileName = string.Empty,
Filter = PlaySound.PlaySoundCommon.FileTypeFilter,
};
if (dialog.ShowDialog() == true) {
PlaySoundDefaultFile = dialog.FileName;
}
}
[RelayCommand]
internal void OpenSelectDefaultFailureSoundFileDialog(object obj) {
Microsoft.Win32.OpenFileDialog dialog = new() {
FileName = string.Empty,
Filter = PlaySound.PlaySoundCommon.FileTypeFilter,
};
if (dialog.ShowDialog() == true) {
PlaySoundDefaultFailureFile = dialog.FileName;
}
}
}
}