예제 #1
0
 private void RunBatchEdit(StringInstructionSet[] sets, string source, string destination)
 {
     editor = new Core.BatchEditor();
     b      = new BackgroundWorker {
         WorkerReportsProgress = true
     };
     b.DoWork += (sender, e) =>
     {
         if (RB_Boxes.Checked)
         {
             RunBatchEditSaveFile(sets, boxes: true);
         }
         else if (RB_Party.Checked)
         {
             RunBatchEditSaveFile(sets, party: true);
         }
         else
         {
             RunBatchEditFolder(sets, source, destination);
         }
     };
     b.ProgressChanged    += (sender, e) => SetProgressBar(e.ProgressPercentage);
     b.RunWorkerCompleted += (sender, e) =>
     {
         string result = editor.GetEditorResults(sets);
         WinFormsUtil.Alert(result);
         FLP_RB.Enabled = RTB_Instructions.Enabled = B_Go.Enabled = true;
         SetupProgressBar(0);
     };
     b.RunWorkerAsync();
 }
예제 #2
0
        private void RunBatchEdit(StringInstructionSet[] sets, string source, string destination)
        {
            editor = new Core.BatchEditor();
            bool finished = false; // hack cuz DoWork event isn't cleared after completion

            b.DoWork += (sender, e) =>
            {
                if (finished)
                {
                    return;
                }
                if (RB_Boxes.Checked)
                {
                    RunBatchEditSaveFile(sets, boxes: true);
                }
                else if (RB_Party.Checked)
                {
                    RunBatchEditSaveFile(sets, party: true);
                }
                else
                {
                    RunBatchEditFolder(sets, source, destination);
                }
                finished = true;
            };
            b.ProgressChanged    += (sender, e) => SetProgressBar(e.ProgressPercentage);
            b.RunWorkerCompleted += (sender, e) =>
            {
                string result = editor.GetEditorResults(sets);
                WinFormsUtil.Alert(result);
                FLP_RB.Enabled = RTB_Instructions.Enabled = B_Go.Enabled = true;
                SetupProgressBar(0);
            };
            b.RunWorkerAsync();
        }