Пример #1
0
 public void Assign(DeviceDescriptor source)
 {
     this.Kind = source.Kind;
     this.RelativeIndex = source.RelativeIndex;
     this.Driver = source.Driver;
     this.Path = source.Path;
     this.Serial = source.Serial;
 }
Пример #2
0
 private static List<DeviceDescriptor> CloneDescriptors(IEnumerable<DeviceDescriptor> devices)
 {
     List<DeviceDescriptor>  descriptors = new List<DeviceDescriptor>();
     foreach (DeviceDescriptor device in devices)
     {
         DeviceDescriptor descriptor = new DeviceDescriptor();
         ObjectCopier.CopyObject(device, descriptor);
         descriptors.Add(descriptor);
     }
     return descriptors;
 }
Пример #3
0
        private void deviceListView_ItemChecked(object sender, ItemCheckedEventArgs e)
        {
            if (this.updatingListView)
                return;

            bool enabled = e.Item.Checked;
            List<DeviceDescriptor> descriptors = new List<DeviceDescriptor>();
            MainFormViewModel viewModel = GetViewModelToView();
            DeviceViewModel device = viewModel.Devices[e.Item.Index];
            DeviceDescriptor descriptor = new DeviceDescriptor();
            ObjectCopier.CopyObject(device, descriptor);
            descriptors.Add(descriptor);

            ToggleDevices(descriptors, enabled);
        }
Пример #4
0
        public DeviceViewModel ApplyDeviceInformationResponseModel(DeviceDescriptor deviceModel, DeviceInformationResponse deviceInformationResponseModel)
        {
            DeviceViewModel deviceViewModel = Devices.SingleOrDefault(d => d.Equals(deviceModel));
            if (deviceViewModel != null)
            {
                if ((deviceModel.Kind == DeviceKind.PXY) || (deviceModel.Kind == DeviceKind.NET))
                {
                    deviceViewModel.PoolIndex = deviceInformationResponseModel.PoolIndex;

                    //we will get multiple deviceInformationResponseModels for the same deviceModel in the case of a Stratum Proxy
                    //bfgminer will report back for each Proxy Worker, but we only show a single entry in the ViewModel that rolls
                    //up the stats for individual Proxy Workers
                    deviceViewModel.AverageHashrate += deviceInformationResponseModel.AverageHashrate;
                    deviceViewModel.CurrentHashrate += deviceInformationResponseModel.AverageHashrate;
                    deviceViewModel.AcceptedShares += deviceInformationResponseModel.AcceptedShares;
                    deviceViewModel.RejectedShares += deviceInformationResponseModel.RejectedShares;
                    deviceViewModel.HardwareErrors += deviceInformationResponseModel.HardwareErrors;
                    deviceViewModel.Utility += deviceInformationResponseModel.Utility;
                    deviceViewModel.WorkUtility += deviceInformationResponseModel.WorkUtility;
                    deviceViewModel.RejectedSharesPercent += deviceInformationResponseModel.RejectedSharesPercent;
                    deviceViewModel.HardwareErrorsPercent += deviceInformationResponseModel.HardwareErrorsPercent;

                    //now add as a worker
                    DeviceViewModel workerViewModel = new DeviceViewModel();
                    ObjectCopier.CopyObject(deviceInformationResponseModel, workerViewModel, "Name", "Kind");
                    deviceViewModel.Workers.Add(workerViewModel);
                }
                else
                {
                    ObjectCopier.CopyObject(deviceInformationResponseModel, deviceViewModel, "Name", "Kind");
                }
            }
            return deviceViewModel;
        }