private void refreshAll() { SlimCli client = mainForm.Client; Assembly ws = Assembly.GetExecutingAssembly(); labelWSVer.Text = ws.GetName().Version.ToString(); labelSCLVer.Text = client.getVersion(); if (client.Connected) { Server server = client.getServer(); labelSSVer.Text = server.ServerVersion; labelLibStats.Text = string.Format( "Your music library contains {0} albums with {1} songs by {2} artists", server.AlbumCount, server.SongCount, server.ArtistCount); labelLibScanning.Text = server.Scanning ? "Scanning in progress" : "Scanning complete"; } else { labelSSVer.Text = "Not Connected"; labelLibStats.Text = "Not Connected - No Library Available"; labelLibScanning.Text = ""; } }
internal bool reconnect(string host, int port) { client = new SlimCli(host, port); bool connected = client != null && Client.Connected; if (connected) { server = client.getServer(); Player[] players = server.getPlayers(); foreach (Player player in players) { comboPlayers.Items.Add(player); } if (comboPlayers.Items.Count > 0) { comboPlayers.SelectedIndex = 0; } else { MessageBox.Show("Can't find any connected players!"); } writePref("host", host); writePref("port", port); } return(connected); }
void PrefFormLoad(object sender, System.EventArgs e) { refreshAll(); SlimCli client = mainForm.Client; textHost.Text = client.ServerHost; textPort.Text = client.ServerPort.ToString(); refreshTimer.Start(); }
void ButtonOKClick(object sender, System.EventArgs e) { SlimCli client = mainForm.Client; if (!(textHost.Text.Equals(client.ServerHost) && textPort.Text.Equals(client.ServerPort))) { bool result = mainForm.reconnect(textHost.Text, int.Parse(textPort.Text)); if (!result) { MessageBox.Show(string.Format("Unable to connect to slimserver at {0}:{1}. Please enter the correct values.", textHost.Text, textPort.Text), "Connection Error", MessageBoxButtons.OK); return; } } this.Close(); }