Free cookie consent management tool by TermsFeed Policy Generator

Changeset 912 for trunk


Ignore:
Timestamp:
12/04/08 17:33:44 (16 years ago)
Author:
aleitner
Message:

Handled exeption if server not online (#380)

Location:
trunk/sources/HeuristicLab.Hive.Server.Console
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Server.Console/HiveServerConsole.Designer.cs

    r778 r912  
    5252      this.lblIp = new System.Windows.Forms.Label();
    5353      this.tbPort = new System.Windows.Forms.TextBox();
     54      this.btnLogin = new System.Windows.Forms.Button();
     55      this.groupBox1 = new System.Windows.Forms.GroupBox();
     56      this.lblPwd = new System.Windows.Forms.Label();
     57      this.lblUsername = new System.Windows.Forms.Label();
     58      this.tbPwd = new System.Windows.Forms.TextBox();
     59      this.tbUserName = new System.Windows.Forms.TextBox();
     60      this.lblError = new System.Windows.Forms.Label();
    5461      this.tbIp = new HeuristicLab.Hive.Server.Console.IPAddressTextBox();
    55       this.btnLogin = new System.Windows.Forms.Button();
    5662      this.msServerConsole.SuspendLayout();
    5763      this.gbManager.SuspendLayout();
     64      this.groupBox1.SuspendLayout();
    5865      this.SuspendLayout();
    5966      //
     
    7986      //
    8087      this.tsmiExit.Name = "tsmiExit";
    81       this.tsmiExit.Size = new System.Drawing.Size(152, 22);
     88      this.tsmiExit.Size = new System.Drawing.Size(103, 22);
    8289      this.tsmiExit.Text = "Exit";
    8390      this.tsmiExit.Click += new System.EventHandler(this.tsmiExit_Click);
     
    8996      this.gbManager.Controls.Add(this.tbPort);
    9097      this.gbManager.Controls.Add(this.tbIp);
    91       this.gbManager.Location = new System.Drawing.Point(12, 37);
     98      this.gbManager.Location = new System.Drawing.Point(16, 124);
    9299      this.gbManager.Name = "gbManager";
    93100      this.gbManager.Size = new System.Drawing.Size(283, 82);
     
    116123      // tbPort
    117124      //
    118       this.tbPort.Location = new System.Drawing.Point(57, 47);
     125      this.tbPort.Location = new System.Drawing.Point(77, 47);
    119126      this.tbPort.Name = "tbPort";
    120       this.tbPort.Size = new System.Drawing.Size(209, 20);
     127      this.tbPort.Size = new System.Drawing.Size(189, 20);
    121128      this.tbPort.TabIndex = 1;
    122129      //
    123       // tbIp
    124       //
    125       this.tbIp.Location = new System.Drawing.Point(57, 19);
    126       this.tbIp.Name = "tbIp";
    127       this.tbIp.Size = new System.Drawing.Size(211, 20);
    128       this.tbIp.TabIndex = 0;
    129       //
    130130      // btnLogin
    131131      //
    132       this.btnLogin.Location = new System.Drawing.Point(179, 127);
     132      this.btnLogin.Location = new System.Drawing.Point(183, 212);
    133133      this.btnLogin.Name = "btnLogin";
    134134      this.btnLogin.Size = new System.Drawing.Size(116, 23);
     
    138138      this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click);
    139139      //
     140      // groupBox1
     141      //
     142      this.groupBox1.Controls.Add(this.tbUserName);
     143      this.groupBox1.Controls.Add(this.lblPwd);
     144      this.groupBox1.Controls.Add(this.lblUsername);
     145      this.groupBox1.Controls.Add(this.tbPwd);
     146      this.groupBox1.Location = new System.Drawing.Point(16, 36);
     147      this.groupBox1.Name = "groupBox1";
     148      this.groupBox1.Size = new System.Drawing.Size(283, 82);
     149      this.groupBox1.TabIndex = 4;
     150      this.groupBox1.TabStop = false;
     151      this.groupBox1.Text = "Manager";
     152      //
     153      // lblPwd
     154      //
     155      this.lblPwd.AutoSize = true;
     156      this.lblPwd.Location = new System.Drawing.Point(16, 54);
     157      this.lblPwd.Name = "lblPwd";
     158      this.lblPwd.Size = new System.Drawing.Size(53, 13);
     159      this.lblPwd.TabIndex = 3;
     160      this.lblPwd.Text = "Password";
     161      //
     162      // lblUsername
     163      //
     164      this.lblUsername.AutoSize = true;
     165      this.lblUsername.Location = new System.Drawing.Point(16, 26);
     166      this.lblUsername.Name = "lblUsername";
     167      this.lblUsername.Size = new System.Drawing.Size(55, 13);
     168      this.lblUsername.TabIndex = 2;
     169      this.lblUsername.Text = "Username";
     170      //
     171      // tbPwd
     172      //
     173      this.tbPwd.Location = new System.Drawing.Point(77, 47);
     174      this.tbPwd.Name = "tbPwd";
     175      this.tbPwd.Size = new System.Drawing.Size(189, 20);
     176      this.tbPwd.TabIndex = 1;
     177      //
     178      // tbUserName
     179      //
     180      this.tbUserName.Location = new System.Drawing.Point(77, 19);
     181      this.tbUserName.Name = "tbUserName";
     182      this.tbUserName.Size = new System.Drawing.Size(189, 20);
     183      this.tbUserName.TabIndex = 4;
     184      //
     185      // lblError
     186      //
     187      this.lblError.AutoSize = true;
     188      this.lblError.ForeColor = System.Drawing.Color.Red;
     189      this.lblError.Location = new System.Drawing.Point(16, 238);
     190      this.lblError.Name = "lblError";
     191      this.lblError.Size = new System.Drawing.Size(0, 13);
     192      this.lblError.TabIndex = 5;
     193      //
     194      // tbIp
     195      //
     196      this.tbIp.Location = new System.Drawing.Point(77, 19);
     197      this.tbIp.Name = "tbIp";
     198      this.tbIp.Size = new System.Drawing.Size(191, 20);
     199      this.tbIp.TabIndex = 0;
     200      //
    140201      // HiveServerConsole
    141202      //
    142203      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    143204      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    144       this.ClientSize = new System.Drawing.Size(311, 162);
     205      this.ClientSize = new System.Drawing.Size(311, 263);
     206      this.Controls.Add(this.lblError);
     207      this.Controls.Add(this.groupBox1);
    145208      this.Controls.Add(this.btnLogin);
    146209      this.Controls.Add(this.gbManager);
     
    153216      this.gbManager.ResumeLayout(false);
    154217      this.gbManager.PerformLayout();
     218      this.groupBox1.ResumeLayout(false);
     219      this.groupBox1.PerformLayout();
    155220      this.ResumeLayout(false);
    156221      this.PerformLayout();
     
    169234    private IPAddressTextBox tbIp;
    170235    private System.Windows.Forms.Button btnLogin;
     236    private System.Windows.Forms.GroupBox groupBox1;
     237    private System.Windows.Forms.TextBox tbUserName;
     238    private System.Windows.Forms.Label lblPwd;
     239    private System.Windows.Forms.Label lblUsername;
     240    private System.Windows.Forms.TextBox tbPwd;
     241    private System.Windows.Forms.Label lblError;
    171242  }
    172243}
  • trunk/sources/HeuristicLab.Hive.Server.Console/HiveServerConsole.cs

    r831 r912  
    3030using HeuristicLab.Hive.Contracts.Interfaces;
    3131using HeuristicLab.Hive.Contracts.BusinessObjects;
     32using HeuristicLab.Hive.Contracts;
    3233
    3334namespace HeuristicLab.Hive.Server.Console {
     
    4041      InitializeComponent();
    4142      tbIp.Text = "10.20.53.1";
     43      tbPort.Text = "9000";
    4244    }
    4345
     
    5355    /// <param name="e"></param>
    5456    private void btnLogin_Click(object sender, EventArgs e) {
    55       if (ipIsValid()) {
     57      if (isValid()) {
    5658        string newIp = tbIp.Text;
    5759        newIp = newIp.Replace(" ", "");
     
    6870
    6971
    70     private static bool ipIsValid() {
    71      
     72    private bool isValid() {
     73      if ((tbUserName.Text != "") &&
     74          (tbPwd.Text != "") &&
     75          (tbIp.Text != "") &&
     76          (tbPort.Text != "")) {
     77        try {
     78          IJobManager jobManager =
     79        ServiceLocator.GetJobManager();
     80          ResponseList<Job> jobs = jobManager.GetAllJobs();
     81          jobs = jobManager.GetAllJobs();
     82        }
     83        catch (Exception ex) {
     84          lblError.Text = "Server not online";
     85          return false;
     86        }
     87        return true;
     88      }
    7289      // TODO IP-Adress validation
    73       return true;
     90      return false;
    7491    }
    7592
Note: See TracChangeset for help on using the changeset viewer.