private async void connectToGroupButton_Click(object sender, EventArgs e) { Cursor = Cursors.WaitCursor; DisableAll(); var statusLabel = new ToolStripStatusLabel("Connecting to group"); statusBar.Items.Add(statusLabel); try { using (var passwordForm = new PasswordForm()) { passwordForm.ShowDialog(); if (passwordForm.DialogResult == DialogResult.OK) { var password = passwordForm.Password; var selectedGroup = groupsListBox.SelectedItem as Group; if (Hasher.HashMD5String(password).Equals(selectedGroup.Password, StringComparison.OrdinalIgnoreCase)) { await ConnectToGroup(selectedGroup.Name); var message = string.Format("You are now connected to gropup {0}", selectedGroup.Name); MessageBox.Show(message, "Connection sucessfull", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Typed password is wrong", "Wrong password", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } } catch (CloudException cloud) { MessageBox.Show(cloud.Message, "Cloud problem", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } catch (Exception) { MessageBox.Show("Unexcepted error occured. Click OK to contiune", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } EnableIdentity(); EnableGroups(); if (_connectedToGroup) { EnableUsers(); EnabledFiles(); } statusBar.Items.Remove(statusLabel); Cursor = Cursors.Arrow; }
private async void connectToGroupButton_Click(object sender, EventArgs e) { Cursor = Cursors.WaitCursor; DisableAll(); var statusLabel = new ToolStripStatusLabel("Connecting to group"); statusBar.Items.Add(statusLabel); try { using (var passwordForm = new PasswordForm()) { passwordForm.ShowDialog(); if (passwordForm.DialogResult == DialogResult.OK) { var password = passwordForm.Password; var selectedGroup = groupsListBox.SelectedItem as Group; if (Hasher.HashMD5String(password).Equals(selectedGroup.Password, StringComparison.OrdinalIgnoreCase)) { await ConnectToGroup(selectedGroup.Name); var message = string.Format("You are now connected to gropup {0}", selectedGroup.Name); MessageBox.Show(message, "Connection sucessfull", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Typed password is wrong", "Wrong password", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } } catch(CloudException cloud) { MessageBox.Show(cloud.Message, "Cloud problem", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } catch(Exception) { MessageBox.Show("Unexcepted error occured. Click OK to contiune", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } EnableIdentity(); EnableGroups(); if (_connectedToGroup) { EnableUsers(); EnabledFiles(); } statusBar.Items.Remove(statusLabel); Cursor = Cursors.Arrow; }