|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Domain
{
public class ProductionConfigurationState : ConfigurationState
{
public ProductionConfigurationState(ConfigurationState configurationState)
{
this.Device = configurationState.Device;
Initialize();
}
public ProductionConfigurationState(Device device)
{
this.Device = device;
Initialize();
}
private void Initialize()
{
Name = "Production";
// Here we want to setup the device under the
// production configuration and how it should
// behave. In this production configuration, we
// want the door to be in a closed state. To do
// this, we can either call the Close() method
// on the Door or we can manipulate the
// DoorState directly and instantiate an
// instance of the DoorClosedState.
this.Device.Door.Close();
}
public override void SetProductionConfiguration()
{
// We're in production configuration.
}
public override void SetTestConfiguration()
{
// We support switching to test
// configuration at run-time.
this.Device.Configuration = new TestConfigurationState(this);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Thomas Jaeger is a Solutions Architect and an industry expert for over 24 years in 10 different industries when it comes to software development in general, cloud-based computing, and iOS development. He is a passionate, fanatic, software designer and creator. He lives against the status quo because, in his opinion, creative and innovative solutions are not created following a linear approach but come, in part, from broad experiences in ones life and from an innovative mind.