Exemplo n.º 1
0
        private async void newGroupButton_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            DisableAll();
            var statusLabel = new ToolStripStatusLabel("Creating new group");

            statusBar.Items.Add(statusLabel);

            using (var newGroupForm = new NewGroupForm())
            {
                if (newGroupForm.ShowDialog() == DialogResult.OK)
                {
                    var newGroupInfo = newGroupForm.NewGroupInfo;
                    try
                    {
                        await ServerTransaction.CreateNewGroup(newGroupInfo, _certificate);

                        var message = string.Format("Group {0} created", newGroupInfo.Name);
                        MessageBox.Show(message, "New group");
                        await UpdateGroupList();
                    }
                    catch (UnknownCommadError error)
                    {
                        MessageBox.Show(error.Message);
                    }
                    catch (ServerResponseError error)
                    {
                        MessageBox.Show(error.Message);
                    }
                    catch (AuthenticationError error)
                    {
                        MessageBox.Show(error.Message);
                    }
                    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;
        }
Exemplo n.º 2
0
        private async void newGroupButton_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            DisableAll();
            var statusLabel = new ToolStripStatusLabel("Creating new group");
            statusBar.Items.Add(statusLabel);

            using (var newGroupForm = new NewGroupForm())
            {
                if (newGroupForm.ShowDialog() == DialogResult.OK)
                {
                    var newGroupInfo = newGroupForm.NewGroupInfo;
                    try
                    {
                        await ServerTransaction.CreateNewGroup(newGroupInfo, _certificate);
                        var message = string.Format("Group {0} created", newGroupInfo.Name);
                        MessageBox.Show(message, "New group");
                        await UpdateGroupList();
                    }
                    catch (UnknownCommadError error)
                    {
                        MessageBox.Show(error.Message);
                    }
                    catch (ServerResponseError error)
                    {
                        MessageBox.Show(error.Message);
                    }
                    catch (AuthenticationError error)
                    {
                        MessageBox.Show(error.Message);
                    }
                    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;
        }