Example #1
0
        public void MoveToDirectory(ListView list, bool left)
        {
            string currentPath;

            if (left)
            {
                currentPath = CurrentPath1;
            }
            else
            {
                currentPath = CurrentPath2;
            }
            for (int i = 0; i < list.Items.Count; i++)
            {
                if (list.Items[i].ImageIndex == 1)
                {
                    string name;
                    if (list.Items[i].Text.LastIndexOf(".") == -1)
                    {
                        name = "withoutExtension";
                    }
                    else
                    {
                        name = list.Items[i].Text.Substring(list.Items[i].Text.LastIndexOf(".") + 1);
                    }
                    Folder folder = new Folder(currentPath + "\\" + name);
                    if (!folder.isExist())
                    {
                        Directory.CreateDirectory(currentPath + "\\" + name);
                    }
                    CommonFile comFile = new CommonFile(currentPath + "\\" + list.Items[i].Text);
                    comFile.Move(currentPath + "\\" + name);
                }
            }
        }
Example #2
0
        public void Move(ListView list, bool left)
        {
            string CurrentPath;

            if (left)
            {
                CurrentPath = currentPath1;
            }
            else
            {
                CurrentPath = currentPath2;
            }
            if (list.SelectedItems.Count > 0)
            {
                foreach (int i in list.SelectedIndices)
                {
                    if (list.Items[i].ImageIndex == 0)
                    {
                        Folder folder = new Folder(CurrentPath + "\\" + list.Items[i].Text);
                        if (left)
                        {
                            folder.Move(currentPath2);
                        }
                        else
                        {
                            folder.Move(currentPath1);
                        }
                    }
                    else
                    {
                        CommonFile file = new CommonFile(CurrentPath + "\\" + list.Items[i].Text);
                        if (left)
                        {
                            file.Move(currentPath2);
                        }
                        else
                        {
                            file.Move(currentPath1);
                        }
                    }
                }
            }
        }
Example #3
0
        public void Move(ListView list, bool left)
        {
            string currentPath;

            if (left)
            {
                currentPath = currentPath1;
            }
            else
            {
                currentPath = currentPath2;
            }
            if (list.SelectedItems.Count > 0)
            {
                foreach (int i in list.SelectedIndices)
                {
                    if (list.Items[i].ImageIndex == 0)
                    {
                        Folder folder = new Folder(currentPath + "\\" + list.Items[i].Text);
                        if (left)
                        {
                            if (!Directory.Exists(currentPath2 + "\\" + list.Items[i].Text))
                            {
                                folder.Move(currentPath2);
                                director.MoveReport(currentPath + "\\" + list.Items[i].Text, currentPath2 + "\\" + list.Items[i].Text);
                                director.BuildReport();
                                reports.Add(director.GetReportItem());
                            }
                            else
                            {
                                MessageBox.Show("The folder is already exists", "Error");
                            }
                        }
                        else
                        {
                            if (!Directory.Exists(currentPath1 + "\\" + list.Items[i].Text))
                            {
                                folder.Move(currentPath1);
                                director.MoveReport(currentPath + "\\" + list.Items[i].Text, currentPath1 + "\\" + list.Items[i].Text);
                                director.BuildReport();
                                reports.Add(director.GetReportItem());
                            }
                            else
                            {
                                MessageBox.Show("The folder is already exists", "Error");
                            }
                        }
                    }
                    else
                    {
                        CommonFile file = new CommonFile(currentPath + "\\" + list.Items[i].Text);
                        if (left)
                        {
                            if (!File.Exists(currentPath2 + "\\" + list.Items[i].Text))
                            {
                                file.Move(currentPath2);
                                director.MoveReport(currentPath + "\\" + list.Items[i].Text, currentPath2 + "\\" + list.Items[i].Text);
                                director.BuildReport();
                                reports.Add(director.GetReportItem());
                            }
                            else
                            {
                                MessageBox.Show("The file is already exists", "Error");
                            }
                        }
                        else
                        {
                            if (!File.Exists(currentPath1 + "\\" + list.Items[i].Text))
                            {
                                file.Move(currentPath1);
                                director.MoveReport(currentPath + "\\" + list.Items[i].Text, currentPath1 + "\\" + list.Items[i].Text);
                                director.BuildReport();
                                reports.Add(director.GetReportItem());
                            }
                            else
                            {
                                MessageBox.Show("The file is already exists", "Error");
                            }
                        }
                    }
                }
            }
        }