Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7933


Ignore:
Timestamp:
05/30/12 16:37:17 (12 years ago)
Author:
ascheibe
Message:

#1648 improved client information view

Location:
branches/ClientUserManagement/HeuristicLab.Clients.Access.Views/3.3
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/ClientUserManagement/HeuristicLab.Clients.Access.Views/3.3/ClientViews/ClientInformationDialog.Designer.cs

    r7557 r7933  
    2424    /// </summary>
    2525    private void InitializeComponent() {
     26      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ClientInformationDialog));
    2627      this.clientView = new HeuristicLab.Clients.Access.Views.ClientView();
     28      this.refreshButton = new System.Windows.Forms.Button();
     29      this.okButton = new System.Windows.Forms.Button();
     30      this.registerClientButton = new System.Windows.Forms.Button();
     31      this.infoLabel = new System.Windows.Forms.Label();
    2732      this.SuspendLayout();
    2833      //
     
    3338      this.clientView.Caption = "Client View";
    3439      this.clientView.Content = null;
    35       this.clientView.Location = new System.Drawing.Point(12, 12);
     40      this.clientView.Location = new System.Drawing.Point(12, 42);
    3641      this.clientView.Name = "clientView";
    3742      this.clientView.ReadOnly = false;
    38       this.clientView.Size = new System.Drawing.Size(528, 452);
     43      this.clientView.Size = new System.Drawing.Size(653, 315);
    3944      this.clientView.TabIndex = 0;
     45      //
     46      // refreshButton
     47      //
     48      this.refreshButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Refresh;
     49      this.refreshButton.Location = new System.Drawing.Point(12, 12);
     50      this.refreshButton.Name = "refreshButton";
     51      this.refreshButton.Size = new System.Drawing.Size(24, 24);
     52      this.refreshButton.TabIndex = 1;
     53      this.refreshButton.UseVisualStyleBackColor = true;
     54      this.refreshButton.Click += new System.EventHandler(this.refreshButton_Click);
     55      //
     56      // okButton
     57      //
     58      this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     59      this.okButton.Location = new System.Drawing.Point(590, 363);
     60      this.okButton.Name = "okButton";
     61      this.okButton.Size = new System.Drawing.Size(75, 23);
     62      this.okButton.TabIndex = 2;
     63      this.okButton.Text = "OK";
     64      this.okButton.UseVisualStyleBackColor = true;
     65      this.okButton.Click += new System.EventHandler(this.okButton_Click);
     66      //
     67      // registerClientButton
     68      //
     69      this.registerClientButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     70      this.registerClientButton.Location = new System.Drawing.Point(13, 362);
     71      this.registerClientButton.Name = "registerClientButton";
     72      this.registerClientButton.Size = new System.Drawing.Size(84, 23);
     73      this.registerClientButton.TabIndex = 3;
     74      this.registerClientButton.Text = "Register client";
     75      this.registerClientButton.UseVisualStyleBackColor = true;
     76      this.registerClientButton.Visible = false;
     77      this.registerClientButton.Click += new System.EventHandler(this.registerClientButton_Click);
     78      //
     79      // infoLabel
     80      //
     81      this.infoLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     82      this.infoLabel.AutoSize = true;
     83      this.infoLabel.Location = new System.Drawing.Point(103, 367);
     84      this.infoLabel.Name = "infoLabel";
     85      this.infoLabel.Size = new System.Drawing.Size(434, 13);
     86      this.infoLabel.TabIndex = 4;
     87      this.infoLabel.Text = "Your client isn\'t registered yet. Click on the Register client button to use addi" +
     88          "tional services.";
     89      this.infoLabel.Visible = false;
    4090      //
    4191      // ClientInformationDialog
     
    4393      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    4494      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    45       this.ClientSize = new System.Drawing.Size(552, 345);
     95      this.ClientSize = new System.Drawing.Size(677, 398);
     96      this.Controls.Add(this.infoLabel);
     97      this.Controls.Add(this.registerClientButton);
     98      this.Controls.Add(this.okButton);
     99      this.Controls.Add(this.refreshButton);
    46100      this.Controls.Add(this.clientView);
    47101      this.MaximizeBox = false;
     
    54108      this.TopMost = true;
    55109      this.ResumeLayout(false);
     110      this.PerformLayout();
    56111
    57112    }
     
    60115
    61116    private ClientView clientView;
     117    private System.Windows.Forms.Button refreshButton;
     118    private System.Windows.Forms.Button okButton;
     119    private System.Windows.Forms.Button registerClientButton;
     120    private System.Windows.Forms.Label infoLabel;
    62121  }
    63122}
  • branches/ClientUserManagement/HeuristicLab.Clients.Access.Views/3.3/ClientViews/ClientInformationDialog.cs

    r7557 r7933  
    2020#endregion
    2121
     22using System;
     23using System.Threading.Tasks;
    2224using System.Windows.Forms;
    2325
     
    2830    }
    2931
    30     protected override void OnLoad(System.EventArgs e) {
    31       base.OnLoad(e);
     32    private void okButton_Click(object sender, System.EventArgs e) {
     33      Close();
     34    }
    3235
    33       clientView.Content = ClientInformation.Instance.ClientInfo;
     36    private void refreshButton_Click(object sender, System.EventArgs e) {
     37      Refresh();
     38    }
     39
     40    private void registerClientButton_Click(object sender, EventArgs e) {
     41      using (ClientRegistrationDialog regDialog = new ClientRegistrationDialog()) {
     42        regDialog.ShowDialog(this);
     43        Refresh();
     44      }
     45    }
     46
     47    private void Refresh() {
     48      clientView.StartProgressView();
     49      Task.Factory.StartNew(new Action(delegate {
     50        ClientInformation.Instance.Refresh();
     51        clientView.Content = ClientInformation.Instance.ClientInfo;
     52        clientView.FinishProgressView();
     53        EnableRegistration();
     54      }));
     55    }
     56
     57    private void EnableRegistration() {
     58      if (InvokeRequired) {
     59        Invoke(new Action(EnableRegistration));
     60      } else {
     61        registerClientButton.Visible = !ClientInformation.Instance.ClientExists;
     62        infoLabel.Visible = !ClientInformation.Instance.ClientExists;
     63      }
    3464    }
    3565  }
  • branches/ClientUserManagement/HeuristicLab.Clients.Access.Views/3.3/ClientViews/ClientView.Designer.cs

    r7557 r7933  
    155155      this.txtName.Location = new System.Drawing.Point(110, 3);
    156156      this.txtName.Name = "txtName";
     157      this.txtName.ReadOnly = true;
    157158      this.txtName.Size = new System.Drawing.Size(265, 20);
    158159      this.txtName.TabIndex = 12;
     
    164165      this.txtDescription.Location = new System.Drawing.Point(111, 29);
    165166      this.txtDescription.Name = "txtDescription";
     167      this.txtDescription.ReadOnly = true;
    166168      this.txtDescription.Size = new System.Drawing.Size(264, 20);
    167169      this.txtDescription.TabIndex = 13;
     
    173175      this.txtVersion.Location = new System.Drawing.Point(111, 55);
    174176      this.txtVersion.Name = "txtVersion";
     177      this.txtVersion.ReadOnly = true;
    175178      this.txtVersion.Size = new System.Drawing.Size(264, 20);
    176179      this.txtVersion.TabIndex = 14;
     
    182185      this.txtTimestamp.Location = new System.Drawing.Point(110, 107);
    183186      this.txtTimestamp.Name = "txtTimestamp";
     187      this.txtTimestamp.ReadOnly = true;
    184188      this.txtTimestamp.Size = new System.Drawing.Size(265, 20);
    185189      this.txtTimestamp.TabIndex = 15;
     
    191195      this.txtMemory.Location = new System.Drawing.Point(110, 81);
    192196      this.txtMemory.Name = "txtMemory";
     197      this.txtMemory.ReadOnly = true;
    193198      this.txtMemory.Size = new System.Drawing.Size(265, 20);
    194199      this.txtMemory.TabIndex = 16;
     
    200205      this.txtNumberOfCores.Location = new System.Drawing.Point(110, 133);
    201206      this.txtNumberOfCores.Name = "txtNumberOfCores";
     207      this.txtNumberOfCores.ReadOnly = true;
    202208      this.txtNumberOfCores.Size = new System.Drawing.Size(265, 20);
    203209      this.txtNumberOfCores.TabIndex = 17;
     
    209215      this.txtClientType.Location = new System.Drawing.Point(111, 185);
    210216      this.txtClientType.Name = "txtClientType";
     217      this.txtClientType.ReadOnly = true;
    211218      this.txtClientType.Size = new System.Drawing.Size(264, 20);
    212219      this.txtClientType.TabIndex = 18;
     
    218225      this.txtClientConfiguration.Location = new System.Drawing.Point(110, 237);
    219226      this.txtClientConfiguration.Name = "txtClientConfiguration";
     227      this.txtClientConfiguration.ReadOnly = true;
    220228      this.txtClientConfiguration.Size = new System.Drawing.Size(265, 20);
    221229      this.txtClientConfiguration.TabIndex = 19;
     
    227235      this.txtProcessor.Location = new System.Drawing.Point(111, 159);
    228236      this.txtProcessor.Name = "txtProcessor";
     237      this.txtProcessor.ReadOnly = true;
    229238      this.txtProcessor.Size = new System.Drawing.Size(264, 20);
    230239      this.txtProcessor.TabIndex = 20;
     
    236245      this.txtOS.Location = new System.Drawing.Point(111, 211);
    237246      this.txtOS.Name = "txtOS";
     247      this.txtOS.ReadOnly = true;
    238248      this.txtOS.Size = new System.Drawing.Size(264, 20);
    239249      this.txtOS.TabIndex = 21;
     
    245255      this.txtPerformanceValue.Location = new System.Drawing.Point(110, 263);
    246256      this.txtPerformanceValue.Name = "txtPerformanceValue";
     257      this.txtPerformanceValue.ReadOnly = true;
    247258      this.txtPerformanceValue.Size = new System.Drawing.Size(265, 20);
    248259      this.txtPerformanceValue.TabIndex = 23;
     
    263274      this.txtId.Location = new System.Drawing.Point(111, 289);
    264275      this.txtId.Name = "txtId";
     276      this.txtId.ReadOnly = true;
    265277      this.txtId.Size = new System.Drawing.Size(264, 20);
    266278      this.txtId.TabIndex = 25;
  • branches/ClientUserManagement/HeuristicLab.Clients.Access.Views/3.3/ClientViews/ClientView.cs

    r7557 r7933  
    2020#endregion
    2121
     22using System;
    2223using HeuristicLab.Core.Views;
    2324using HeuristicLab.MainForm;
     25using HeuristicLab.MainForm.WindowsForms;
    2426
    2527namespace HeuristicLab.Clients.Access.Views {
     
    3133      set { base.Content = value; }
    3234    }
     35
     36    private ProgressView progressView;
    3337
    3438    public ClientView() {
     
    7377      }
    7478    }
     79
     80    public void StartProgressView() {
     81      if (InvokeRequired) {
     82        Invoke(new Action(StartProgressView));
     83      } else {
     84        if (progressView == null) {
     85          IProgress prog = new Progress();
     86          prog.Status = "Downloading client information. Please be patient.";
     87          progressView = new ProgressView(this, prog);
     88        }
     89      }
     90    }
     91
     92    public void FinishProgressView() {
     93      if (InvokeRequired) {
     94        Invoke(new Action(FinishProgressView));
     95      } else {
     96        if (progressView != null) {
     97          progressView.Finish();
     98          progressView = null;
     99          SetEnabledStateOfControls();
     100        }
     101      }
     102    }
    75103  }
    76104}
  • branches/ClientUserManagement/HeuristicLab.Clients.Access.Views/3.3/MenuItems/ClientInfoMenuItem.cs

    r7557 r7933  
    3232    }
    3333    public override void Execute() {
    34       if (ClientInformation.Instance.ClientExists) {
    35         using (ClientInformationDialog dialog = new ClientInformationDialog()) {
    36           dialog.ShowDialog();
    37         }
    38       } else {
    39         using (ClientRegistrationDialog regDialog = new ClientRegistrationDialog()) {
    40           regDialog.ShowDialog();
    41         }
     34      using (ClientInformationDialog dialog = new ClientInformationDialog()) {
     35        dialog.ShowDialog();
    4236      }
    4337    }
Note: See TracChangeset for help on using the changeset viewer.