private void ActivateSelectedClientAndRefreshView() { try { ClientBase client = listBox1.SelectedItem as ClientBase; ActiveClient = client; if (client != null) { client.Activate(); RefreshClientView(); } else { this.Hide(); } } catch (Exception ex) { Debug.WriteLine(ex.Message); Debug.WriteLine(ex.StackTrace); } }