Exemplo n.º 1
0
        public override void Init()
        {
            DBBaseName = "LedgerGrid";

            dataGridViewLedger.MakeDoubleBuffered();
            dataGridViewLedger.DefaultCellStyle.WrapMode = DataGridViewTriState.False;

            var    jes      = EliteDangerousCore.JournalEntry.GetNameImageOfEvents(new string[] { "Ledger" });
            string cashtype = string.Join(";", jes.Select(x => x.Item1)) + ";";

            cfs = new JournalFilterSelector();
            cfs.AddAllNone();
            cfs.AddGroupOption(cashtype, "Cash Transactions".T(EDTx.UserControlLedger_CashTransactions), JournalEntry.JournalTypeIcons[JournalTypeEnum.Bounty]);
            cfs.AddJournalEntries(new string[] { "Ledger", "LedgerNC" });
            cfs.SaveSettings += EventFilterChanged;

            extCheckBoxWordWrap.Checked = GetSetting(dbWordWrap, true);
            UpdateWordWrap();
            extCheckBoxWordWrap.Click += extCheckBoxWordWrap_Click;

            discoveryform.OnHistoryChange += Redisplay;
            discoveryform.OnNewEntry      += NewEntry;

            var enumlist    = new Enum[] { EDTx.UserControlLedger_TimeCol, EDTx.UserControlLedger_Type, EDTx.UserControlLedger_Notes, EDTx.UserControlLedger_Credits, EDTx.UserControlLedger_Debits, EDTx.UserControlLedger_Balance, EDTx.UserControlLedger_NormProfit, EDTx.UserControlLedger_TotalProfit, EDTx.UserControlLedger_labelTime, EDTx.UserControlLedger_labelSearch };
            var enumlistcms = new Enum[] { EDTx.UserControlLedger_toolStripMenuItemGotoItem };
            var enumlisttt  = new Enum[] { EDTx.UserControlLedger_comboBoxTime_ToolTip, EDTx.UserControlLedger_textBoxFilter_ToolTip, EDTx.UserControlLedger_buttonFilter_ToolTip, EDTx.UserControlLedger_buttonExtExcel_ToolTip, EDTx.UserControlLedger_extCheckBoxWordWrap_ToolTip };

            BaseUtils.Translator.Instance.TranslateControls(this, enumlist);
            BaseUtils.Translator.Instance.TranslateToolstrip(contextMenuStrip, enumlistcms, this);
            BaseUtils.Translator.Instance.TranslateTooltip(toolTip, enumlisttt, this);

            TravelHistoryFilter.InitaliseComboBox(comboBoxTime, GetSetting(dbHistorySave, ""), incldockstartend: false);
        }
Exemplo n.º 2
0
        public override void Init()
        {
            DBBaseName = PanelMode == PanelType.Materials ? "MaterialsGrid" : PanelMode == PanelType.Commodities ? "CommoditiesGrid" : "MicroResourcesGrid";

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

            var enumlist   = new Enum[] { EDTx.UserControlMaterialCommodities_NameCol, EDTx.UserControlMaterialCommodities_ShortName, EDTx.UserControlMaterialCommodities_Category, EDTx.UserControlMaterialCommodities_Type, EDTx.UserControlMaterialCommodities_Number, EDTx.UserControlMaterialCommodities_Price };
            var enumlisttt = new Enum[] { EDTx.UserControlMaterialCommodities_buttonFilter_ToolTip, EDTx.UserControlMaterialCommodities_textBoxItems1_ToolTip, EDTx.UserControlMaterialCommodities_textBoxItems2_ToolTip, EDTx.UserControlMaterialCommodities_checkBoxShowZeros_ToolTip, EDTx.UserControlMaterialCommodities_extCheckBoxWordWrap_ToolTip };

            BaseUtils.Translator.Instance.TranslateControls(this, enumlist, null, "UserControlMaterialCommodities");
            BaseUtils.Translator.Instance.TranslateTooltip(toolTip, enumlisttt, this, "UserControlMaterialCommodities");

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

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

            Price.Tag = Number.Tag = "Num";     // these tell the sorter to do numeric sorting

            if (PanelMode == PanelType.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 = MaterialCommodityMicroResourceType.GetMaterials(true);
                types = MaterialCommodityMicroResourceType.GetTypes((x) => x.IsMaterial, true);

                var cats = MaterialCommodityMicroResourceType.GetCategories((x) => x.IsMaterial, true);

                foreach (var t in cats)
                {
                    string[] members = MaterialCommodityMicroResourceType.GetFDNameMembersOfCategory(t.Item1, true);
                    cfs.AddGroupOption(String.Join(";", members) + ";", t.Item2);
                }
            }
            else if (PanelMode == PanelType.MicroResources)
            {
                dataGridViewMC.ContextMenuStrip = null;
                dataGridViewMC.Columns.Remove(Type);
                Number.HeaderText     = "Ship Locker".T(EDTx.UserControlMaterialCommodities_ShipLocker);
                Price.HeaderText      = "BackPack".T(EDTx.UserControlMaterialCommodities_BackPack);
                labelItems1.Text      = "Total".T(EDTx.UserControlMaterialCommodities_Total);
                textBoxItems2.Visible = labelItems2.Visible = false;

                items = MaterialCommodityMicroResourceType.GetMicroResources(true);
                types = MaterialCommodityMicroResourceType.GetTypes((x) => x.IsMicroResources, true);

                var cats = MaterialCommodityMicroResourceType.GetCategories((x) => x.IsMicroResources, true);

                foreach (var t in cats)
                {
                    string[] members = MaterialCommodityMicroResourceType.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 = MaterialCommodityMicroResourceType.GetCommodities(true);
                types = MaterialCommodityMicroResourceType.GetTypes((x) => x.IsCommodity, true);

                MaterialCommodityMicroResourceType[] 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 = MaterialCommodityMicroResourceType.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;
        }