/// <summary> /// Connects this client to a storage /// </summary> /// <param name="storage">The storage to connect too</param> public void Connect(Storage storage) { if (this.ConnectedTo != null) { ConsoleHelper.WriteLine("Disconnecting from " + this.ConnectedTo.ID, ConsoleColor.Green); } this.ConnectedTo = storage; this.ConnectedTo.LogConnected(this); ConsoleHelper.WriteLine("Connected to " + storage.ID, ConsoleColor.Green); }
private void UpdateListBox(Storage storage) { lblStorageName.Text = storage.ID; lbFiles.Items.Clear(); foreach (File f in storage.Files) { lbFiles.Items.Add(f.Name); } }
/// <summary> /// Disconnects the client from its connected storage /// </summary> public void Disconnect() { if (this.ConnectedTo == null) { ConsoleHelper.WriteLine("Not connected to a storage", Controller.DefaultErrorColor); return; } ConsoleHelper.WriteLine("Disconnecting from " + this.ConnectedTo.ID, ConsoleColor.Green); this.ConnectedTo.LogDisconnected(this); this.ConnectedTo = null; ConsoleHelper.WriteLine("Disconnected succesfully" , ConsoleColor.Green); }