Esempio n. 1
0
        private void GraphSetup_Load(object sender, EventArgs e)
        {
            Width = 274; //223
            Text  = Translations.TranslationGet("WIN_CAPSETUPCHARTS", "DE", "Chart Setup");
            STR_GRPSTATSBASE.Text = Translations.TranslationGet("STR_GRPSTATSBASE", "DE", "Statistic Base");
            STR_GRPPERIOD.Text    = Translations.TranslationGet("STR_GRPPERIOD", "DE", "Period");
            STR_CATEGORY.Text     = Translations.TranslationGet("STR_CATEGORY", "DE", "Category");
            STR_CHARTNAME.Text    = Translations.TranslationGet("STR_CHARTNAME", "DE", "Chart Name");

            FormHelpers.ResizeLables(this.Controls);

            textName.Left       = STR_CHARTNAME.Left + STR_CHARTNAME.Width + 5;
            comboDataField.Left = textName.Left;

            if (this.ClientRectangle.Width - (STR_CHARTNAME.Left + STR_CHARTNAME.Width + 10) < textName.Width)
            {
                textName.Width = this.ClientRectangle.Width - (STR_CHARTNAME.Left + STR_CHARTNAME.Width + 10);
            }

            if (this.ClientRectangle.Width - (STR_CHARTNAME.Left + STR_CHARTNAME.Width + 10) < comboDataField.Width)
            {
                comboDataField.Width = this.ClientRectangle.Width - (STR_CHARTNAME.Left + STR_CHARTNAME.Width + 10);
            }

            radioGroup1.Properties.Items[0].Description = Translations.TranslationGet("STR_OVERALL", "DE", "Overall");
            radioGroup1.Properties.Items[1].Description = Translations.TranslationGet("STR_TANKS", "DE", "Tanks");

            radioGroupPeriod.Properties.Items[0].Description = "1 " + Translations.TranslationGet("STR_WEEK", "DE", "Week");
            radioGroupPeriod.Properties.Items[1].Description = "2 " + Translations.TranslationGet("STR_WEEKS", "DE", "Weeks");
            radioGroupPeriod.Properties.Items[2].Description = "3 " + Translations.TranslationGet("STR_WEEKS", "DE", "Weeks");
            radioGroupPeriod.Properties.Items[3].Description = "4 " + Translations.TranslationGet("STR_WEEKS", "DE", "Weeks");
            radioGroupPeriod.Properties.Items[4].Description = "5 " + Translations.TranslationGet("STR_WEEKS", "DE", "Weeks");
            radioGroupPeriod.Properties.Items[5].Description = "6 " + Translations.TranslationGet("STR_WEEKS", "DE", "Weeks");
            radioGroupPeriod.Properties.Items[6].Description = "3 " + Translations.TranslationGet("STR_MONTHS", "DE", "Months");
            radioGroupPeriod.Properties.Items[7].Description = "6 " + Translations.TranslationGet("STR_MONTHS", "DE", "Months");
            radioGroupPeriod.Properties.Items[8].Description = Translations.TranslationGet("STR_YEAR", "DE", "Year");

            foreach (KeyValuePair <int, string> country in _cDescription)
            {
                listTanks.Groups.Add(new ListViewGroup(country.Key.ToString(), country.Value)
                {
                    HeaderAlignment = HorizontalAlignment.Center
                });
            }

            foreach (KeyValuePair <TankKey, TankValue> tank in _tDescription.OrderBy(x => x.Value.Tier).ThenBy(y => y.Value.TankType).Where(z => z.Value.Active == true))
            {
                ListViewItem newListViewItem = new ListViewItem(tank.Value.Description,
                                                                0,
                                                                listTanks.Groups[tank.Key.CountryID.ToString()])
                {
                    Name = String.Format("{0}_{1}", tank.Key.CountryID, tank.Key.TankID)
                };

                ListViewItem.ListViewSubItem subItem1 = new ListViewItem.ListViewSubItem(newListViewItem, _typeDescription.Description(tank.Value.TankType));
                ListViewItem.ListViewSubItem subItem2 = new ListViewItem.ListViewSubItem(newListViewItem, tank.Value.Tier.ToString());

                newListViewItem.SubItems.Add(subItem1);
                newListViewItem.SubItems.Add(subItem2);
                listTanks.Items.Add(newListViewItem);
            }

            if (textName.Text != "")
            {
                List <string> list = _graphSettings.InnerText(_ID).Split('|').ToList <string>();

                foreach (string item in list)
                {
                    if (listTanks.Items[item] != null)
                    {
                        listTanks.Items[item].Checked = true;
                    }
                }
            }

            listTanks.Columns[0].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
            listTanks.Columns[1].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
            listTanks.Columns[2].AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);

            if (radioGroup1.EditValue.ToString() == "Tanks")
            {
                Width    = 684;
                Location = new Point(Screen.PrimaryScreen.WorkingArea.Width / 2 - Width / 2, Screen.PrimaryScreen.WorkingArea.Height / 2 - Height / 2);
            }
            else
            {
                Width = 274; //223
            }
        }
