コード例 #1
0
        public override void Init()
        {
            dataGridViewSynthesis.MakeDoubleBuffered();
            extCheckBoxWordWrap.Checked = EliteDangerousCore.DB.UserDatabase.Instance.GetSettingBool(DbWordWrap, false);
            UpdateWordWrap();
            extCheckBoxWordWrap.Click += extCheckBoxWordWrap_Click;

            Order = EliteDangerousCore.DB.UserDatabase.Instance.GetSettingString(DbOSave, "").RestoreArrayFromString(0, Recipes.SynthesisRecipes.Count);
            if (Order.Max() >= Recipes.SynthesisRecipes.Count || Order.Min() < 0 || Order.Distinct().Count() != Recipes.SynthesisRecipes.Count) // if not distinct..
            {
                for (int i = 0; i < Order.Length; i++)                                                                                          // reset
                {
                    Order[i] = i;
                }
            }

            Wanted = EliteDangerousCore.DB.UserDatabase.Instance.GetSettingString(DbWSave, "").RestoreArrayFromString(0, Recipes.SynthesisRecipes.Count);

            var rcpes = Recipes.SynthesisRecipes.Select(r => r.Name).Distinct().ToList();

            rcpes.Sort();
            rfs          = new RecipeFilterSelector(rcpes);
            rfs.Changed += FilterChanged;

            var lvls = Recipes.SynthesisRecipes.Select(r => r.level).Distinct().ToList();

            lvls.Sort();
            lfs          = new RecipeFilterSelector(lvls);
            lfs.Changed += FilterChanged;

            List <string> matLongNames = Recipes.SynthesisRecipes.SelectMany(r => r.Ingredients).Select(x => x.Name).Distinct().ToList();

            matLongNames.Sort();
            mfs          = new RecipeFilterSelector(matLongNames);
            mfs.Changed += FilterChanged;

            for (int i = 0; i < Recipes.SynthesisRecipes.Count; i++)         // pre-fill array.. preventing the crash on cell edit when you
            {
                int rno = Order[i];
                Recipes.SynthesisRecipe r = Recipes.SynthesisRecipes[rno];

                int rown = dataGridViewSynthesis.Rows.Add();

                using (DataGridViewRow row = dataGridViewSynthesis.Rows[rown])
                {
                    row.Cells[0].Value = r.Name; // debug rno + ":" + r.name;
                    row.Cells[1].Value = r.level;
                    row.Tag            = rno;
                    row.Visible        = false;
                }
            }

            isHistoric = EliteDangerousCore.DB.UserDatabase.Instance.GetSettingBool(DbHistoricMatsSave, false);

            discoveryform.OnNewEntry      += Discoveryform_OnNewEntry;
            discoveryform.OnHistoryChange += Discoveryform_OnHistoryChange;

            BaseUtils.Translator.Instance.Translate(this);
            BaseUtils.Translator.Instance.Translate(toolTip, this);
        }
コード例 #2
0
        public override void Init()
        {
            //Can use display number for it, because their names for db save are unique between engineering and synthesis.
            userControlEngineering.isEmbedded = true;
            userControlEngineering.Init(discoveryform, displaynumber);
            useHistoric = userControlEngineering.isHistoric;

            userControlSynthesis.isEmbedded = true;
            userControlSynthesis.Init(discoveryform, displaynumber);

            // so the way it works, if the panels ever re-display (for whatever reason) they tell us, and we redisplay

            showMaxInjections               = SQLiteDBClass.GetSettingBool(DbShowInjectionsSave, true);
            showPlanetMats                  = SQLiteDBClass.GetSettingBool(DbShowAllMatsLandedSave, true);
            showListAvailability            = SQLiteDBClass.GetSettingBool(DbHighlightAvailableMats, true);
            showSystemAvailability          = SQLiteDBClass.GetSettingBool(DBShowSystemAvailability, true);
            useEDSMForSystemAvailability    = SQLiteDBClass.GetSettingBool(DBUseEDSMForSystemAvailability, false);
            pictureBoxList.ContextMenuStrip = contextMenuConfig;

            userControlSynthesis.OnDisplayComplete   += Synthesis_OnWantedChange;
            userControlEngineering.OnDisplayComplete += Engineering_OnWantedChange;

            List <string> techBrokerList = Recipes.TechBrokerUnlocks.Select(r => r.name).ToList();

            tbs          = new RecipeFilterSelector(techBrokerList);
            tbs.Changed += TechBrokerSelectionChanged;
        }
