Exemplo n.º 1
0
        internal void RenameFocusItem()
        {
            Demo4.Item temp = this.GetCurrentSelectedItem();
            if (temp != null) //Rename item dang duoc focus
            {
                var a = Microsoft.VisualBasic.Interaction.InputBox(MultiLanguage.GetText("btnRename_text"), MultiLanguage.GetText("NewName_text"), temp.StrName + temp.StrExt);

                if (a != "")
                {
                    ItemsViewer ParentForm = (ItemsViewer)this.Parent.Parent.Parent;

                    if (temp.GetType() == typeof(MyFile))
                    {
                        if (new FileInfo(ParentForm.StrCurrentPath + a).Exists == true)
                        {
                            MessageBox.Show(MultiLanguage.GetText("file_exist"), MultiLanguage.GetText("error_text"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            new FileInfo(ParentForm.StrCurrentPath + temp.StrName + temp.StrExt).MoveTo(ParentForm.StrCurrentPath + a);
                        }
                    }
                    else
                    {
                        if (new DirectoryInfo(ParentForm.StrCurrentPath + a + "\\").Exists == true)
                        {
                            MessageBox.Show(MultiLanguage.GetText("folder_exist"), MultiLanguage.GetText("error_text"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            new DirectoryInfo(ParentForm.StrCurrentPath + temp.StrName + "\\").MoveTo(ParentForm.StrCurrentPath + a + "\\");
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show(MultiLanguage.GetText("no_item_selected"), MultiLanguage.GetText("error_text"), MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 2
0
 internal void MultiRename()
 {
     if (selectedItems.Count == 0)
     {
         Demo4.Item temp = GetCurrentSelectedItem();
         if (temp != null) //Rename item dang duoc focus
         {
             List <Item> tempList = new List <Item>();
             tempList.Add(temp);
             Demo4.RenameTool renametool = new Demo4.RenameTool(tempList);
             renametool.Show();
         }
         else
         {
             MessageBox.Show(MultiLanguage.GetText("no_item_selected"), MultiLanguage.GetText("error_text"), MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     else //Rename tu selectedList
     {
         Demo4.RenameTool renametool = new Demo4.RenameTool(selectedItems.Values.ToList());
         renametool.Show();
     }
 }