Exemple #1
0
        private void AddBarrelRecipe()
        {
            frmBarrelLoadDev lfrmSC = new frmBarrelLoadDev(_BarrelID);

            lfrmSC.ShowDialog();
            SelectedRecipe = new Recipe();
            if (lfrmSC.SelectedCartridgeName == null)
            {
                return;
            }
            string lbullet             = lfrmSC.SelectedBulletName;
            string lCaseName           = lfrmSC.SelectedCaseName;
            string lPwdrNm             = lfrmSC.SelectedPowderName;
            string lPrmrName           = lfrmSC.SelectedPrimerName;
            double lCaseNeckClearance  = lfrmSC.CaseNeckClearance;
            double lHeadSpaceClearance = lfrmSC.HeadSpaceClearance;

            lfrmSC = null;
            //TODO: check for null return on all class gets and exit if a null is returned.
            SelectedRecipe.RecpCartridge  = _Barrel.ParentCartridge;
            SelectedRecipe.CartridgeID    = SelectedRecipe.RecpCartridge.ID;
            SelectedRecipe.RecpBullet     = LawlerBallisticsFactory.GetBulletFromInfo(lbullet);
            SelectedRecipe.BulletID       = SelectedRecipe.RecpBullet.ID;
            SelectedRecipe.RecpCase       = LawlerBallisticsFactory.GetCaseFromName(lCaseName);
            SelectedRecipe.CaseID         = SelectedRecipe.RecpCase.ID;
            SelectedRecipe.CaseTrimLength = _Barrel.NeckDepth - lCaseNeckClearance;
            SelectedRecipe.HeadSpace      = _Barrel.HeadSpace - lHeadSpaceClearance;
            SelectedRecipe.RecpPowder     = LawlerBallisticsFactory.GetPowderFromName(lPwdrNm);
            SelectedRecipe.PowderID       = SelectedRecipe.RecpPowder.ID;
            SelectedRecipe.RecpPrimer     = LawlerBallisticsFactory.GetPrimerFromName(lPrmrName);
            SelectedRecipe.PrimerID       = SelectedRecipe.RecpPrimer.ID;
            SelectedRecipe.Name           = "LoadRecipe_" + (LawlerBallisticsFactory.MyRecipes.Count + 1).ToString();
            _frmLoadRecipe = new frmRecipe(true, true);
            _frmLoadRecipe.Show();
        }
        private void AddSAMMIRecipe()
        {
            frmSAAMI_LoadDev lfrmSC = new frmSAAMI_LoadDev();

            lfrmSC.ShowDialog();
            SelectedRecipe = new Recipe();
            if (lfrmSC.SelectedCartridgeName == null)
            {
                return;
            }
            string lcn       = lfrmSC.SelectedCartridgeName;
            string lbullet   = lfrmSC.SelectedBulletName;
            string lCaseName = lfrmSC.SelectedCaseName;
            string lPwdrNm   = lfrmSC.SelectedPowderName;
            string lPrmrName = lfrmSC.SelectedPrimerName;

            lfrmSC = null;
            //TODO: check for null return on all class gets and exit if a null is returned.
            SelectedRecipe.RecpCartridge  = LawlerBallisticsFactory.GetCartridgeFromName(lcn);
            SelectedRecipe.CartridgeID    = SelectedRecipe.RecpCartridge.ID;
            SelectedRecipe.RecpBullet     = LawlerBallisticsFactory.GetBulletFromInfo(lbullet);
            SelectedRecipe.BulletID       = SelectedRecipe.RecpBullet.ID;
            SelectedRecipe.RecpCase       = LawlerBallisticsFactory.GetCaseFromName(lCaseName);
            SelectedRecipe.CaseID         = SelectedRecipe.RecpCase.ID;
            SelectedRecipe.CaseTrimLength = SelectedRecipe.RecpCartridge.CaseTrimLngth;
            SelectedRecipe.HeadSpace      = ((SelectedRecipe.RecpCartridge.HeadSpaceMax -
                                              SelectedRecipe.RecpCartridge.HeadSpaceMin) / 2) + SelectedRecipe.RecpCartridge.HeadSpaceMin;
            SelectedRecipe.COAL       = SelectedRecipe.RecpCartridge.MaxCOAL;
            SelectedRecipe.RecpPowder = LawlerBallisticsFactory.GetPowderFromName(lPwdrNm);
            SelectedRecipe.PowderID   = SelectedRecipe.RecpPowder.ID;
            SelectedRecipe.RecpPrimer = LawlerBallisticsFactory.GetPrimerFromName(lPrmrName);
            SelectedRecipe.PrimerID   = SelectedRecipe.RecpPrimer.ID;
            SelectedRecipe.Name       = "LoadRecipe_" + (LawlerBallisticsFactory.MyRecipes.Count + 1).ToString();
            _frmLoadRecipe            = new frmRecipe(true, false);
            _frmLoadRecipe.Show();
        }