Esempio n. 2
0
        private void CustomGroupings_Load(object sender, EventArgs e)
        {
            Text = Translations.TranslationGet("STR_CUSTGROUPINGS", "DE", "Custom Groupings");
            HTML_GROUPNAME.Text = Translations.TranslationGet("HTML_GROUPNAME", "DE", "Group Name");
            BTN_SAVE.Text       = Translations.TranslationGet("BTN_SAVE", "DE", "Save");
            BTN_CLOSE.Text      = Translations.TranslationGet("BTN_CLOSE", "DE", "Close");

            FormHelpers.ResizeLables(this.Controls);

            txtGroupName.Left = HTML_GROUPNAME.Left + HTML_GROUPNAME.Width + 5;
            if (this.ClientRectangle.Width - (HTML_GROUPNAME.Left + HTML_GROUPNAME.Width + 10) < txtGroupName.Width)
            {
                txtGroupName.Width = this.ClientRectangle.Width - (HTML_GROUPNAME.Left + HTML_GROUPNAME.Width + 10);
            }

            imageList1.ColorDepth = ColorDepth.Depth32Bit;
            imageList1.ImageSize  = new Size(50, 24);

            foreach (KeyValuePair <int, string> country in _cDescription)
            {
                tankListView.Groups.Add(new ListViewGroup(country.Key.ToString(), country.Value)
                {
                    HeaderAlignment = HorizontalAlignment.Center
                });
            }


            foreach (KeyValuePair <TankKey, TankValue> tank in _tDescription.OrderBy(x => x.Value.Tier).ThenBy(y => y.Value.TankType).Where(z => z.Value.Active == true))
            {
                ListViewItem newListViewItem = new ListViewItem(tank.Value.Description, 0, tankListView.Groups[tank.Key.CountryID.ToString()]);
                newListViewItem.Name = tank.Key.CountryID + "_" + tank.Key.TankID;
                ListViewItem.ListViewSubItem subItem1 = new ListViewItem.ListViewSubItem(newListViewItem, _typeDescription.Description(tank.Value.TankType));
                ListViewItem.ListViewSubItem subItem2 = new ListViewItem.ListViewSubItem(newListViewItem, tank.Value.Tier.ToString());
                newListViewItem.SubItems.Add(subItem1);
                newListViewItem.SubItems.Add(subItem2);

                try
                {
                    if (!imageList1.Images.ContainsKey(String.Format("{0}_{1}", tank.Key.CountryID, tank.Key.TankID)))
                    {
                        imageList1.Images.Add(String.Format("{0}_{1}", tank.Key.CountryID, tank.Key.TankID), Image.FromFile(String.Format(@"{0}", WOTHelper.GetImagePath(tank.Key.CountryID + "_" + tank.Key.TankID + "_Large.png"))));
                    }

                    newListViewItem.ImageKey = String.Format("{0}_{1}", tank.Key.CountryID, tank.Key.TankID);
                }
                catch { }
                tankListView.Items.Add(newListViewItem);
            }


            if (_ID != "")
            {
                List <string> list = _customGrouping.Values(_ID).Split('|').ToList <string>();

                foreach (string item in list)
                {
                    if (tankListView.Items[item] != null)
                    {
                        tankListView.Items[item].Checked = true;
                    }
                }
            }


            tankListView.Columns[0].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
            tankListView.Columns[1].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
            tankListView.Columns[2].AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
        }