1 | using System.Windows.Forms;
|
---|
2 | using HeuristicLab.Clients.Hive.CloudManager.Model;
|
---|
3 | using HeuristicLab.Core.Views;
|
---|
4 | using HeuristicLab.MainForm;
|
---|
5 |
|
---|
6 | namespace HeuristicLab.Clients.Hive.CloudManager.Views {
|
---|
7 | [View("SubscriptionView")]
|
---|
8 | [Content(typeof(Subscription), IsDefaultView = true)]
|
---|
9 | public partial class SubscriptionView : ItemView {
|
---|
10 | public new Subscription Content {
|
---|
11 | get { return (Subscription)base.Content; }
|
---|
12 | set { base.Content = value; }
|
---|
13 | }
|
---|
14 |
|
---|
15 | public SubscriptionView() {
|
---|
16 | InitializeComponent();
|
---|
17 | }
|
---|
18 |
|
---|
19 | protected override void DeregisterContentEvents() {
|
---|
20 | base.DeregisterContentEvents();
|
---|
21 | }
|
---|
22 | protected override void RegisterContentEvents() {
|
---|
23 | base.RegisterContentEvents();
|
---|
24 | }
|
---|
25 |
|
---|
26 | protected override void OnContentChanged() {
|
---|
27 | base.OnContentChanged();
|
---|
28 | if (Content == null) {
|
---|
29 | txtSubscriptionId.Clear();
|
---|
30 | txtSubscriptionName.Clear();
|
---|
31 | txtCertThumbprint.Clear();
|
---|
32 | lblQuotaCores.Text = "-";
|
---|
33 | lblQuotaHostedServices.Text = "-";
|
---|
34 | cbDiscoverServices.Checked = false;
|
---|
35 | cbSaveSubscription.Checked = false;
|
---|
36 | } else {
|
---|
37 | Subscription sub = (Subscription)Content;
|
---|
38 | txtSubscriptionId.Text = sub.SubscriptionID;
|
---|
39 | txtSubscriptionName.Text = sub.SubscriptionName;
|
---|
40 | txtCertThumbprint.Text = sub.CertificateThumbprint;
|
---|
41 | lblQuotaCores.Text = string.Format("{0} / {1}", sub.CurrentCoreCount, sub.MaxCoreCount);
|
---|
42 | lblQuotaHostedServices.Text = string.Format("{0} / {1}", sub.CurrentHostedServices, sub.MaxHostedServices);
|
---|
43 | cbDiscoverServices.Checked = sub.DiscoverServices;
|
---|
44 | cbSaveSubscription.Checked = sub.SaveToConfig;
|
---|
45 | }
|
---|
46 | }
|
---|
47 |
|
---|
48 | protected override void SetEnabledStateOfControls() {
|
---|
49 | base.SetEnabledStateOfControls();
|
---|
50 | }
|
---|
51 |
|
---|
52 | private void cbSaveSubscription_CheckedChanged(object sender, System.EventArgs e) {
|
---|
53 | if (Content != null) {
|
---|
54 | Content.SaveToConfig = cbSaveSubscription.Checked;
|
---|
55 | }
|
---|
56 | }
|
---|
57 |
|
---|
58 | private void cbDiscoverServices_CheckedChanged(object sender, System.EventArgs e) {
|
---|
59 | if (Content != null) {
|
---|
60 | Content.DiscoverServices = cbDiscoverServices.Checked;
|
---|
61 | }
|
---|
62 | }
|
---|
63 |
|
---|
64 |
|
---|
65 | }
|
---|
66 | }
|
---|