public GpuProfileSet(INTMinerRoot root) { VirtualRoot.Window <AddOrUpdateGpuProfileCommand>("处理添加或更新Gpu超频数据命令", LogEnum.DevConsole, action: message => { GpuProfileData data = _data.GpuProfiles.FirstOrDefault(a => a.CoinId == message.Input.CoinId && a.Index == message.Input.Index); if (data != null) { data.Update(message.Input); Save(); } else { data = new GpuProfileData(message.Input); _data.GpuProfiles.Add(data); Save(); } VirtualRoot.Happened(new GpuProfileAddedOrUpdatedEvent(data)); }); VirtualRoot.Window <CoinOverClockCommand>("处理币种超频命令", LogEnum.DevConsole, action: message => { Task.Factory.StartNew(() => { CoinOverClock(root, message.CoinId); VirtualRoot.Happened(new CoinOverClockDoneEvent(message.Id)); }); }); }
public GpuProfileSet(INTMinerContext ntminerContext) { VirtualRoot.BuildCmdPath <AddOrUpdateGpuProfileCommand>(path: message => { GpuProfileData data = _data.GpuProfiles.FirstOrDefault(a => a.CoinId == message.Input.CoinId && a.Index == message.Input.Index); if (data != null) { data.Update(message.Input); Save(); } else { data = new GpuProfileData().Update(message.Input); _data.GpuProfiles.Add(data); Save(); } VirtualRoot.RaiseEvent(new GpuProfileAddedOrUpdatedEvent(message.MessageId, data)); }, location: this.GetType()); // 注意:这个命令处理程序不能放在展示层注册。修复通过群控超频不生效的BUG:这是一个难以发现的老BUG,以前的版本也存 // 在这个BUG,BUG具体表现是当没有点击过挖矿端主界面上的算力Tab页时通过群控超频无效。感谢矿友发现问题,已经修复。 VirtualRoot.BuildCmdPath <CoinOverClockCommand>(path: message => { Task.Factory.StartNew(() => { CoinOverClock(ntminerContext, message.CoinId); VirtualRoot.RaiseEvent(new CoinOverClockDoneEvent(targetPathId: message.MessageId)); }); }, location: this.GetType()); }
public void Register(INTMinerRoot root) { VirtualRoot.Window <AddOrUpdateGpuProfileCommand>("处理添加或更新Gpu超频数据命令", LogEnum.DevConsole, action: message => { GpuProfileData data = _data.GpuProfiles.FirstOrDefault(a => a.CoinId == message.Input.CoinId && a.Index == message.Input.Index); if (data != null) { data.Update(message.Input); Save(); } else { data = new GpuProfileData(message.Input); _data.GpuProfiles.Add(data); Save(); } VirtualRoot.Happened(new GpuProfileAddedOrUpdatedEvent(data)); }); VirtualRoot.Window <OverClockCommand>("处理超频命令", LogEnum.DevConsole, action: message => { if (root.GpuSet.TryGetGpu(message.Input.Index, out IGpu gpu)) { message.Input.OverClock(gpu.OverClock); } }); VirtualRoot.Window <CoinOverClockCommand>("处理币种超频命令", LogEnum.DevConsole, action: message => { if (IsOverClockGpuAll(message.CoinId)) { GpuProfileData overClockData = _data.GpuProfiles.FirstOrDefault(a => a.CoinId == message.CoinId && a.Index == NTMinerRoot.GpuAllId); if (overClockData != null) { VirtualRoot.Execute(new OverClockCommand(overClockData)); } } else { foreach (var overClockData in _data.GpuProfiles.Where(a => a.CoinId == message.CoinId)) { if (overClockData.Index != NTMinerRoot.GpuAllId) { VirtualRoot.Execute(new OverClockCommand(overClockData)); } } } }); }
public GpuProfileSet(INTMinerContext root) { VirtualRoot.AddCmdPath <AddOrUpdateGpuProfileCommand>(action: message => { GpuProfileData data = _data.GpuProfiles.FirstOrDefault(a => a.CoinId == message.Input.CoinId && a.Index == message.Input.Index); if (data != null) { data.Update(message.Input); Save(); } else { data = new GpuProfileData().Update(message.Input); _data.GpuProfiles.Add(data); Save(); } VirtualRoot.RaiseEvent(new GpuProfileAddedOrUpdatedEvent(message.MessageId, data)); }, location: this.GetType()); VirtualRoot.AddCmdPath <CoinOverClockCommand>(action: message => { Task.Factory.StartNew(() => { CoinOverClock(root, message.CoinId); VirtualRoot.RaiseEvent(new CoinOverClockDoneEvent(targetPathId: message.MessageId)); }); }, location: this.GetType()); }