コード例 #1
0
ファイル: MainForm.cs プロジェクト: vitroums/inzynierka
        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;
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: vitroums/inzynierka
        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;
        }