예제 #1
0
        private int GetSetsNumber(int lowestNumberOfSets)
        {
            string stringInstancesSetsNumber = null;

            int intInstancesSetsNumber = -1;

            try
            {
                stringInstancesSetsNumber = txtInstancesSetsNumber.Text;
                intInstancesSetsNumber    = BPMGeneratorMethods.ParseStringToInteger(stringInstancesSetsNumber, txbInstancesSetsNumber, lowestNumberOfSets);
            }
            catch (FormatException fex)
            {
                MessageBox.Show(fex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            return(intInstancesSetsNumber);
        }
예제 #2
0
        private async Task GenerateWithCustomRangeAsync(int SetsNumber)
        {
            btnGenerate.IsEnabled = false;

            await Task.Run(() =>
            {
                string stringNumberOfJobs          = "";
                string stringMachineCapacity       = "";
                string stringJobProcessingTimeFrom = "";
                string stringJobProcessingTimeTo   = "";
                string stringJobSizeFrom           = "";
                string stringJobSizeTo             = "";

                this.Dispatcher.Invoke((Action) delegate
                {
                    stringNumberOfJobs    = txtNumOfJobs.Text;
                    stringMachineCapacity = txtMachineCapacity.Text;

                    stringJobProcessingTimeFrom = txtJobProcTimeFrom.Text;
                    stringJobProcessingTimeTo   = txtJobProcTimeTo.Text;

                    stringJobSizeFrom = txtJobSizeFrom.Text;
                    stringJobSizeTo   = txtJobSizeTo.Text;
                });

                int lowestPossibleNum = 1;

                try
                {
                    generationArgs.NumberOfJobs    = BPMGeneratorMethods.ParseStringToInteger(stringNumberOfJobs, txbNumOfJobs, lowestPossibleNum);
                    generationArgs.MachineCapacity = BPMGeneratorMethods.ParseStringToInteger(stringMachineCapacity, txbMachineCapacity, lowestPossibleNum);

                    generationArgs.JobProcessingTimeFrom = BPMGeneratorMethods.ParseStringToInteger(stringJobProcessingTimeFrom, txbJobProcTime, lowestPossibleNum);
                    generationArgs.JobProcessingTimeTo   = BPMGeneratorMethods.ParseStringToInteger(stringJobProcessingTimeTo, txbJobProcTime, lowestPossibleNum);

                    generationArgs.JobSizeFrom = BPMGeneratorMethods.ParseStringToInteger(stringJobSizeFrom, txbJobSize, lowestPossibleNum);
                    generationArgs.JobSizeTo   = BPMGeneratorMethods.ParseStringToInteger(stringJobSizeTo, txbJobSize, lowestPossibleNum);
                }
                catch (FormatException fex)
                {
                    MessageBox.Show(fex.Message);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }

                this.Dispatcher.Invoke((Action) delegate
                {
                    txtStatus.Text = BPMGeneratorMethods.UpdateStatusWithGenArgsAndSaveDirectory(generationArgs, _saveDirectory);
                });

                allGeneratedBenchmarks.Clear();
                for (int i = 0; i < SetsNumber; i++)
                {
                    GenerateAndAddBencharkInstanceToList(generationArgs);
                }

                PrintAllGeneratedBenchmarksToFile();

                this.Dispatcher.Invoke((Action) delegate
                {
                    txtStatus.Text = BPMGeneratorMethods.UpdateStatusAsSuccessful(txtStatus);
                });
            });

            btnGenerate.IsEnabled = true;
        }