public MainForm(IEc2Caller ec2Caller, ISqsCaller sqsCaller, WorkerCaller workerCaller) { this.ec2Caller = ec2Caller; this.sqsCaller = sqsCaller; this.workerCaller = workerCaller; InitializeComponent(); Action<AwsRegionControl, AwsRegionLocations> setupRegions = (control, region) => { control.RegionLocation = region; controlRegionDictionary.Add(region, control); }; setupRegions(UsEastRegion, AwsRegionLocations.UsEast); setupRegions(UsWest1Region, AwsRegionLocations.UsWest1); setupRegions(UsWest2Region, AwsRegionLocations.UsWest2); setupRegions(SaEastRegion, AwsRegionLocations.SaEast); setupRegions(EuWestRegion, AwsRegionLocations.EuWest); setupRegions(AsiaNortheastRegion, AwsRegionLocations.ApNortheast); setupRegions(AsiaSoutheast1Region, AwsRegionLocations.ApSoutheast1); setupRegions(AsiaSoutheast2Region, AwsRegionLocations.ApSoutheast2); foreach (var control in controlRegionDictionary.Values) { control.RegionIdLabelClicked += (o, region) => ShowRegionDetails(region); control.AddInstanceButtonClicked += (o, region) => LaunchInstance(region); control.RemoveInstanceButtonClicked += (o, region) => TerminateInstance(region); } }
public MainForm(IEc2Caller ec2Caller, ISqsCaller sqsCaller, WorkerCaller workerCaller) { this.ec2Caller = ec2Caller; this.sqsCaller = sqsCaller; this.workerCaller = workerCaller; InitializeComponent(); Action <AwsRegionControl, AwsRegionLocations> setupRegions = (control, region) => { control.RegionLocation = region; controlRegionDictionary.Add(region, control); }; setupRegions(UsEastRegion, AwsRegionLocations.UsEast); setupRegions(UsWest1Region, AwsRegionLocations.UsWest1); setupRegions(UsWest2Region, AwsRegionLocations.UsWest2); setupRegions(SaEastRegion, AwsRegionLocations.SaEast); setupRegions(EuWestRegion, AwsRegionLocations.EuWest); setupRegions(AsiaNortheastRegion, AwsRegionLocations.ApNortheast); setupRegions(AsiaSoutheast1Region, AwsRegionLocations.ApSoutheast1); setupRegions(AsiaSoutheast2Region, AwsRegionLocations.ApSoutheast2); foreach (var control in controlRegionDictionary.Values) { control.RegionIdLabelClicked += (o, region) => ShowRegionDetails(region); control.AddInstanceButtonClicked += (o, region) => LaunchInstance(region); control.RemoveInstanceButtonClicked += (o, region) => TerminateInstance(region); } }