Example #1
0
        void Start(bool showCommandLineOnly)
        {
            if (_action == SortFilesAction.SyncFiles &&
                !checkPreview.Checked && !showCommandLineOnly &&
                !Utils.AskToConfirm("Are you sure you want to synchronize these files?"))
            {
                return;
            }

            _mruHistoryLeft.AddToHistory(cmbLeftDir.Text);
            _mruHistoryRight.AddToHistory(cmbRightDir.Text);
            RefreshComboListItems();

            txtShowRobo.Text = "";
            var settings = FillFromUI();

            if (settings == null)
            {
                return;
            }

            if (_action == SortFilesAction.SyncFiles)
            {
                if (showCommandLineOnly)
                {
                    var args = SyncFilesWithRobocopy.GetFullArgs(settings);
                    txtShowRobo.Text = args;
                }
                else
                {
                    Utils.RunLongActionInThread(_lock, this, () =>
                    {
                        SyncFilesWithRobocopy.Go(settings);
                    });
                }
            }
            else
            {
                this.Visible = false;
                using (var childForm = new FormSortFilesList(
                           _action, settings, lblAction.Text, false))
                {
                    childForm.ShowDialog();
                }

                this.Close();
            }
        }