コード例 #1
0
        public override void Init()
        {
            dataGridViewMC.MakeDoubleBuffered();
            dataGridViewMC.DefaultCellStyle.WrapMode = DataGridViewTriState.False;

            BaseUtils.Translator.Instance.Translate(this);
            BaseUtils.Translator.Instance.Translate(toolTip, this);

            cfs = new FilterSelector(DbFilterSave);

            MaterialCommodityData[]  items;
            Tuple <string, string>[] types;

            cfs.AddAllNone();

            if (materials)
            {
                dataGridViewMC.Columns.Remove(dataGridViewMC.Columns[5]);       // to give name,shortname abv,category,type,number
                labelItems1.Text = "Data".T(EDTx.UserControlMaterialCommodities_Data);
                labelItems2.Text = "Mats".T(EDTx.UserControlMaterialCommodities_Mats);

                items = MaterialCommodityData.GetMaterials(true);
                types = MaterialCommodityData.GetTypes((x) => !x.IsCommodity, true);

                Tuple <string, string>[] cats = MaterialCommodityData.GetCategories((x) => !x.IsCommodity, true);

                foreach (var t in cats)
                {
                    string[] members = MaterialCommodityData.GetFDNameMembersOfCategory(t.Item1, true);
                    cfs.AddGroupOption(String.Join(";", members) + ";", t.Item2);
                }
            }
            else
            {
                dataGridViewMC.Columns.Remove(dataGridViewMC.Columns[1]);       //shortname
                dataGridViewMC.Columns.Remove(dataGridViewMC.Columns[1]);       //then category to give name,type,number, avg price
                labelItems1.Text       = "Total".T(EDTx.UserControlMaterialCommodities_Total);
                textBoxItems2.Visible  = labelItems2.Visible = false;
                checkBoxClear.Location = new Point(textBoxItems1.Right + 8, checkBoxClear.Top);

                items = MaterialCommodityData.GetCommodities(true);
                types = MaterialCommodityData.GetTypes((x) => x.IsCommodity, true);

                MaterialCommodityData[] rare = items.Where(x => x.IsRareCommodity).ToArray();
                cfs.AddGroupOption(String.Join(";", rare.Select(x => x.FDName).ToArray()) + ";", "Rare".T(EDTx.UserControlMaterialCommodities_Rare));
            }

            foreach (var t in types)
            {
                string[] members = MaterialCommodityData.GetFDNameMembersOfType(t.Item1, true);
                cfs.AddGroupOption(String.Join(";", members) + ";", t.Item2);
            }

            foreach (var x in items)
            {
                cfs.AddStandardOption(x.FDName, x.Name);
            }

            checkBoxClear.Checked         = EliteDangerousCore.DB.SQLiteDBClass.GetSettingBool(DbClearZeroSave, true);
            checkBoxClear.CheckedChanged += CheckBoxClear_CheckedChanged;

            cfs.SaveSettings += FilterChanged;
        }
コード例 #2
0
        public override void Init()
        {
            DBBaseName = materials ? "MaterialsGrid" : "CommoditiesGrid";

            dataGridViewMC.MakeDoubleBuffered();
            extCheckBoxWordWrap.Checked = GetSetting(dbWrapText, false);
            UpdateWordWrap();
            extCheckBoxWordWrap.Click += extCheckBoxWordWrap_Click;

            BaseUtils.Translator.Instance.Translate(this);
            BaseUtils.Translator.Instance.Translate(toolTip, this);

            cfs = new FilterSelector();
            cfs.AddAllNone();

            MaterialCommodityData[] items;
            Tuple <MaterialCommodityData.ItemType, string>[] types;

            if (materials)
            {
                dataGridViewMC.Columns[5].HeaderText = "Recipes".T(EDTx.UserControlMaterialCommodities_Recipes);
                labelItems1.Text = "Data".T(EDTx.UserControlMaterialCommodities_Data);
                labelItems2.Text = "Mats".T(EDTx.UserControlMaterialCommodities_Mats);

                items = MaterialCommodityData.GetMaterials(true);
                types = MaterialCommodityData.GetTypes((x) => !x.IsCommodity, true);

                var cats = MaterialCommodityData.GetCategories((x) => !x.IsCommodity, true);

                foreach (var t in cats)
                {
                    string[] members = MaterialCommodityData.GetFDNameMembersOfCategory(t.Item1, true);
                    cfs.AddGroupOption(String.Join(";", members) + ";", t.Item2);
                }
            }
            else
            {
                dataGridViewMC.Columns.Remove(dataGridViewMC.Columns[1]); //remove cat

                DataGridViewColumn c = dataGridViewMC.Columns[1];         // reassign column 1 to end and call recipes
                c.HeaderText   = "Recipes".T(EDTx.UserControlMaterialCommodities_Recipes);
                c.DisplayIndex = 4;                                       // need to change its display pos
                dataGridViewMC.Columns.Remove(c);                         // and to place it at the end otherwise it does not fill in the right order
                dataGridViewMC.Columns.Add(c);

                labelItems1.Text           = "Total".T(EDTx.UserControlMaterialCommodities_Total);
                textBoxItems2.Visible      = labelItems2.Visible = false;
                checkBoxShowZeros.Location = new Point(textBoxItems1.Right + 8, checkBoxShowZeros.Top);

                items = MaterialCommodityData.GetCommodities(true);
                types = MaterialCommodityData.GetTypes((x) => x.IsCommodity, true);

                MaterialCommodityData[] rare = items.Where(x => x.IsRareCommodity).ToArray();
                cfs.AddGroupOption(String.Join(";", rare.Select(x => x.FDName).ToArray()) + ";", "Rare".T(EDTx.UserControlMaterialCommodities_Rare));
            }

            foreach (var t in types)
            {
                string[] members = MaterialCommodityData.GetFDNameMembersOfType(t.Item1, true);
                cfs.AddGroupOption(String.Join(";", members) + ";", t.Item2);
            }

            foreach (var x in items)
            {
                cfs.AddStandardOption(x.FDName, x.Name);
            }

            checkBoxShowZeros.Checked         = !GetSetting(dbClearZero, true); // used to be clear zeros, now its show zeros, invert
            checkBoxShowZeros.CheckedChanged += CheckBoxClear_CheckedChanged;

            cfs.SaveSettings += FilterChanged;
        }