コード例 #3
0
        public override void Init()
        {
            dataGridViewSynthesis.MakeDoubleBuffered();
            extCheckBoxWordWrap.Checked = GetSetting(dbWordWrap, false);
            UpdateWordWrap();
            extCheckBoxWordWrap.Click += extCheckBoxWordWrap_Click;

            RowToRecipe = GetSetting(dbOSave, "").RestoreArrayFromString(0, Recipes.SynthesisRecipes.Count);
            if (RowToRecipe.Max() >= Recipes.SynthesisRecipes.Count || RowToRecipe.Min() < 0 || RowToRecipe.Distinct().Count() != Recipes.SynthesisRecipes.Count) // if not distinct..
            {
                for (int i = 0; i < RowToRecipe.Length; i++)                                                                                                      // reset
                {
                    RowToRecipe[i] = i;
                }
            }

            WantedPerRecipe = GetSetting(dbWSave, "").RestoreArrayFromString(0, Recipes.SynthesisRecipes.Count);

            var rcpes = Recipes.SynthesisRecipes.Select(r => r.Name).Distinct().ToList();

            rcpes.Sort();
            rfs = new RecipeFilterSelector(rcpes);
            rfs.SaveSettings += (newvalue, e) => { PutSetting(dbRecipeFilterSave, newvalue); Display(); };

            var lvls = Recipes.SynthesisRecipes.Select(r => r.level).Distinct().ToList();

            lvls.Sort();
            lfs = new RecipeFilterSelector(lvls);
            lfs.SaveSettings += (newvalue, e) => { PutSetting(dbLevelFilterSave, newvalue); Display(); };

            List <string> matLongNames = Recipes.SynthesisRecipes.SelectMany(r => r.Ingredients).Select(x => x.Name).Distinct().ToList();

            matLongNames.Sort();
            mfs = new RecipeFilterSelector(matLongNames);
            mfs.SaveSettings += (newvalue, e) => { PutSetting(dbMaterialFilterSave, newvalue); Display(); };

            for (int rowno = 0; rowno < Recipes.SynthesisRecipes.Count; rowno++)         // pre-fill array.. preventing the crash on cell edit when you
            {
                int recipeno = RowToRecipe[rowno];
                Recipes.SynthesisRecipe r = Recipes.SynthesisRecipes[recipeno];

                int rown = dataGridViewSynthesis.Rows.Add();

                using (DataGridViewRow row = dataGridViewSynthesis.Rows[rown])
                {
                    row.Cells[0].Value = r.Name; // debug rno + ":" + r.name;
                    row.Cells[1].Value = r.level;
                    row.Tag            = recipeno;
                    row.Visible        = false;
                }
            }

            isHistoric = GetSetting(dbHistoricMatsSave, false);

            discoveryform.OnNewEntry      += Discoveryform_OnNewEntry;
            discoveryform.OnHistoryChange += Discoveryform_OnHistoryChange;

            BaseUtils.Translator.Instance.Translate(this);
            BaseUtils.Translator.Instance.Translate(toolTip, this);
        }
