/// ------------------------------------------------------------------------------------
        /// <summary>
        /// Handles creating new sessions from the selected files.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void HandleCreateSessionsButtonClick(object sender, EventArgs e)
        {
            Hide();

            _mediaPlayerViewModel.Stop(true);

            var pairs = _viewModel.GetUniqueSourceAndDestinationPairs().ToArray();

            if (pairs.Length == 0)
            {
                return;
            }

            var model = new CopyFilesViewModel(pairs);

            model.BeforeFileCopiedAction = _viewModel.CreateSingleSession;

            model.FileCopyFailedAction = (srcFile, dstFile) =>
            {
                if (File.Exists(dstFile))
                {
                    File.Delete(dstFile);
                }
            };

            var caption = LocalizationManager.GetString(
                "DialogBoxes.NewSessionsFromFilesDlg.CreatingSessions.ProgressDlg.Caption",
                "Creating Sessions");

            using (var dlg = new ProgressDlg(model, caption))
            {
                dlg.StartPosition = FormStartPosition.CenterScreen;
                dlg.ShowDialog();
            }
        }
Example #2
0
        /// ------------------------------------------------------------------------------------
        public static void Copy(string srcFile, string dstFile, bool overwrite)
        {
            var model = new CopyFilesViewModel(
                new[] { new KeyValuePair <string, string>(srcFile, dstFile) }, overwrite);

            model.DoCopying(null, null);
        }