예제 #1
0
        private void btnRename_Click(object sender, EventArgs e)
        {
            if (this.listView1.SelectedItems.Count > 0)
            {
                PyFile f = this.listView1.SelectedItems[0].Tag as PyFile;
                if (f != null)
                {
                    int         i = this.listView1.SelectedItems[0].Index;
                    InputDialog d = new InputDialog();
                    d.Text        = "Rename";
                    d.label1.Text = "New name:";
                    if (d.ShowDialog() == DialogResult.OK)
                    {
                        ResultStatus res = this.Port.Rename(f.FileName, d.textBox1.Text);
                        if (res.Result == ResultStatus.Statuses.Error)
                        {
                            Helpers.ErrorBox(res);
                        }
                        else
                        {
                            this.Fill();

                            foreach (ListViewItem item in this.listView1.Items)
                            {
                                item.Selected = (item.Tag is PyFile && (item.Tag as PyFile).FileName == d.textBox1.Text);
                            }
                        }
                    }
                    d.Dispose();
                }
            }
        }
예제 #2
0
        private void bntMkDir_Click(object sender, EventArgs e)
        {
            InputDialog d = new InputDialog();

            d.Text        = "MkDir";
            d.label1.Text = "Directory name:";
            if (d.ShowDialog() == DialogResult.OK)
            {
                ResultStatus res = this.Port.MkDir(d.textBox1.Text);
                if (res.Result == ResultStatus.Statuses.Error)
                {
                    Helpers.ErrorBox(res);
                }
                else
                {
                    this.Fill();
                }
            }
            d.Dispose();
        }