internal override void commandImplementation() { uint sledId = 1; BladePowerReadingResponse myResponse = new BladePowerReadingResponse(); GetAllBladesPowerReadingResponse myResponses = new GetAllBladesPowerReadingResponse(); try { if (this.argVal.ContainsKey('a')) { myResponses = WcsCli2CmConnectionManager.channel.GetAllBladesPowerReading(); } else if (this.argVal.ContainsKey('i')) { dynamic mySledId = null; this.argVal.TryGetValue('i', out mySledId); sledId = (uint)mySledId; myResponse = WcsCli2CmConnectionManager.channel.GetBladePowerReading((int)mySledId); } } catch (Exception ex) { SharedFunc.ExceptionOutput(ex); return; } if ((this.argVal.ContainsKey('a') && myResponses == null) || myResponse == null) { Console.WriteLine(WcsCliConstants.serviceResponseEmpty); return; } if (this.argVal.ContainsKey('a')) { for (int index = 0; index < myResponses.bladePowerReadingCollection.Count(); index++) { if (ResponseValidation.ValidateBladeResponse(myResponses.bladePowerReadingCollection[index].bladeNumber, null, myResponses.bladePowerReadingCollection[index], false)) { Console.WriteLine(WcsCliConstants.commandSuccess + "Blade " + myResponses.bladePowerReadingCollection[index].bladeNumber + ": Power Reading: " + myResponses.bladePowerReadingCollection[index].powerReading + " Watts"); } } } else { if (ResponseValidation.ValidateBladeResponse(myResponse.bladeNumber, null, myResponse, false)) { Console.WriteLine(WcsCliConstants.commandSuccess + "Blade " + myResponse.bladeNumber + ": Power Reading: " + myResponse.powerReading + " Watts"); } } }
internal override void commandImplementation() { uint sledId = 1; BladePowerReadingResponse myResponse = new BladePowerReadingResponse(); GetAllBladesPowerReadingResponse myResponses = new GetAllBladesPowerReadingResponse(); try { if (this.argVal.ContainsKey('a')) { myResponses = WcsCli2CmConnectionManager.channel.GetAllBladesPowerReading(); } else if (this.argVal.ContainsKey('i')) { dynamic mySledId = null; this.argVal.TryGetValue('i', out mySledId); sledId = (uint)mySledId; myResponse = WcsCli2CmConnectionManager.channel.GetBladePowerReading((int)mySledId); } } catch (Exception ex) { SharedFunc.ExceptionOutput(ex); return; } if ((this.argVal.ContainsKey('a') && myResponses == null) || myResponse == null) { Console.WriteLine(WcsCliConstants.serviceResponseEmpty); return; } if (this.argVal.ContainsKey('a')) { for (int index = 0; index < myResponses.bladePowerReadingCollection.Count(); index++) { if (myResponses.bladePowerReadingCollection[index].completionCode == Contracts.CompletionCode.Success) { Console.WriteLine("Blade Power Reading" + myResponses.bladePowerReadingCollection[index].bladeNumber + ": " + myResponses.bladePowerReadingCollection[index].powerReading + " Watts"); } else if (myResponses.bladePowerReadingCollection[index].completionCode == Contracts.CompletionCode.Unknown) { Console.WriteLine("Blade " + myResponses.bladePowerReadingCollection[index].bladeNumber + ": " + WcsCliConstants.bladeStateUnknown); } else { // Display error if other than success/unknown Console.WriteLine("Blade Power Reading for blade " + myResponses.bladePowerReadingCollection[index].bladeNumber + " failed with completion code: " + myResponses.bladePowerReadingCollection[index].completionCode.ToString()); } } } else { if (myResponse.completionCode == Contracts.CompletionCode.Success) { Console.WriteLine("Blade Power Reading" + myResponse.bladeNumber + ": " + myResponse.powerReading + " Watts"); } else if (myResponse.completionCode == Contracts.CompletionCode.Unknown) { Console.WriteLine("Blade " + myResponse.bladeNumber + ": " + WcsCliConstants.bladeStateUnknown); } else { // Display error if other than success/unknown Console.WriteLine("Blade Power Reading " + myResponse.bladeNumber + ": " + myResponse.completionCode.ToString()); } } }