private void Check() { ISystemBlockHandler handler = new SystemBlockHandler(); IList <SystemComponentBase> components = view.GetSelectedComponents(); foreach (SystemComponentBase component in components) { if (!handler.CanAddOneMore(component)) { view.ShowErrorMessage("Error", "Unable to add " + component.Title); return; } else { handler.AddComponent(component); } } if (handler.IsWorking()) { view.ShowSuccessMessage("Success", "System Block was successfully collected! The price is: " + handler.Price + "$"); } else { view.ShowErrorMessage("Error", "Unfortunatelly, system block can not be collected"); } }
private ISystemBlockHandler CollectSystemBlock() { ISystemBlockHandler systemBlock = new SystemBlockHandler(); systemBlock.AddComponent(dataReader.GetMotherboard()); systemBlock.AddComponent(dataReader.GetMemoryCard()); systemBlock.AddComponent(dataReader.GetProcessor()); systemBlock.AddComponent(dataReader.GetPowerSupply()); systemBlock.AddComponent(dataReader.GetSystemBlockHull()); return(systemBlock); }