private void UpdateUIData() { iLOConnection iLOConn = this.iLOConnList[this.listBox_iLOList.SelectedIndex]; if (iLOConn.IsConnected) { this.ShowFan(iLOConn.SystemInfo["Fan"].ToObject <JObject>()); this.ShowTemp(iLOConn.SystemInfo["Temp"].ToObject <JObject>()); this.ShowPowerState(iLOConn.SystemInfo["Overview"].ToObject <JObject>()); this.toolStripStatusLabel_ServerStatus.Text = ((string)iLOConn.SystemInfo["Overview"]["system_health"]).Replace("OP_STATUS_", ""); this.toolStripStatusLabel_LastRefresh.Text = (string)iLOConn.SystemInfo["LastRefresh"]; if (this.fanListIsFocused && iLOConn.SystemInfo["Fan"]["fans"].Count() > this.fanListSelectedIndex) { this.listView_Fan.Items[this.fanListSelectedIndex].Selected = true; } else if (this.tempListIsFocused && iLOConn.SystemInfo["Temp"]["temperature"].Count() > this.tempListSelectedIndex) { this.listView_Temp.Items[this.tempListSelectedIndex].Selected = true; } } else { this.listView_Fan.Items.Clear(); this.listView_Temp.Items.Clear(); this.toolStripStatusLabel_ServerStatus.Text = "-"; this.toolStripStatusLabel_ServerPower.Text = "Disconnected"; this.toolStripStatusLabel_LastRefresh.Text = "-"; } this.toolStripStatusLabel_ConnStatus.Text = iLOConn.Status; }
private void UpdateUIData() { iLOConnection iLOConn = this.iLOConnList[this.listBox_iLOList.SelectedIndex]; if (iLOConn.IsConnected) { this.ShowFan(iLOConn.SystemInfo["Fan"].ToObject <JObject>()); this.ShowTemp(iLOConn.SystemInfo["Temp"].ToObject <JObject>()); this.ShowPowerState(iLOConn.SystemInfo["Overview"].ToObject <JObject>()); string serverStatus = ((string)iLOConn.SystemInfo["Overview"]["system_health"]).Replace("OP_STATUS_", ""); if (serverStatus.ToUpper() == "OK") { this.toolStripStatusLabel_ServerStatus.ForeColor = Color.Green; } else { this.toolStripStatusLabel_ServerStatus.ForeColor = Color.Red; } this.toolStripStatusLabel_ServerStatus.Text = string.Format("Status {0}", serverStatus); // change menu bar operativity 8/15/2019 if (iLOConn.SystemInfo["Overview"]["power"].ToString().Contains("ON")) { toolStripMenuItem_Action_Power_MomentaryPress.Enabled = true; pressAndHoldToolStripMenuItem.Enabled = true; coldbootToolStripMenuItem.Enabled = true; resetToolStripMenuItem.Enabled = true; } else if (iLOConn.SystemInfo["Overview"]["power"].ToString().Contains("OFF")) { toolStripMenuItem_Action_Power_MomentaryPress.Enabled = true; pressAndHoldToolStripMenuItem.Enabled = false; coldbootToolStripMenuItem.Enabled = false; resetToolStripMenuItem.Enabled = false; } this.toolStripStatusLabel_LastRefresh.Text = (string)iLOConn.SystemInfo["LastRefresh"]; if (this.fanListIsFocused && iLOConn.SystemInfo["Fan"]["fans"].Count() > this.fanListSelectedIndex) { this.listView_Fan.Items[this.fanListSelectedIndex].Selected = true; } else if (this.tempListIsFocused && iLOConn.SystemInfo["Temp"]["temperature"].Count() > this.tempListSelectedIndex) { this.listView_Temp.Items[this.tempListSelectedIndex].Selected = true; } } else { this.listView_Fan.Items.Clear(); this.listView_Temp.Items.Clear(); this.toolStripStatusLabel_ServerStatus.Text = "-"; this.toolStripStatusLabel_ServerPower.Text = "Disconnected"; this.toolStripStatusLabel_LastRefresh.Text = "-"; } this.toolStripStatusLabel_ConnStatus.Text = iLOConn.Status; }
private void button_SaveAndExit_Click(object sender, EventArgs e) { if (this.ValidateInput()) { this.iLOConnection = new iLOConnection(); this.iLOConnection.Name = this.textBox_Name.Text; this.iLOConnection.Https = this.checkBox_Https.Checked; this.iLOConnection.Host = this.textBox_Host.Text; this.iLOConnection.Port = (int)this.numericUpDown_Port.Value; this.iLOConnection.User = this.textBox_User.Text; this.iLOConnection.UserPassword = this.textBox_Password.Text; this.Close(); } }
private void ReloadUI() { this.LoadAppConfig(); // Update IRC.exe path string newIRCPath = this.GetIRCPath(); if (newIRCPath != null) { appConfig["IRCPath"] = newIRCPath; this.SaveAppConfig(); } this.LogoutAlliLOConnections(); this.listBox_iLOList.ClearSelected(); this.listBox_iLOList.Items.Clear(); this.iLOConnList.Clear(); if (appConfig["Servers"] != null) { foreach (var server in appConfig["Servers"]) { iLOConnection iLOConn = new iLOConnection(); iLOConn.Name = (string)server["Name"]; iLOConn.Https = (bool)server["Https"]; iLOConn.Host = (string)server["Host"]; iLOConn.Port = (int)server["Port"]; iLOConn.User = (string)server["User"]; iLOConn.UserPassword = (string)server["Password"]; iLOConn.Login(); this.listBox_iLOList.Items.Add(iLOConn.ToString()); this.iLOConnList.Add(iLOConn); } } this.timer_UpdateServerInfo_Tick(null, null); this.timer_UpdateServerInfo.Enabled = true; this.timer_ShowServerInfo_Tick(null, null); this.timer_ShowServerInfo.Enabled = true; if (this.listBox_iLOList.Items.Count > 0) { this.listBox_iLOList.SelectedIndex = 0; } }
public Form_iLO(iLOConnection iLOConnection = null) { this.iLOConnection = iLOConnection; InitializeComponent(); }