private void MainWindowLoaded(object sender, EventArgs e) { if (File.Exists("hwid.txt")) { var hwid = ReadHwidFromFile(); Label1.Content = "установленный идентификатор:" + hwid; Button1.IsEnabled = false; CreateCancelToken(); _ = CompareSavedDeviceHwID(hwid); var pt = PeriodicTask.Run(CompareSavedDeviceHwID_, new TimeSpan(0, 0, 5), token, hwid); } }
private void ButtonSet(object sender, RoutedEventArgs e) { var selected = (String)ListBox.SelectedItem; if (selected != null) { MessageBox.Show("usb hw id установлен"); Label1.Content = "установленный идентификатор:" + selected; CreateCancelToken(); Button1.IsEnabled = false; WriteHwidFromFile(selected); var pt = PeriodicTask.Run(CompareSavedDeviceHwID_, new TimeSpan(0, 0, 5), token, selected); } }