コード例 #4
0
        public override void Init()
        {
            isHistoric = GetSetting(dbHistoricMatsSave, false);

            extCheckBoxWordWrap.Checked = GetSetting(dbWordWrap, false);
            extCheckBoxWordWrap.Click  += extCheckBoxWordWrap_Click;    // install after setup

            List <string> engineers = Recipes.EngineeringRecipes.SelectMany(r => r.engineers).Distinct().ToList();

            engineers.Sort();
            efs = new RecipeFilterSelector(engineers);
            efs.AddGroupOption(string.Join(";", ItemData.ShipEngineers()), "Ship Engineers");
            efs.AddGroupOption(string.Join(";", ItemData.OnFootEngineers()), "On Foot Engineers");
            efs.AddGroupOption("Guardian;Guardian Weapons;Human;Special Effect;Suit;Weapon;", "Other Enginnering");
            efs.SaveSettings += (newvalue, e) => {
                string prevsetting = GetSetting(dbEngFilterSave, "All");
                if (prevsetting != newvalue)
                {
                    PutSetting(dbEngFilterSave, newvalue);
                    SetupDisplay();
                    UpdateDisplay();
                }
            };


            discoveryform.OnNewEntry      += Discoveryform_OnNewEntry;
            discoveryform.OnHistoryChange += Discoveryform_OnHistoryChange;
        }
コード例 #5
0
        public override void Init()
        {
            dataGridViewSynthesis.MakeDoubleBuffered();
            dataGridViewSynthesis.DefaultCellStyle.WrapMode = DataGridViewTriState.False;
            dataGridViewSynthesis.RowTemplate.Height        = 26;

            Order = SQLiteDBClass.GetSettingString(DbOSave, "").RestoreArrayFromString(0, SynthesisRecipes.Count);
            if (Order.Distinct().Count() != Order.Length)       // if not distinct..
            {
                for (int i = 0; i < Order.Length; i++)          // reset
                {
                    Order[i] = i;
                }
            }

            Wanted = SQLiteDBClass.GetSettingString(DbWSave, "").RestoreArrayFromString(0, SynthesisRecipes.Count);

            var rcpes = SynthesisRecipes.Select(r => r.name).Distinct().ToList();

            rcpes.Sort();
            rfs          = new RecipeFilterSelector(rcpes);
            rfs.Changed += FilterChanged;

            var lvls = SynthesisRecipes.Select(r => r.level).Distinct().ToList();

            lvls.Sort();
            lfs          = new RecipeFilterSelector(lvls);
            lfs.Changed += FilterChanged;

            List <string> matShortNames = SynthesisRecipes.SelectMany(r => r.ingredients).Distinct().ToList();

            matLookUp = matShortNames.Select(sn => Tuple.Create <string, string>(sn, MaterialCommodityDB.GetCachedMaterialByShortName(sn).name)).ToList();
            List <string> matLongNames = matLookUp.Select(lu => lu.Item2).ToList();

            matLongNames.Sort();
            mfs          = new RecipeFilterSelector(matLongNames);
            mfs.Changed += FilterChanged;

            for (int i = 0; i < SynthesisRecipes.Count; i++)         // pre-fill array.. preventing the crash on cell edit when you
            {
                int rno = Order[i];
                MaterialCommoditiesList.SynthesisRecipe r = SynthesisRecipes[rno];

                int rown = dataGridViewSynthesis.Rows.Add();

                using (DataGridViewRow row = dataGridViewSynthesis.Rows[rown])
                {
                    row.Cells[0].Value = r.name; // debug rno + ":" + r.name;
                    row.Cells[1].Value = r.level;
                    row.Cells[6].Value = r.ingredientsstring;
                    row.Tag            = rno;
                    row.Visible        = false;
                }
            }

            discoveryform.OnNewEntry      += Discoveryform_OnNewEntry;
            uctg.OnTravelSelectionChanged += Display;
        }
