Exemplo n.º 1
0
        private void m_buttonAddUser_Click(object sender, System.EventArgs e)
        {
            NewUserForm form = new NewUserForm();

            if (form.ShowDialog() == DialogResult.OK)
            {
                if (form.UserName.Length == 0)
                {
                    MessageBox.Show("User name was blank", "CSFtp", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                if (Assemblies.Ftp.UserData.Get().HasUser(form.UserName))
                {
                    MessageBox.Show("User already exists", "CSFtp", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                Assemblies.Ftp.UserData.Get().AddUser(form.UserName);

                string [] asRow = new string[2];
                asRow[0] = form.UserName;
                asRow[1] = "C:\\";
                ListViewItem itemNew = m_listViewUsers.Items.Add(new System.Windows.Forms.ListViewItem(asRow));
                m_listViewUsers.SelectedItems.Clear();
                itemNew.Selected = true;
            }
        }
Exemplo n.º 2
0
        private void m_buttonAddUser_Click(object sender, System.EventArgs e)
        {
            NewUserForm form = new NewUserForm();

            if (form.ShowDialog() == DialogResult.OK)
            {
                if (form.UserName.Length == 0)
                {
                    MessageBox.Show("User name was blank", "CSFtp", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                if (Assemblies.Ftp.UserData.Get().HasUser(form.UserName))
                {
                    MessageBox.Show("User already exists", "CSFtp", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                Assemblies.Ftp.UserData.Get().AddUser(form.UserName);

                string [] asRow = new string[2];
                asRow[0] = form.UserName;
                asRow[1] = "C:\\";
                ListViewItem itemNew = m_listViewUsers.Items.Add(new System.Windows.Forms.ListViewItem(asRow));
                m_listViewUsers.SelectedItems.Clear();
                itemNew.Selected = true;
            }
        }