Ejemplo n.º 1
0
        private void 更改文件名ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count > 0)
            {
                ListViewItem item = listView1.SelectedItems[0];
                YmlFile      file = (YmlFile)item.Tag;

                string    oldName = file.localName;
                string    msg     = "请输入文件的新名称";
                InputForm form    = new InputForm(msg, oldName, new InputForm.FormResult((newName) =>
                {
                    if (oldName != newName)
                    {
                        file.localName = newName;
                        string dirs    = file.remotePath;
                        string path1   = dirs + Utils.getLinuxName(oldName);
                        string path2   = dirs + Utils.getLinuxName(newName);
                        monitorForm.RunShell(string.Format("mv {0} {1}", path1, path2), false, true);

                        file.remoteName = file.localName;
                        item.Text       = file.localName;
                    }
                }));
                form.ShowDialog(this);
            }
        }