コード例 #6
0
        public override void Init()
        {
            DBBaseName = "ShoppingList";

            //Can use display number for it, because their names for db save are unique between engineering and synthesis.
            userControlEngineering.isEmbedded = true;
            userControlEngineering.DBBaseName = "SLEngineering";            // makes it unique to the SL
            userControlEngineering.Init(discoveryform, displaynumber);
            useHistoric = userControlEngineering.isHistoric;

            userControlSynthesis.isEmbedded = true;
            userControlSynthesis.DBBaseName = "SLSynthesis";            // makes it unique to the SL
            userControlSynthesis.Init(discoveryform, displaynumber);

            // so the way it works, if the panels ever re-display (for whatever reason) they tell us, and we redisplay

            showMaxInjections            = GetSetting(dbShowInjectionsSave, true);
            showPlanetMats               = GetSetting(dbShowAllMatsLandedSave, true);
            hidePlanetMatsWithNoCapacity = GetSetting(dbHideFullMatsLandedSave, false);
            showListAvailability         = GetSetting(dbHighlightAvailableMats, true);
            showSystemAvailability       = GetSetting(dbShowSystemAvailability, true);
            useEDSMForSystemAvailability = GetSetting(dbUseEDSMForSystemAvailability, false);
            HorizonalSplitContainerPos   = GetSetting(dbToggleShoppingListPosition, false);

            pictureBoxList.ContextMenuStrip = contextMenuStrip;

            userControlSynthesis.OnDisplayComplete   += Synthesis_OnWantedChange;
            userControlEngineering.OnDisplayComplete += Engineering_OnWantedChange;

            List <string> techBrokerList = Recipes.TechBrokerUnlocks.Select(r => r.Name).ToList();

            techbrokerselection = new RecipeFilterSelector(techBrokerList);
            techbrokerselection.SaveSettings += (newvalue, e) => { PutSetting(dbTechBrokerFilterSave, newvalue); Display(); };

            List <string> seList = Recipes.SpecialEffects.Select(r => r.Name).ToList();

            specialeffectsselection = new RecipeFilterSelector(seList);
            specialeffectsselection.SaveSettings += (newvalue, e) => { PutSetting(dbSpecialEffectsFilterSave, newvalue); Display(); };

            BaseUtils.Translator.Instance.Translate(this, new Control[] { userControlSynthesis, userControlEngineering });
            BaseUtils.Translator.Instance.Translate(contextMenuStrip, this);
            BaseUtils.Translator.Instance.Translate(toolTip, this);
        }
コード例 #7
0
        public override void Init()
        {
            dataGridViewEngineering.MakeDoubleBuffered();
            dataGridViewEngineering.DefaultCellStyle.WrapMode = DataGridViewTriState.False;
            dataGridViewEngineering.RowTemplate.Height        = 26;

            Order = SQLiteDBClass.GetSettingString(DbOSave, "").RestoreArrayFromString(0, EngineeringRecipes.Count);
            if (Order.Distinct().Count() != Order.Length)       // if not distinct..
            {
                for (int i = 0; i < Order.Length; i++)          // reset
                {
                    Order[i] = i;
                }
            }

            Wanted = SQLiteDBClass.GetSettingString(DbWSave, "").RestoreArrayFromString(0, EngineeringRecipes.Count);

            List <string> engineers = EngineeringRecipes.SelectMany(r => r.engineers).Distinct().ToList();

            engineers.Sort();
            efs          = new RecipeFilterSelector(engineers);
            efs.Changed += FilterChanged;

            lfs          = new RecipeFilterSelector(levels);
            lfs.Changed += FilterChanged;

            List <string> modules = EngineeringRecipes.Select(r => r.module).Distinct().ToList();

            modules.Sort();
            mfs          = new RecipeFilterSelector(modules);
            mfs.Changed += FilterChanged;

            var upgrades = EngineeringRecipes.Select(r => r.name).Distinct().ToList();

            upgrades.Sort();
            ufs          = new RecipeFilterSelector(upgrades);
            ufs.Changed += FilterChanged;

            List <string> matShortNames = EngineeringRecipes.SelectMany(r => r.ingredients).Distinct().ToList();

            matLookUp = matShortNames.Select(sn => Tuple.Create <string, string>(sn, MaterialCommodityDB.GetCachedMaterialByShortName(sn).name)).ToList();
            List <string> matLongNames = matLookUp.Select(lu => lu.Item2).ToList();

            matLongNames.Sort();
            matfs          = new RecipeFilterSelector(matLongNames);
            matfs.Changed += FilterChanged;

            for (int i = 0; i < EngineeringRecipes.Count; i++)         // pre-fill array.. preventing the crash on cell edit when you
            {
                int rno = Order[i];
                MaterialCommoditiesList.EngineeringRecipe r = EngineeringRecipes[rno];

                int             rown = dataGridViewEngineering.Rows.Add();
                DataGridViewRow row  = dataGridViewEngineering.Rows[rown];
                row.Cells[UpgradeCol.Index].Value = r.name; // debug rno + ":" + r.name;
                row.Cells[Module.Index].Value     = r.module;
                row.Cells[Level.Index].Value      = r.level;
                row.Cells[Recipe.Index].Value     = r.ingredientsstring;
                row.Cells[Engineers.Index].Value  = r.engineersstring;
                row.Tag     = rno;
                row.Visible = false;
            }

            isHistoric          = SQLiteDBClass.GetSettingBool(DbHistoricMatsSave, false);
            chkHistoric.Checked = isHistoric;
            chkHistoric.Visible = !isEmbedded;

            discoveryform.OnNewEntry      += Discoveryform_OnNewEntry;
            uctg.OnTravelSelectionChanged += Display;
        }
