/[projects]/dao/DaoMqPump2/DaoMqGUI/MainForm.cs
ViewVC logotype

Diff of /dao/DaoMqPump2/DaoMqGUI/MainForm.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2012 by torben, Mon Jul 8 14:23:01 2013 UTC revision 2013 by torben, Fri Jul 12 10:23:03 2013 UTC
# Line 64  namespace DaoMqGUI Line 64  namespace DaoMqGUI
64              return result;              return result;
65          }          }
66    
67            public int getSelectedTransportIndex()
68            {
69                if (transports.SelectedIndices.Count == 0)
70                    return -1;
71                else
72                    return transports.SelectedIndices[0];
73            }
74    
75          public void loadTransports()          public void loadTransports()
76          {          {
77              int selected = transports.SelectedIndex;  
78                int selected = getSelectedTransportIndex();
79              if (selected == -1) //er der ikke valgt - vælger vi den første              if (selected == -1) //er der ikke valgt - vælger vi den første
80                  selected = 0;                  selected = 0;
81    
# Line 80  namespace DaoMqGUI Line 89  namespace DaoMqGUI
89                  StatusData statusData = client.GetTransportStatus(t);                  StatusData statusData = client.GetTransportStatus(t);
90                  bool enabled = statusData.transportEnabled;                  bool enabled = statusData.transportEnabled;
91                  string status = "";                  string status = "";
92                    Color bgColor;
93                  if (enabled)                  if (enabled)
94                  {                  {
95                      bool lastOk = statusData.lastrunOk;                                          bool lastOk = statusData.lastrunOk;                    
96                                            
97                      if (lastOk)                      if (lastOk)
98                      {                      {
99                          status = "running";                                                  status = "running";
100                            bgColor = Color.Green;
101                      }                      }
102                      else                      else
103                      {                      {
104                          status = "error";                          status = "error";
105                            bgColor = Color.Red;
106                      }                      }
107                  }                  }
108                  else                  else
109                  {                  {
110                      status = "stopped";                      status = "stopped";
111                        bgColor = Color.DarkOrange;                    
112                  }                  }
113    
114                  transports.Items.Add(t + " - " + status);                  ListViewItem item = new ListViewItem(t + " - " + status);
115                    item.ForeColor = bgColor;
116                    transports.Items.Add(item);
117              }              }
118    
119    
# Line 111  namespace DaoMqGUI Line 125  namespace DaoMqGUI
125                      selected = -1;                      selected = -1;
126              }              }
127    
128              transports.SelectedIndex = selected;              transports.SelectedIndices.Clear();
129                if (selected != -1)
130                    transports.SelectedIndices.Add(selected);
131                //transports.SelectedIndices[0] = selected;
132    
133          }          }
134    
# Line 158  namespace DaoMqGUI Line 175  namespace DaoMqGUI
175    
176          private void loadStatusData()          private void loadStatusData()
177          {          {
178              if (transports.SelectedIndex == -1)              if (getSelectedTransportIndex() == -1)
179                  return;                  return;
180    
181              string transportName = transportNameList[transports.SelectedIndex];              string transportName = transportNameList[getSelectedTransportIndex() ];
182    
183              StatusData statusData = client.GetTransportStatus(transportName);              StatusData statusData = client.GetTransportStatus(transportName);
184    
# Line 188  namespace DaoMqGUI Line 205  namespace DaoMqGUI
205    
206          private void refreshTimer_Tick(object sender, EventArgs e)          private void refreshTimer_Tick(object sender, EventArgs e)
207          {          {
208              loadTransports();              loadTransports();
209    
210              if (transports.SelectedIndex == -1)              if (getSelectedTransportIndex() == -1)
211                  return;                  return;
212    
213              showData();              showData();
# Line 198  namespace DaoMqGUI Line 215  namespace DaoMqGUI
215    
216          private void loadLog()          private void loadLog()
217          {          {
218              if (transports.SelectedIndex == -1)              if (getSelectedTransportIndex() == -1)
219                  return;                  return;
220              string transportName = transportNameList[transports.SelectedIndex];              string transportName = transportNameList[getSelectedTransportIndex()];
221    
222              string[] logEntries = client.GetTransportLog(transportName);              string[] logEntries = client.GetTransportLog(transportName);
223    
# Line 215  namespace DaoMqGUI Line 232  namespace DaoMqGUI
232    
233          private void loadConfig()          private void loadConfig()
234          {          {
235              if (transports.SelectedIndex == -1)              if (getSelectedTransportIndex() == -1)
236                  return;                  return;
237              string transportName = transportNameList[transports.SelectedIndex];              string transportName = transportNameList[getSelectedTransportIndex()];
238    
239              string direction = client.GetTransportDirection(transportName);              string direction = client.GetTransportDirection(transportName);
240              string queue = client.GetTransportQueueName(transportName);              string queue = client.GetTransportQueueName(transportName);
# Line 235  namespace DaoMqGUI Line 252  namespace DaoMqGUI
252    
253          private void showData()          private void showData()
254          {          {
255              if (transports.SelectedIndex == -1)              if (getSelectedTransportIndex() == -1)
256                  return;                  return;
257    
258              switch (tabControl1.SelectedIndex)              switch (tabControl1.SelectedIndex)

Legend:
Removed from v.2012  
changed lines
  Added in v.2013

  ViewVC Help
Powered by ViewVC 1.1.20