Beispiel #1
0
        private readonly PopupListbox allowedCountriesWindow;  // pop-up window managing allowed countries for filtering

        /// Initializes a new instance of the <see cref="UpdatePriceSettings"/> class.
        /// <param name="lastPresetName">The last preset used by this settings windows under which it is stored in Properties.Settings.Default</param>
        /// <param name="title">Title of the window</param>
        public UpdatePriceSettings(string lastPresetName, string title)
        {
            InitializeComponent();
            loadPresets();
            Text = title;
            allowedExpansionsWindow = new PopupListbox("Allowed Expansions");
            allowedCountriesWindow  = new PopupListbox("Allowed Countries");
            comboBoxPriceEstUpdateMode.SelectedIndex    = 0;
            comboBoxPriceEstMinPriceMatch.SelectedIndex = 0;
            List <string> countryNames = new List <string>(MKMHelpers.CountryNames.Count);

            foreach (var code in MKMHelpers.CountryNames)
            {
                countryNames.Add(code.Value);
            }
            allowedCountriesWindow.SetDataSource(countryNames);

            this.lastPresetName = lastPresetName;
            string lastPreset = Properties.Settings.Default[lastPresetName].ToString();

            if (comboBoxPresets.Items.Contains(lastPreset))
            {
                comboBoxPresets.SelectedIndex = comboBoxPresets.Items.IndexOf(lastPreset);
                UpdateSettingsGUI(presets[lastPreset]);
            }
        }
Beispiel #2
0
        private readonly PopupListbox allowedCountriesWindow;  // pop-up window managing allowed countries for filtering

        /// Initializes a new instance of the <see cref="UpdatePriceSettings"/> class.
        /// <param name="lastPresetName">The last preset used by this settings windows under which it is stored in Properties.Settings.Default</param>
        /// <param name="title">Title of the window</param>
        public UpdatePriceSettings(string lastPresetName, string title)
        {
            InitializeComponent();
            loadPresets();
            Text = title;
            allowedExpansionsWindow = new PopupListbox("Allowed Expansions");
            allowedCountriesWindow  = new PopupListbox("Allowed Countries");
            comboBoxPriceEstMinPriceMatch.SelectedIndex = 0;
            List <string> countryNames = new List <string>(MKMHelpers.CountryNames.Count);

            foreach (var code in MKMHelpers.CountryNames)
            {
                countryNames.Add(code.Value);
            }
            allowedCountriesWindow.SetDataSource(countryNames);

            groupBoxPriceGuides.Visible = MKMHelpers.SAmCommercial;
            if (MKMHelpers.SAmCommercial)
            {
                comboBoxPriceEstUpdateMode.Items.Add("Use Price Guides");
                // fill the comboboxes for price guides
                string tooltip = "";
                foreach (var guideDesc in MKMHelpers.PriceGuides)
                {
                    comboBoxPriceGuidesFoils.Items.Add(guideDesc.Value.Code);
                    comboBoxPriceGuidesNonFoils.Items.Add(guideDesc.Value.Code);
                    tooltip += guideDesc.Value.Code + ": " + guideDesc.Value.Documentation + "\n";
                    if (guideDesc.Value.Code == "TREND")
                    {
                        comboBoxPriceGuidesNonFoils.SelectedIndex = comboBoxPriceGuidesNonFoils.Items.Count - 1;
                    }
                    else if (guideDesc.Value.Code == "TRENDFOIL")
                    {
                        comboBoxPriceGuidesFoils.SelectedIndex = comboBoxPriceGuidesFoils.Items.Count - 1;
                    }
                }
                toolTip1.SetToolTip(comboBoxPriceGuidesFoils, tooltip);
                toolTip1.SetToolTip(comboBoxPriceGuidesNonFoils, tooltip);
                comboBoxPriceGuidesFoils.SelectedIndexChanged +=
                    new EventHandler(comboBoxPriceGuidesFoils_SelectedIndexChanged);
                comboBoxPriceGuidesNonFoils.SelectedIndexChanged +=
                    new EventHandler(comboBoxPriceGuidesNonFoils_SelectedIndexChanged);
            }
            comboBoxPriceEstUpdateMode.SelectedIndex = 0;

            this.lastPresetName = lastPresetName;
            string lastPreset = Properties.Settings.Default[lastPresetName].ToString();

            if (comboBoxPresets.Items.Contains(lastPreset))
            {
                comboBoxPresets.SelectedIndex = comboBoxPresets.Items.IndexOf(lastPreset);
                UpdateSettingsGUI(presets[lastPreset]);
            }
        }