コード例 #8
0
        public override void Init()
        {
            dataGridViewEngineering.MakeDoubleBuffered();
            dataGridViewEngineering.DefaultCellStyle.WrapMode = DataGridViewTriState.False;

            Order = EliteDangerousCore.DB.UserDatabase.Instance.GetSettingString(DbOSave, "").RestoreArrayFromString(0, Recipes.EngineeringRecipes.Count);
            if (Order.Max() >= Recipes.EngineeringRecipes.Count || Order.Min() < 0 || Order.Distinct().Count() != Recipes.EngineeringRecipes.Count) // if not distinct..
            {
                for (int i = 0; i < Order.Length; i++)                                                                                              // reset
                {
                    Order[i] = i;
                }
            }

            Wanted = EliteDangerousCore.DB.UserDatabase.Instance.GetSettingString(DbWSave, "").RestoreArrayFromString(0, Recipes.EngineeringRecipes.Count);

            List <string> engineers = Recipes.EngineeringRecipes.SelectMany(r => r.engineers).Distinct().ToList();

            engineers.Sort();
            efs          = new RecipeFilterSelector(engineers);
            efs.Changed += FilterChanged;

            lfs          = new RecipeFilterSelector(levels);
            lfs.Changed += FilterChanged;

            List <string> modules = Recipes.EngineeringRecipes.SelectMany(r => r.modules).Distinct().ToList();

            modules.Sort();
            mfs          = new RecipeFilterSelector(modules);
            mfs.Changed += FilterChanged;

            var upgrades = Recipes.EngineeringRecipes.Select(r => r.Name).Distinct().ToList();

            upgrades.Sort();
            ufs          = new RecipeFilterSelector(upgrades);
            ufs.Changed += FilterChanged;

            List <string> matLongNames = Recipes.EngineeringRecipes.SelectMany(r => r.Ingredients).Select(x => x.Name).Distinct().ToList();

            matfs          = new RecipeFilterSelector(matLongNames);
            matfs.Changed += FilterChanged;

            for (int i = 0; i < Recipes.EngineeringRecipes.Count; i++)         // pre-fill array.. preventing the crash on cell edit when you
            {
                int rno = Order[i];
                Recipes.EngineeringRecipe r = Recipes.EngineeringRecipes[rno];

                int             rown = dataGridViewEngineering.Rows.Add();
                DataGridViewRow row  = dataGridViewEngineering.Rows[rown];
                row.Cells[UpgradeCol.Index].Value   = r.Name; // debug rno + ":" + r.name;
                row.Cells[ModuleCol.Index].Value    = r.modulesstring;
                row.Cells[LevelCol.Index].Value     = r.level;
                row.Cells[EngineersCol.Index].Value = r.engineersstring;
                row.Tag     = rno;
                row.Visible = false;
            }

            isHistoric = EliteDangerousCore.DB.UserDatabase.Instance.GetSettingBool(DbHistoricMatsSave, false);

            discoveryform.OnNewEntry += Discoveryform_OnNewEntry;

            BaseUtils.Translator.Instance.Translate(this);
            BaseUtils.Translator.Instance.Translate(toolTip, this);
        }