コード例 #3
0
        public override void Init()
        {
            dataGridViewMC.MakeDoubleBuffered();

            BaseUtils.Translator.Instance.Translate(this);
            BaseUtils.Translator.Instance.Translate(toolTip, this);

            cfs = new FilterSelector(DbFilterSave);

            MaterialCommodityData[] items;
            Tuple <MaterialCommodityData.ItemType, string>[] types;

            cfs.AddAllNone();

            if (materials)
            {
                dataGridViewMC.Columns[5].HeaderText = "Recipes".T(EDTx.UserControlMaterialCommodities_Recipes);
                labelItems1.Text = "Data".T(EDTx.UserControlMaterialCommodities_Data);
                labelItems2.Text = "Mats".T(EDTx.UserControlMaterialCommodities_Mats);

                items = MaterialCommodityData.GetMaterials(true);
                types = MaterialCommodityData.GetTypes((x) => !x.IsCommodity, true);

                var cats = MaterialCommodityData.GetCategories((x) => !x.IsCommodity, true);

                foreach (var t in cats)
                {
                    string[] members = MaterialCommodityData.GetFDNameMembersOfCategory(t.Item1, true);
                    cfs.AddGroupOption(String.Join(";", members) + ";", t.Item2);
                }
            }
            else
            {
                dataGridViewMC.Columns.Remove(dataGridViewMC.Columns[1]); //remove cat

                DataGridViewColumn c = dataGridViewMC.Columns[1];         // reassign column 1 to end and call recipes
                c.HeaderText   = "Recipes".T(EDTx.UserControlMaterialCommodities_Recipes);
                c.DisplayIndex = 4;                                       // need to change its display pos
                dataGridViewMC.Columns.Remove(c);                         // and to place it at the end otherwise it does not fill in the right order
                dataGridViewMC.Columns.Add(c);

                labelItems1.Text       = "Total".T(EDTx.UserControlMaterialCommodities_Total);
                textBoxItems2.Visible  = labelItems2.Visible = false;
                checkBoxClear.Location = new Point(textBoxItems1.Right + 8, checkBoxClear.Top);

                items = MaterialCommodityData.GetCommodities(true);
                types = MaterialCommodityData.GetTypes((x) => x.IsCommodity, true);

                MaterialCommodityData[] rare = items.Where(x => x.IsRareCommodity).ToArray();
                cfs.AddGroupOption(String.Join(";", rare.Select(x => x.FDName).ToArray()) + ";", "Rare".T(EDTx.UserControlMaterialCommodities_Rare));
            }

            foreach (var t in types)
            {
                string[] members = MaterialCommodityData.GetFDNameMembersOfType(t.Item1, true);
                cfs.AddGroupOption(String.Join(";", members) + ";", t.Item2);
            }

            foreach (var x in items)
            {
                cfs.AddStandardOption(x.FDName, x.Name);
            }

            checkBoxClear.Checked         = EliteDangerousCore.DB.UserDatabase.Instance.GetSettingBool(DbClearZeroSave, true);
            checkBoxClear.CheckedChanged += CheckBoxClear_CheckedChanged;

            extCheckBoxTruncateText.Checked         = EliteDangerousCore.DB.UserDatabase.Instance.GetSettingBool(DbTruncateText, true);
            extCheckBoxTruncateText.CheckedChanged += TruncateText_CheckedChanged;

            dataGridViewMC.DefaultCellStyle.WrapMode = DataGridViewTriState.True;
            dataGridViewMC.AutoSizeRowsMode          = extCheckBoxTruncateText.Checked ? DataGridViewAutoSizeRowsMode.None : DataGridViewAutoSizeRowsMode.AllCells;

            cfs.SaveSettings += FilterChanged;
        }