Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1372


Ignore:
Timestamp:
03/19/09 17:35:41 (16 years ago)
Author:
aleitner
Message:

find changes in backgroundworker (#508)

Location:
branches/Hive_Management_Console_Refactoring_Ticket508/HeuristicLab.Hive.Server.Console
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/Hive_Management_Console_Refactoring_Ticket508/HeuristicLab.Hive.Server.Console/HiveServerConsole.Designer.cs

    r1164 r1372  
    4545    /// </summary>
    4646    private void InitializeComponent() {
    47       this.msServerConsole = new System.Windows.Forms.MenuStrip();
    48       this.tsmiConsole = new System.Windows.Forms.ToolStripMenuItem();
    49       this.tsmiExit = new System.Windows.Forms.ToolStripMenuItem();
    50       this.gbManager = new System.Windows.Forms.GroupBox();
     47      this.gbConfiguration = new System.Windows.Forms.GroupBox();
    5148      this.lblPort = new System.Windows.Forms.Label();
    5249      this.lblIp = new System.Windows.Forms.Label();
     
    5451      this.tbIp = new System.Windows.Forms.TextBox();
    5552      this.btnLogin = new System.Windows.Forms.Button();
    56       this.groupBox1 = new System.Windows.Forms.GroupBox();
     53      this.gpUser = new System.Windows.Forms.GroupBox();
    5754      this.tbUserName = new System.Windows.Forms.TextBox();
    5855      this.lblPwd = new System.Windows.Forms.Label();
     
    6057      this.tbPwd = new System.Windows.Forms.TextBox();
    6158      this.lblError = new System.Windows.Forms.Label();
    62       this.msServerConsole.SuspendLayout();
    63       this.gbManager.SuspendLayout();
    64       this.groupBox1.SuspendLayout();
     59      this.gbConfiguration.SuspendLayout();
     60      this.gpUser.SuspendLayout();
    6561      this.SuspendLayout();
    6662      //
    67       // msServerConsole
    68       //
    69       this.msServerConsole.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
    70             this.tsmiConsole});
    71       this.msServerConsole.Location = new System.Drawing.Point(0, 0);
    72       this.msServerConsole.Name = "msServerConsole";
    73       this.msServerConsole.Size = new System.Drawing.Size(311, 24);
    74       this.msServerConsole.TabIndex = 0;
    75       this.msServerConsole.Text = "menuStrip1";
    76       //
    77       // tsmiConsole
    78       //
    79       this.tsmiConsole.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
    80             this.tsmiExit});
    81       this.tsmiConsole.Name = "tsmiConsole";
    82       this.tsmiConsole.Size = new System.Drawing.Size(87, 20);
    83       this.tsmiConsole.Text = "Serverconsole";
    84       //
    85       // tsmiExit
    86       //
    87       this.tsmiExit.Name = "tsmiExit";
    88       this.tsmiExit.Size = new System.Drawing.Size(103, 22);
    89       this.tsmiExit.Text = "Exit";
    90       this.tsmiExit.Click += new System.EventHandler(this.tsmiExit_Click);
    91       //
    92       // gbManager
    93       //
    94       this.gbManager.Controls.Add(this.lblPort);
    95       this.gbManager.Controls.Add(this.lblIp);
    96       this.gbManager.Controls.Add(this.tbPort);
    97       this.gbManager.Controls.Add(this.tbIp);
    98       this.gbManager.Location = new System.Drawing.Point(16, 124);
    99       this.gbManager.Name = "gbManager";
    100       this.gbManager.Size = new System.Drawing.Size(283, 82);
    101       this.gbManager.TabIndex = 4;
    102       this.gbManager.TabStop = false;
    103       this.gbManager.Text = "Manager";
     63      // gbConfiguration
     64      //
     65      this.gbConfiguration.Controls.Add(this.lblPort);
     66      this.gbConfiguration.Controls.Add(this.lblIp);
     67      this.gbConfiguration.Controls.Add(this.tbPort);
     68      this.gbConfiguration.Controls.Add(this.tbIp);
     69      this.gbConfiguration.Location = new System.Drawing.Point(12, 100);
     70      this.gbConfiguration.Name = "gbConfiguration";
     71      this.gbConfiguration.Size = new System.Drawing.Size(283, 82);
     72      this.gbConfiguration.TabIndex = 4;
     73      this.gbConfiguration.TabStop = false;
     74      this.gbConfiguration.Text = "Configuration";
    10475      //
    10576      // lblPort
     
    139110      // btnLogin
    140111      //
    141       this.btnLogin.Location = new System.Drawing.Point(183, 212);
     112      this.btnLogin.Location = new System.Drawing.Point(179, 188);
    142113      this.btnLogin.Name = "btnLogin";
    143114      this.btnLogin.Size = new System.Drawing.Size(116, 23);
     
    148119      this.btnLogin.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.HiveServerConsole_KeyPress);
    149120      //
    150       // groupBox1
    151       //
    152       this.groupBox1.Controls.Add(this.tbUserName);
    153       this.groupBox1.Controls.Add(this.lblPwd);
    154       this.groupBox1.Controls.Add(this.lblUsername);
    155       this.groupBox1.Controls.Add(this.tbPwd);
    156       this.groupBox1.Location = new System.Drawing.Point(16, 36);
    157       this.groupBox1.Name = "groupBox1";
    158       this.groupBox1.Size = new System.Drawing.Size(283, 82);
    159       this.groupBox1.TabIndex = 1;
    160       this.groupBox1.TabStop = false;
    161       this.groupBox1.Text = "Manager";
     121      // gpUser
     122      //
     123      this.gpUser.Controls.Add(this.tbUserName);
     124      this.gpUser.Controls.Add(this.lblPwd);
     125      this.gpUser.Controls.Add(this.lblUsername);
     126      this.gpUser.Controls.Add(this.tbPwd);
     127      this.gpUser.Location = new System.Drawing.Point(12, 12);
     128      this.gpUser.Name = "gpUser";
     129      this.gpUser.Size = new System.Drawing.Size(283, 82);
     130      this.gpUser.TabIndex = 1;
     131      this.gpUser.TabStop = false;
     132      this.gpUser.Text = "User";
    162133      //
    163134      // tbUserName
     
    209180      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    210181      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    211       this.ClientSize = new System.Drawing.Size(311, 263);
     182      this.ClientSize = new System.Drawing.Size(311, 225);
    212183      this.Controls.Add(this.lblError);
    213       this.Controls.Add(this.groupBox1);
     184      this.Controls.Add(this.gpUser);
    214185      this.Controls.Add(this.btnLogin);
    215       this.Controls.Add(this.gbManager);
    216       this.Controls.Add(this.msServerConsole);
    217       this.MainMenuStrip = this.msServerConsole;
     186      this.Controls.Add(this.gbConfiguration);
    218187      this.Name = "HiveServerConsole";
    219188      this.Text = "Server Console";
    220189      this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.HiveServerConsole_KeyPress);
    221       this.msServerConsole.ResumeLayout(false);
    222       this.msServerConsole.PerformLayout();
    223       this.gbManager.ResumeLayout(false);
    224       this.gbManager.PerformLayout();
    225       this.groupBox1.ResumeLayout(false);
    226       this.groupBox1.PerformLayout();
     190      this.gbConfiguration.ResumeLayout(false);
     191      this.gbConfiguration.PerformLayout();
     192      this.gpUser.ResumeLayout(false);
     193      this.gpUser.PerformLayout();
    227194      this.ResumeLayout(false);
    228195      this.PerformLayout();
     
    232199    #endregion
    233200
    234     private System.Windows.Forms.MenuStrip msServerConsole;
    235     private System.Windows.Forms.ToolStripMenuItem tsmiConsole;
    236     private System.Windows.Forms.ToolStripMenuItem tsmiExit;
    237     private System.Windows.Forms.GroupBox gbManager;
     201    private System.Windows.Forms.GroupBox gbConfiguration;
    238202    private System.Windows.Forms.Label lblPort;
    239203    private System.Windows.Forms.Label lblIp;
     
    241205    private System.Windows.Forms.TextBox tbIp;
    242206    private System.Windows.Forms.Button btnLogin;
    243     private System.Windows.Forms.GroupBox groupBox1;
     207    private System.Windows.Forms.GroupBox gpUser;
    244208    private System.Windows.Forms.TextBox tbUserName;
    245209    private System.Windows.Forms.Label lblPwd;
  • branches/Hive_Management_Console_Refactoring_Ticket508/HeuristicLab.Hive.Server.Console/HiveServerConsole.resx

    r778 r1372  
    118118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    119119  </resheader>
    120   <metadata name="msServerConsole.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    121     <value>17, 17</value>
    122   </metadata>
    123120</root>
  • branches/Hive_Management_Console_Refactoring_Ticket508/HeuristicLab.Hive.Server.Console/HiveServerManagementConsole.cs

    r1273 r1372  
    6363    private bool flagUser = false;
    6464
     65    private List<Changes> changes = new List<Changes>();
     66
    6567    private ToolTip tt = new ToolTip();
    6668    #endregion
     
    8082    /// <param name="e"></param>
    8183    private void TickSync(object obj, EventArgs e) {
    82       Refresh();
    83       //updaterWoker.RunWorkerAsync();
     84      //Refresh();
     85      if (!updaterWoker.IsBusy) {
     86        updaterWoker.RunWorkerAsync();
     87      }
    8488    }
    8589
     
    375379      AddJobForm newForm = new AddJobForm();
    376380      newForm.Show();
    377       newForm.addJobEvent += new addDelegate(Refresh);
     381      //newForm.addJobEvent += new addDelegate(updaterWoker.RunWorkerAsync);
    378382    }
    379383
     
    481485
    482486    private void updaterWoker_DoWork(object sender, DoWorkEventArgs e) {
    483       #region ClientInfo
    484       List<Changes> changes = new List<Changes>();
    485       ResponseList<ClientInfo> clientInfoOld = clientInfo;
     487
    486488      IClientManager clientManager =
    487489          ServiceLocator.GetClientManager();
     490     
     491      #region ClientInfo
     492      ResponseList<ClientInfo> clientInfoOld = clientInfo;
     493      clientInfo = clientManager.GetAllClients();
     494
     495      ResponseList<ClientInfo> clientInfoOldHelp;
     496
     497      CloneList(clientInfoOld, out clientInfoOldHelp);
     498
     499      GetDelta(clientInfoOld.List, clientInfoOldHelp.List);
     500      #endregion
     501
     502      #region Clients
     503      ResponseList<ClientGroup> clientsOld = clients;
     504     
     505      clients = clientManager.GetAllClientGroups();
     506
     507      ResponseList<ClientGroup> clientsOldHelp;
     508
     509      CloneList(clientsOld, out clientsOldHelp);
     510
     511      GetDelta(clientsOld.List, clientsOldHelp.List);
     512      #endregion
     513
     514      #region Job
     515      ResponseList<Job> jobsOld = jobs;
     516      IJobManager jobManager =
     517          ServiceLocator.GetJobManager();
     518
     519      jobs = jobManager.GetAllJobs();
     520
     521      ResponseList<Job> jobsOldHelp = new ResponseList<Job>();
     522      CloneList(jobsOld, out jobsOldHelp);
     523     
     524      //System.Diagnostics.Debug.WriteLine(jobsOldHelp.List[0].Id.ToString());
     525
     526      GetDelta(jobsOld.List, jobsOldHelp.List);
     527
     528      #endregion
     529
     530    }
     531    #endregion
     532
     533    #region Helper methods
     534
     535    private void CloneList(ResponseList<Job> oldList, out ResponseList<Job> newList) {
     536      newList = new ResponseList<Job>();
     537      newList.List = new List<Job>();
     538      foreach (Job item in oldList.List) {
     539        newList.List.Add(item);
     540      }
     541    }
     542
     543    private void CloneList(ResponseList<ClientInfo> oldList, out ResponseList<ClientInfo> newList) {
     544      newList = new ResponseList<ClientInfo>();
     545      newList.List = new List<ClientInfo>();
     546      foreach (ClientInfo item in oldList.List) {
     547        newList.List.Add(item);
     548      }
     549    }
     550
     551    private void CloneList(ResponseList<ClientGroup> oldList, out ResponseList<ClientGroup> newList) {
     552      newList = new ResponseList<ClientGroup>();
     553      newList.List = new List<ClientGroup>();
     554      foreach (ClientGroup item in oldList.List) {
     555        newList.List.Add(item);
     556      }
     557    }
     558
     559    private bool IsEqual(ClientInfo ci1, ClientInfo ci2) {
     560      if (ci1.ClientId.Equals(ci2.ClientId)) {
     561        return true;
     562      } else return false;
     563    }
     564
     565    private void GetDelta(IList<ClientInfo> oldClient, IList<ClientInfo> helpClients) {
    488566      bool found = false;
    489       clientInfo = clientManager.GetAllClients();
    490 
    491       ResponseList<ClientInfo> clientInfoOldHelp = clientInfoOld;
    492567
    493568      foreach (ClientInfo ci in clientInfo.List) {
    494         for (int i = 0; i < clientInfoOld.List.Count; i ++) {
    495           ClientInfo cio = clientInfoOld.List[i];
     569        for (int i = 0; i < oldClient.Count; i++) {
     570          ClientInfo cio = oldClient[i];
    496571          if (ci.Id.Equals(cio.Id)) {
    497572            found = true;
     
    499574              changes.Add(new Changes { Types = Type.Client, ID = ci.Id, ChangeType = Change.Update });
    500575            }
    501               for (int j = 0; j < clientInfoOldHelp.List.Count; j++) {
    502                 if (cio.Id.Equals(clientInfoOldHelp.List[i])) {
    503                   clientInfoOldHelp.List.RemoveAt(i);
    504                   break;
    505                 }
    506               }
     576            for (int j = 0; j < helpClients.Count; j++) {
     577              if (cio.Id.Equals(helpClients[j])) {
     578                helpClients.RemoveAt(j);
     579                break;
     580              }
     581            }
    507582            break;
    508583          }
     
    511586          changes.Add(new Changes { Types = Type.Client, ID = ci.Id, ChangeType = Change.Create });
    512587        }
    513       }
    514       foreach (ClientInfo ci in clientInfoOldHelp.List) {
     588        found = false;
     589      }
     590      foreach (ClientInfo ci in helpClients) {
    515591        changes.Add(new Changes { Types = Type.Client, ID = ci.Id, ChangeType = Change.Delete });
    516592      }
    517       #endregion
    518 
    519       #region Clients
    520       ResponseList<ClientGroup> clientsOld = clients;
    521       found = false;
    522       clients = clientManager.GetAllClientGroups();
    523 
    524       ResponseList<ClientGroup> clientsOldHelp = clientsOld;
    525 
     593
     594    }
     595
     596    private void GetDelta(IList<ClientGroup> oldClient, IList<ClientGroup> helpClients) {
     597
     598      bool found = false;
    526599      foreach (ClientGroup cg in clients.List) {
    527         for (int i = 0; i < clientInfoOld.List.Count; i++) {
    528           ClientGroup cgo = clientsOld.List[i];
     600        for (int i = 0; i < oldClient.Count; i++) {
     601          ClientGroup cgo = oldClient[i];
    529602          if (cg.Id.Equals(cgo.Id)) {
    530603            found = true;
     
    538611              }
    539612            }
    540             for (int j = 0; j < clientInfoOldHelp.List.Count; j++) {
    541               if (cgo.Id.Equals(clientInfoOldHelp.List[i])) {
    542                 clientInfoOldHelp.List.RemoveAt(i);
     613            for (int j = 0; j < helpClients.Count; j++) {
     614              if (cgo.Id.Equals(helpClients[j])) {
     615                helpClients.RemoveAt(j);
    543616                break;
    544617              }
     
    550623          changes.Add(new Changes { Types = Type.ClientGroup, ID = cg.Id, ChangeType = Change.Create });
    551624        }
    552       }
    553       foreach (ClientGroup cg in clientsOldHelp.List) {
     625        found = false;
     626      }
     627      foreach (ClientGroup cg in helpClients) {
    554628        changes.Add(new Changes { Types = Type.ClientGroup, ID = cg.Id, ChangeType = Change.Delete });
    555629      }
    556       #endregion
    557 
    558       #region job
    559       ResponseList<Job> jobsOld = jobs;
    560       IJobManager jobManager =
    561           ServiceLocator.GetJobManager();
    562       found = false;
    563       jobs = jobManager.GetAllJobs();
    564 
    565       ResponseList<Job> jobsOldHelp = jobsOld;
    566 
     630    }
     631     
     632    private void GetDelta(IList<Job> oldJobs, IList<Job> helpJobs) {
     633      bool found = false;
    567634      foreach (Job job in jobs.List) {
    568         for (int i = 0; i < jobsOld.List.Count; i++) {
    569           Job jobold = jobsOld.List[i];
     635       
     636        for (int i = 0; i < oldJobs.Count; i++) {
     637         
     638          Job jobold = oldJobs[i];
     639
    570640          if (job.Id.Equals(jobold.Id)) {
     641
    571642            found = true;
    572             if (job.Client != jobold.Client) {
     643            if (IsEqual(job.Client, jobold.Client)) {
    573644              changes.Add(new Changes { Types = Type.Job, ID = job.Id, ChangeType = Change.Update });
    574645            } else if (job.DateCalculated != jobold.DateCalculated) {
    575646              changes.Add(new Changes { Types = Type.Job, ID = job.Id, ChangeType = Change.Update });
    576647            }
    577             //for (int j = 0; j < clientInfoOldHelp.List.Count; j++) {
    578             //  if (job.Id.Equals(clientInfoOldHelp.List[i])) {
    579             //    clientInfoOldHelp.List.RemoveAt(i);
    580             //    break;
    581             //  }
    582             //}
     648
     649            for (int j = 0; j < helpJobs.Count; j++) {
     650              if (job.Id.Equals(helpJobs[j].Id)) {
     651                helpJobs.RemoveAt(j);
     652                break;
     653              }
     654            }
    583655            break;
    584656          }
     657
    585658        }
    586659        if (found == false) {
    587660          changes.Add(new Changes { Types = Type.Job, ID = job.Id, ChangeType = Change.Create });
    588         }
    589       }
    590       foreach (Job job in jobsOldHelp.List) {
     661          System.Diagnostics.Debug.WriteLine("new Job: " + job.Id);
     662        }
     663        found = false;
     664      }
     665      foreach (Job job in helpJobs) {
    591666        changes.Add(new Changes { Types = Type.Job, ID = job.Id, ChangeType = Change.Delete });
    592       }
    593       #endregion
    594 
    595     }
     667        System.Diagnostics.Debug.WriteLine("delete Job: " + job.Id);
     668      }
     669    }
     670
     671
    596672    #endregion
     673
     674
    597675  }
    598676}
Note: See TracChangeset for help on using the changeset viewer.