//To do the calculation, get an implementor for the correct device type from the factory - Presumably the PC knows the device of interest, example "Device1" public void DoTheCalculationThing(string deviceType) { DeviceCalculationFactory factory = new DeviceCalculationFactory(); IDoCalculation calculation = factory.GetCalculationImplementationInstance(deviceType); int result = calculation.DoCalculation(); // now send the result to the device }
//To do the calculation, get an implementor for the correct device type from the factory public void DoTheCalculationThing() { DeviceCalculationFactory factory = new DeviceCalculationFactory(); IDoCalculation calculation = factory.GetCalculationImplementationInstance("Device1"); calculation.DoCalculation(); }