예제 #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);
        }
        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);
        }
예제 #3
0
        public override void Init()
        {
            dataGridViewSynthesis.MakeDoubleBuffered();
            dataGridViewSynthesis.DefaultCellStyle.WrapMode = DataGridViewTriState.False;
            dataGridViewSynthesis.RowTemplate.Height        = 26;

            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);
        }