using System.Windows.Forms; using HeuristicLab.Clients.Hive.CloudManager.Model; using HeuristicLab.Core.Views; using HeuristicLab.MainForm; namespace HeuristicLab.Clients.Hive.CloudManager.Views { [View("SubscriptionView")] [Content(typeof(Subscription), IsDefaultView = true)] public partial class SubscriptionView : ItemView { public new Subscription Content { get { return (Subscription)base.Content; } set { base.Content = value; } } public SubscriptionView() { InitializeComponent(); } protected override void DeregisterContentEvents() { base.DeregisterContentEvents(); } protected override void RegisterContentEvents() { base.RegisterContentEvents(); } protected override void OnContentChanged() { base.OnContentChanged(); if (Content == null) { txtSubscriptionId.Clear(); txtSubscriptionName.Clear(); txtCertThumbprint.Clear(); lblQuotaCores.Text = "-"; lblQuotaHostedServices.Text = "-"; cbDiscoverServices.Checked = false; cbSaveSubscription.Checked = false; } else { Subscription sub = (Subscription)Content; txtSubscriptionId.Text = sub.SubscriptionID; txtSubscriptionName.Text = sub.SubscriptionName; txtCertThumbprint.Text = sub.CertificateThumbprint; lblQuotaCores.Text = string.Format("{0} / {1}", sub.CurrentCoreCount, sub.MaxCoreCount); lblQuotaHostedServices.Text = string.Format("{0} / {1}", sub.CurrentHostedServices, sub.MaxHostedServices); cbDiscoverServices.Checked = sub.DiscoverServices; cbSaveSubscription.Checked = sub.SaveToConfig; } } protected override void SetEnabledStateOfControls() { base.SetEnabledStateOfControls(); } private void cbSaveSubscription_CheckedChanged(object sender, System.EventArgs e) { if (Content != null) { Content.SaveToConfig = cbSaveSubscription.Checked; } } private void cbDiscoverServices_CheckedChanged(object sender, System.EventArgs e) { if (Content != null) { Content.DiscoverServices = cbDiscoverServices.Checked; } } } }