public async void testSaveToFile() { tokenSource = new CancellationTokenSource(); //Assert.DoesNotThrow(() => //{ //coll = await engine.BuildVolumesAsync(); devColl = await engine.BuildDevicesAsync(tokenSource.Token).ConfigureAwait(false);; //}); //string fileName = System.IO.Path.GetTempFileName(); string fileName = @"C:\Projects\Software\Tools\ReadRawDevice.Gui\ReadRawDevice.NUnit\bin\Debug\diskOutput.bin"; var device = devColl.Where(dev => { return((dev.DiskSize.HasValue) && (dev.FriendlyName.Equals("Alex EFI_TEST USB Device"))); }).First(); var progressIndicator = new Progress <double>(progress => { System.Diagnostics.Debug.WriteLine("Progress is: " + progress.ToString() + "%"); }); System.Diagnostics.Trace.WriteLine("Output file is: " + fileName); long bytesRead = await engine.ExtractDiskAsync(device, fileName, progressIndicator, tokenSource.Token); //tsk2.Wait(); System.Diagnostics.Debug.WriteLine("--- All done ---"); //engine.ExtractDiskAsync( }
protected void selectedDevice_OnDeviceSelected(long deviceId) { try { foreach (var device in DeviceCollection.Where(dev => dev.DeviceId != deviceId && dev.Selected)) { device.Selected = false; } } catch (Exception ex) { _ppsClientViewModel.WriteLogMessage(string.Concat("Не удалось изменить выбор устройства - ", ex.Message)); } }
public void allDevicesShouldHaveDiskSize() { tokenSource = new CancellationTokenSource(); Assert.DoesNotThrow(() => { var tsk = engine.BuildDevicesAsync(tokenSource.Token); tsk.Wait(); devColl = tsk.Result; }); devColl.AsParallel().ForAll(dev => { System.Diagnostics.Trace.WriteLine("Device " + dev.FriendlyName + " size is: " + (dev.DiskSize.HasValue == true ? dev.DiskSize.Value.ToString() : "<empty>")); }); var zz = devColl.Where(dev => !(dev.DiskSize.HasValue && dev.DiskSize.Value >= 0)); Assert.True(zz.Any() == false); }
private void SaveLoginDevices(object parameter) { try { if (SelectedLogin == null) { throw new Exception("Пользователь не выбран"); } using (var policySetService = _ppsClientViewModel.ServiceProxy.GetPpsChannelFactory <ILoginDevicesService>()) { var channel = policySetService.CreateChannel(); var result = channel.UpdateLoginDevices(SelectedLogin.LoginId, DeviceCollection.Where(x => x.Selected) .Select( x => new LoginDevicesDataContract { DeviceId = x.DeviceId, LoginId = SelectedLogin.LoginId, NeedUpdateDevice = true }) .ToArray()); GetLoginIdAndDeviceIdDct(); if (!result.BoolRes) { throw new Exception(result.ErrorRes); } _ppsClientViewModel.AddEvent(EventConstants.EVENT_ASSIGN_lOGIN_DEVICE, string.Concat("Для логина ", SelectedLogin.Login)); } } catch (Exception ex) { _ppsClientViewModel.WriteLogMessage(string.Concat("Не удалось сохранить устройства пользователя. ", ex.Message)); } }
public async void testSaveToFile() { tokenSource = new CancellationTokenSource(); //Assert.DoesNotThrow(() => //{ //coll = await engine.BuildVolumesAsync(); devColl = await engine.BuildDevicesAsync(tokenSource.Token).ConfigureAwait(false); ; //}); //string fileName = System.IO.Path.GetTempFileName(); string fileName = @"C:\Projects\Software\Tools\ReadRawDevice.Gui\ReadRawDevice.NUnit\bin\Debug\diskOutput.bin"; var device = devColl.Where(dev => { return (dev.DiskSize.HasValue) && (dev.FriendlyName.Equals("Alex EFI_TEST USB Device")); }).First(); var progressIndicator = new Progress<double>(progress => { System.Diagnostics.Debug.WriteLine("Progress is: " + progress.ToString() + "%"); }); System.Diagnostics.Trace.WriteLine("Output file is: " + fileName); long bytesRead = await engine.ExtractDiskAsync(device, fileName, progressIndicator, tokenSource.Token); //tsk2.Wait(); System.Diagnostics.Debug.WriteLine("--- All done ---"); //engine.ExtractDiskAsync( }