コード例 #1
0
ファイル: MainModel.cs プロジェクト: modulexcite/ec2manager
        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();
        }
コード例 #2
0
ファイル: Ec2Instance.cs プロジェクト: modulexcite/ec2manager
        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();
        }
コード例 #3
0
        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();
        }
コード例 #4
0
        public ReconnectDetailsViewModel(Config config)
        {
            this.DisplayName = "Browse for key";

            this.config = config;
        }
コード例 #5
0
 public Ec2Connection(ILogger logger, Config config)
 {
     this.Logger = logger;
     this.config = config;
 }
コード例 #6
0
 public Ec2Connection(Config config) : this(new StubLogger(), config)
 {
 }
コード例 #7
0
ファイル: Ec2Instance.cs プロジェクト: modulexcite/ec2manager
        //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();
        }
コード例 #8
0
 public SettingsViewModel(Config config)
 {
     this.DisplayName = "Settings";
     this.config = config;
 }