コード例 #9
0
        public override void Init()
        {
            dataGridViewEngineering.MakeDoubleBuffered();
            extCheckBoxWordWrap.Checked = GetSetting(dbWordWrap, false);
            UpdateWordWrap();
            extCheckBoxWordWrap.Click += extCheckBoxWordWrap_Click;

            Order = GetSetting(dbOSave, "").RestoreArrayFromString(0, Recipes.EngineeringRecipes.Count);
            if (Order.Max() >= Recipes.EngineeringRecipes.Count || Order.Min() < 0 || Order.Distinct().Count() != Recipes.EngineeringRecipes.Count) // if not distinct..
            {
                for (int i = 0; i < Order.Length; i++)                                                                                              // reset
                {
                    Order[i] = i;
                }
            }

            Wanted = GetSetting(dbWSave, "").RestoreArrayFromString(0, Recipes.EngineeringRecipes.Count);

            List <string> engineers = Recipes.EngineeringRecipes.SelectMany(r => r.engineers).Distinct().ToList();

            engineers.Sort();
            efs = new RecipeFilterSelector(engineers);
            efs.SaveSettings += (newvalue, e) => { PutSetting(dbEngFilterSave, newvalue); Display(); };

            lfs = new RecipeFilterSelector(levels);
            lfs.SaveSettings += (newvalue, e) => { PutSetting(dbLevelFilterSave, newvalue); Display(); };

            List <string> modules = Recipes.EngineeringRecipes.SelectMany(r => r.modules).Distinct().ToList();

            modules.Sort();
            mfs = new RecipeFilterSelector(modules);
            mfs.SaveSettings += (newvalue, e) => { PutSetting(dbModFilterSave, newvalue); Display(); };

            var upgrades = Recipes.EngineeringRecipes.Select(r => r.Name).Distinct().ToList();

            upgrades.Sort();
            ufs = new RecipeFilterSelector(upgrades);
            ufs.SaveSettings += (newvalue, e) => { PutSetting(dbUpgradeFilterSave, newvalue); Display(); };

            List <string> matLongNames = Recipes.EngineeringRecipes.SelectMany(r => r.Ingredients).Select(x => x.Name).Distinct().ToList();

            matfs = new RecipeFilterSelector(matLongNames);
            matfs.SaveSettings += (newvalue, e) => { PutSetting(dbMaterialFilterSave, newvalue); Display(); };

            for (int i = 0; i < Recipes.EngineeringRecipes.Count; i++)         // pre-fill array.. preventing the crash on cell edit when you
            {
                int rno = Order[i];
                Recipes.EngineeringRecipe r = Recipes.EngineeringRecipes[rno];

                int             rown = dataGridViewEngineering.Rows.Add();
                DataGridViewRow row  = dataGridViewEngineering.Rows[rown];
                row.Cells[UpgradeCol.Index].Value   = r.Name; // debug rno + ":" + r.name;
                row.Cells[ModuleCol.Index].Value    = r.modulesstring;
                row.Cells[LevelCol.Index].Value     = r.level;
                row.Cells[EngineersCol.Index].Value = r.engineersstring;
                row.Tag     = rno;
                row.Visible = false;
            }

            isHistoric = GetSetting(dbHistoricMatsSave, false);

            discoveryform.OnNewEntry      += Discoveryform_OnNewEntry;
            discoveryform.OnHistoryChange += Discoveryform_OnHistoryChange;

            BaseUtils.Translator.Instance.Translate(this);
            BaseUtils.Translator.Instance.Translate(toolTip, this);
        }
