예제 #1
0
 private void BTN_SaveConfig_Click(object sender, RoutedEventArgs e)
 {
     if (project != null)
     {
         project.Save();
         System.Windows.MessageBox.Show("目前設定已儲存。", "Info");
     }
     else
     {
         System.Windows.MessageBox.Show("目前無設定檔...!", "Error");
     }
 }
예제 #2
0
        private void BTN_Execution_Click(object sender, RoutedEventArgs e)
        {
            TBX_SourceFolder.Text = TBX_SourceFolder.Text.TrimEnd('\\');
            TBX_TargetFolder.Text = TBX_TargetFolder.Text.TrimEnd('\\');
            //Check Data Correct
            if (!Directory.Exists(TBX_SourceFolder.Text))
            {
                System.Windows.MessageBox.Show("來源路徑不存在,請重新設定", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            if (!Directory.Exists(TBX_TargetFolder.Text))
            {
                System.Windows.MessageBox.Show("目的路徑不存在,請重新設定", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            if (TBX_TargetFolder.Text == TBX_SourceFolder.Text)
            {
                System.Windows.MessageBox.Show("來源路徑 與 目的路徑 相同,請重新設定", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            //Take off redoundent SPACE.
            string[] imageFileExts = TBX_ImageExtends.Text.Replace(" ", null).ToLower().Split(',');
            string[] videoFileExts = TBX_VideoExtends.Text.Replace(" ", null).ToLower().Split(',');
            TBX_ImageExtends.Text = string.Join(", ", project.imageFileExts);
            TBX_VideoExtends.Text = string.Join(", ", project.videoFileExts);

            List <string> fstruct = new List <string>()
            {
                CBX_Level1.Text, CBX_Level2.Text, CBX_Level3.Text
            };

            //建立專案
            project = new UserProject()
            {
                sourceRootPathname = TBX_SourceFolder.Text,
                targetRootPathname = TBX_TargetFolder.Text,
                imageFileExts      = imageFileExts,
                videoFileExts      = videoFileExts,
                fAction            = (UserProject.FileAction)CBX_FileAct.SelectedIndex,
                folderStructure    = fstruct.ToArray(),
                isRename           = (CBX_FileRenameAsCopyMove.IsEnabled && CBX_FileRenameAsCopyMove.IsChecked == true),
                isTheSameContentByComparedBinary = (CBX_CHKBinary.IsEnabled && CBX_CHKBinary.IsChecked == true),
                isContentConfirmByComparedBinary = (CBX_ReCHKBinary.IsEnabled && CBX_ReCHKBinary.IsChecked == true),
                isAddInfoFile = (CBX_AddInfoFileAsCopyMove.IsEnabled && CBX_AddInfoFileAsCopyMove.IsChecked == true)
            };
            project.Save(); //紀錄

            if (project.isContentConfirmByComparedBinary && project.fAction == UserProject.FileAction.Move)
            {
                if (System.IO.Path.GetPathRoot(project.sourceRootPathname) == System.IO.Path.GetPathRoot(project.targetRootPathname))
                {
                    project.isContentConfirmByComparedBinary = false;
                }
                else
                {
                    //Change "project.fAction" to Copy + Delete.
                    project.fAction = UserProject.FileAction.CopyThenDelete;
                }
            }
            //執行
            ProcessWindow pw = new ProcessWindow()
            {
                project = project
            };

            pw.ShowDialog();
        }