public MainModel(Config config, Ec2Connection connection) { this.Config = config; this.Connection = connection; this.Config.MainConfig.Bind(s => s.AwsAccessKey, (o, e) => this.ReconnectConnection()); this.Config.MainConfig.Bind(s => s.AwsSecretKey, (o, e) => this.ReconnectConnection()); this.ReconnectConnection(); }
public Ec2Instance(AmazonEC2Client client, Config config, string name, InstanceSpecification specification) { this.Client = client; this.config = config; this.Name = name; this.Specification = specification; this.uniqueKey = Guid.NewGuid().ToString(); this.state = CreationState.DoesntExist; this.Logger = new StubLogger(); }
public ConnectViewModel(MainModel model, IEventAggregator events) { this.config = model.Config; this.connection = model.Connection; this.events = events; this.config.Bind(s => s.MainConfig, (o, e) => { this.LoadFromConfig(); }); this.connection.Bind(s => s.IsConnected, (o, e) => { this.RefreshRunningInstances(); this.NotifyOfPropertyChange(() => CanRefreshRunningInstances); this.NotifyOfPropertyChange(() => CanCreate); this.NotifyOfPropertyChange(() => CanReconnectInstance); this.NotifyOfPropertyChange(() => CanTerminateInstance); var spotPriceTask = this.RefreshCurrentSpotPriceAsync(); }); this.Bind(s => s.ActiveInstanceType, (o, e) => Task.Run(() => this.RefreshCurrentSpotPriceAsync())); this.DisplayName = "Create New Instance"; this.LoadFromConfig(); this.ActiveInstanceType = this.InstanceTypes.FirstOrDefault(x => x.Key == "t1.micro"); this.ActiveRunningInstance = this.RunningInstances[0]; this.RefreshRunningInstances(); var spotPriceTaskMain = this.RefreshCurrentSpotPriceAsync(); }
public ReconnectDetailsViewModel(Config config) { this.DisplayName = "Browse for key"; this.config = config; }
public Ec2Connection(ILogger logger, Config config) { this.Logger = logger; this.config = config; }
public Ec2Connection(Config config) : this(new StubLogger(), config) { }
//public Ec2Instance(AmazonEC2Client client, string instanceId) //{ // this.Client = client; // this.InstanceId = instanceId; // // TODO: Get name from tag (and other specification stuff) // this.Name = "TODO"; // this.state = CreationState.CreatedNotSetup; // this.Logger = new StubLogger(); //} public Ec2Instance(AmazonEC2Client client, Config config, Instance runningInstance) { this.Client = client; this.config = config; this.InstanceId = runningInstance.InstanceId; this.Reconnect(runningInstance); this.state = CreationState.IsSetup; this.Logger = new StubLogger(); }
public SettingsViewModel(Config config) { this.DisplayName = "Settings"; this.config = config; }