コード例 #10
0
        public override void Init()
        {
            dataGridViewSynthesis.MakeDoubleBuffered();
            dataGridViewSynthesis.DefaultCellStyle.WrapMode = DataGridViewTriState.False;

            Order = SQLiteDBClass.GetSettingString(DbOSave, "").RestoreArrayFromString(0, Recipes.SynthesisRecipes.Count);
            if (Order.Max() >= Recipes.SynthesisRecipes.Count || Order.Min() < 0 || Order.Distinct().Count() != Recipes.SynthesisRecipes.Count) // if not distinct..
            {
                for (int i = 0; i < Order.Length; i++)                                                                                          // reset
                {
                    Order[i] = i;
                }
            }

            Wanted = SQLiteDBClass.GetSettingString(DbWSave, "").RestoreArrayFromString(0, Recipes.SynthesisRecipes.Count);

            var rcpes = Recipes.SynthesisRecipes.Select(r => r.name).Distinct().ToList();

            rcpes.Sort();
            rfs          = new RecipeFilterSelector(rcpes);
            rfs.Changed += FilterChanged;

            var lvls = Recipes.SynthesisRecipes.Select(r => r.level).Distinct().ToList();

            lvls.Sort();
            lfs          = new RecipeFilterSelector(lvls);
            lfs.Changed += FilterChanged;

            List <string> matShortNames = Recipes.SynthesisRecipes.SelectMany(r => r.ingredients).Distinct().ToList();

            matLookUp = matShortNames.Select(sn => Tuple.Create <string, string>(sn, MaterialCommodityData.GetByShortName(sn).Name)).ToList();

            List <string> matLongNames = matLookUp.Select(lu => lu.Item2).ToList();

            matLongNames.Sort();

            mfs          = new RecipeFilterSelector(matLongNames);
            mfs.Changed += FilterChanged;

            for (int i = 0; i < Recipes.SynthesisRecipes.Count; i++)         // pre-fill array.. preventing the crash on cell edit when you
            {
                int rno = Order[i];
                Recipes.SynthesisRecipe r = Recipes.SynthesisRecipes[rno];

                int rown = dataGridViewSynthesis.Rows.Add();

                using (DataGridViewRow row = dataGridViewSynthesis.Rows[rown])
                {
                    row.Cells[0].Value       = r.name; // debug rno + ":" + r.name;
                    row.Cells[1].Value       = r.level;
                    row.Cells[6].Value       = r.ingredientsstring;
                    row.Cells[6].ToolTipText = r.ingredientsstringlong;
                    row.Tag     = rno;
                    row.Visible = false;
                }
            }

            isHistoric = SQLiteDBClass.GetSettingBool(DbHistoricMatsSave, false);

            discoveryform.OnNewEntry += Discoveryform_OnNewEntry;

            BaseUtils.Translator.Instance.Translate(this);
            BaseUtils.Translator.Instance.Translate(toolTip, this);
        }
