/// <summary> /// Launches a program to view the AGEPRO calcuation engine output file /// </summary> /// <param name="outfile">AGEPRO calcuation engine output file</param> /// <param name="outputOptions"></param> static void LaunchOutputViewerProgram(string outfile, ControlMiscOptions outputOptions) { if (string.IsNullOrEmpty(outfile)) { throw new ArgumentException($"'{nameof(outfile)}' cannot be null or empty.", nameof(outfile)); } if (outputOptions is null) { throw new ArgumentNullException(nameof(outputOptions)); } if (outputOptions.AgeproOutputViewer == "System Default") { //open a program that is associated by its file type. //If no association exists, system will ask user for a program. _ = Process.Start(outfile); } else if (outputOptions.AgeproOutputViewer == "Notepad") { _ = Process.Start("notepad.exe", outfile); } }
public AgeproCalculationLauncher(ControlMiscOptions options) { AgeproUserOptions = options; }
/// <summary> /// Initiates the Control's "Startup State" or the "Uninitialized Model" phase. /// </summary> protected void SetupStartupState() { //AGEPRO Input Data, If any inputData = new AgeproInputFile(); //Load User Controls controlGeneralOptions = new ControlGeneral(); controlMiscOptions = new ControlMiscOptions(); controlBootstrap = new ControlBootstrap(); controlFisherySelectivity = new ControlStochasticAge(); controlDiscardFraction = new ControlStochasticAge(); controlNaturalMortality = new ControlStochasticAge(); controlBiological = new ControlBiological(new string[] { string.Empty }); controlJan1Weight = new ControlStochasticWeightAge(new int[] { 0, 1 }); controlSSBWeight = new ControlStochasticWeightAge(new int[] { 0, 1, -1 }); controlMidYearWeight = new ControlStochasticWeightAge(new int[] { 0, 1, -1, -2 }); controlCatchWeight = new ControlStochasticWeightAge(new int[] { 0, 1, -1, -2, -3 }); controlDiscardWeight = new ControlStochasticWeightAge(new int[] { 0, 1, -1, -2, -3, -4 }); controlRecruitment = new ControlRecruitment(); controlHarvestScenario = new ControlHarvestScenario(); //Set General Options Controls (to handle "New Cases") controlGeneralOptions.GeneralInputFile = ""; controlGeneralOptions.GeneralModelId = "untitled"; inputData.General.InputFile = ""; inputData.CaseID = controlGeneralOptions.GeneralModelId; //initially set Number of Ages _ = controlGeneralOptions.GeneralFirstAgeClass; //Spinbox Value //Biological Stochastic Options controlFisherySelectivity.StochasticParameterLabel = "Fishery Selectivity"; controlFisherySelectivity.IsMultiFleet = true; controlFisherySelectivity.FleetDependency = StochasticAgeFleetDependency.dependent; controlDiscardFraction.StochasticParameterLabel = "Discard Fraction"; controlDiscardFraction.IsMultiFleet = true; controlDiscardFraction.FleetDependency = StochasticAgeFleetDependency.dependent; controlNaturalMortality.StochasticParameterLabel = "Natural Mortality"; controlNaturalMortality.IsMultiFleet = false; controlNaturalMortality.FleetDependency = StochasticAgeFleetDependency.independent; //Weight Age Options controlJan1Weight.IsMultiFleet = false; controlJan1Weight.FleetDependency = StochasticAgeFleetDependency.independent; controlSSBWeight.IsMultiFleet = false; controlSSBWeight.FleetDependency = StochasticAgeFleetDependency.independent; controlMidYearWeight.IsMultiFleet = false; controlMidYearWeight.FleetDependency = StochasticAgeFleetDependency.independent; controlCatchWeight.IsMultiFleet = true; controlCatchWeight.FleetDependency = StochasticAgeFleetDependency.dependent; controlDiscardWeight.IsMultiFleet = true; controlDiscardWeight.FleetDependency = StochasticAgeFleetDependency.dependent; //Set WeightAgeType controlJan1Weight.WeightAgeType = StochasticWeightOfAge.Jan1Weight; controlSSBWeight.WeightAgeType = StochasticWeightOfAge.SSBWeight; controlMidYearWeight.WeightAgeType = StochasticWeightOfAge.MidYearWeight; controlCatchWeight.WeightAgeType = StochasticWeightOfAge.CatchWeight; controlDiscardWeight.WeightAgeType = StochasticWeightOfAge.DiscardWeight; //Weights Option controlJan1Weight.ShowJan1WeightsOption = false; controlJan1Weight.ShowSSBWeightsOption = false; controlJan1Weight.showMidYearWeightsOption = false; controlJan1Weight.ShowCatchWeightsOption = false; //SSB controlSSBWeight.ShowSSBWeightsOption = false; controlSSBWeight.showMidYearWeightsOption = false; controlSSBWeight.ShowCatchWeightsOption = false; //Mid-Year controlMidYearWeight.showMidYearWeightsOption = false; controlMidYearWeight.ShowCatchWeightsOption = false; //Catch-weight controlCatchWeight.ShowCatchWeightsOption = false; }