コード例 #11
0
        public override void Init()
        {
            dataGridViewEngineering.MakeDoubleBuffered();
            extCheckBoxWordWrap.Checked = GetSetting(dbWordWrap, false);
            UpdateWordWrap();
            extCheckBoxWordWrap.Click += extCheckBoxWordWrap_Click;

            RowToRecipe = GetSetting(dbOSave, "").RestoreArrayFromString(0, Recipes.EngineeringRecipes.Count);
            if (RowToRecipe.Max() >= Recipes.EngineeringRecipes.Count || RowToRecipe.Min() < 0 || RowToRecipe.Distinct().Count() != Recipes.EngineeringRecipes.Count) // if not distinct..
            {
                for (int i = 0; i < RowToRecipe.Length; i++)                                                                                                          // reset
                {
                    RowToRecipe[i] = i;
                }
            }

            WantedPerRecipe = GetSetting(dbWSave, "").RestoreArrayFromString(0, Recipes.EngineeringRecipes.Count);

            List <string> engineers = Recipes.EngineeringRecipes.SelectMany(r => r.engineers).Distinct().ToList();

            engineers.Sort();
            efs = new RecipeFilterSelector(engineers);
            efs.SaveSettings += (newvalue, e) => { PutSetting(dbEngFilterSave, newvalue); Display(); };

            lfs = new RecipeFilterSelector(levels);
            lfs.SaveSettings += (newvalue, e) => { PutSetting(dbLevelFilterSave, newvalue); Display(); };

            List <string> modules = Recipes.EngineeringRecipes.SelectMany(r => r.modules).Distinct().ToList();

            modules.Sort();
            mfs = new RecipeFilterSelector(modules);
            mfs.SaveSettings += (newvalue, e) => { PutSetting(dbModFilterSave, newvalue); Display(); };

            var upgrades = Recipes.EngineeringRecipes.Select(r => r.Name).Distinct().ToList();

            upgrades.Sort();
            ufs = new RecipeFilterSelector(upgrades);
            ufs.SaveSettings += (newvalue, e) => { PutSetting(dbUpgradeFilterSave, newvalue); Display(); };

            List <string> matLongNames = Recipes.EngineeringRecipes.SelectMany(r => r.Ingredients).Select(x => x.Name).Distinct().ToList();

            matLongNames.Sort();
            matfs = new RecipeFilterSelector(matLongNames);
            matfs.SaveSettings += (newvalue, e) => { PutSetting(dbMaterialFilterSave, newvalue); Display(); };

            for (int rowno = 0; rowno < Recipes.EngineeringRecipes.Count; rowno++)         // pre-fill array.. preventing the crash on cell edit when you
            {
                int recipeno = RowToRecipe[rowno];
                Recipes.EngineeringRecipe r = Recipes.EngineeringRecipes[recipeno];

                int             rown = dataGridViewEngineering.Rows.Add();
                DataGridViewRow row  = dataGridViewEngineering.Rows[rown];
                row.Cells[UpgradeCol.Index].Value   = r.Name; // debug rno + ":" + r.name;
                row.Cells[ModuleCol.Index].Value    = r.modulesstring;
                row.Cells[LevelCol.Index].Value     = r.level;
                row.Cells[EngineersCol.Index].Tag   = r.engineers;      // keep list in tag
                row.Cells[EngineersCol.Index].Value = string.Join(Environment.NewLine, r.engineers);
                row.Tag     = recipeno;
                row.Visible = false;
            }

            isHistoric = GetSetting(dbHistoricMatsSave, false);

            discoveryform.OnNewEntry      += Discoveryform_OnNewEntry;
            discoveryform.OnHistoryChange += Discoveryform_OnHistoryChange;

            var enumlist = new Enum[] { EDTx.UserControlEngineering_UpgradeCol, EDTx.UserControlEngineering_ModuleCol, EDTx.UserControlEngineering_LevelCol, EDTx.UserControlEngineering_MaxCol, EDTx.UserControlEngineering_WantedCol, EDTx.UserControlEngineering_AvailableCol, EDTx.UserControlEngineering_NotesCol, EDTx.UserControlEngineering_RecipeCol, EDTx.UserControlEngineering_EngineersCol };

            BaseUtils.Translator.Instance.TranslateControls(this, enumlist);
            var enumlisttt = new Enum[] { EDTx.UserControlEngineering_ToolTip, EDTx.UserControlEngineering_buttonFilterUpgrade_ToolTip, EDTx.UserControlEngineering_buttonFilterModule_ToolTip, EDTx.UserControlEngineering_buttonFilterLevel_ToolTip, EDTx.UserControlEngineering_buttonFilterEngineer_ToolTip, EDTx.UserControlEngineering_buttonFilterMaterial_ToolTip, EDTx.UserControlEngineering_buttonClear_ToolTip, EDTx.UserControlEngineering_chkNotHistoric_ToolTip, EDTx.UserControlEngineering_extCheckBoxWordWrap_ToolTip };

            BaseUtils.Translator.Instance.TranslateTooltip(toolTip, enumlisttt, this);
        }