Exemple #1
0
        private void PopulateCombo(ComboBox a_Combo, List <TextItemWithUInt32> a_Items, UInt32 a_SelectedData)
        {
            a_Combo.Items.Clear();

            TextItemWithUInt32 selectedItem = null;

            foreach (TextItemWithUInt32 currItem in a_Items)
            {
                a_Combo.Items.Add(currItem);

                if (currItem.Data == a_SelectedData)
                {
                    selectedItem = currItem;
                }
            }

            // Force items to be sorted right now
            a_Combo.Sorted = false;
            a_Combo.Sorted = true;

            // Choose selected item only after sorting
            if (null != selectedItem)
            {
                a_Combo.SelectedItem = selectedItem;
            }
            else
            {
                a_Combo.SelectedIndex = 0;
            }
        }
Exemple #2
0
        private void Init_EveCentralCom_CmbSolar()
        {
            List <TextItemWithUInt32> items = new List <TextItemWithUInt32>();

            items.Add(new TextItemWithUInt32("[All solar systems]", 0));

            UInt32 regionID = TextItemWithUInt32.GetData(Cmb_EveCentralCom_Region.SelectedItem);

            foreach (EveSolarSystem currSystem in m_EveDatabase.GetSolarSystems(regionID))
            {
                items.Add(new TextItemWithUInt32(currSystem.Name, currSystem.ID));
            }

            PopulateCombo(Cmb_EveCentralCom_Solar, items, m_Settings.EveCentralCom.SolarID);
        }
Exemple #3
0
        private void UpdateCmbLoadSkills()
        {
            CmbLoadSkills.Items.Clear();

            foreach (Settings.V1._ApiChar currChar in m_Settings.ApiAccess.Chars)
            {
                TextItemWithUInt32 newItem = new TextItemWithUInt32(currChar.CharacterName, currChar.CharacterID);
                CmbLoadSkills.Items.Add(newItem);
            }

            if (0 != CmbLoadSkills.Items.Count)
            {
                CmbLoadSkills.SelectedIndex = 0;
            }
        }
Exemple #4
0
        private void Init_TlbCmbCharacter(bool a_IsSilent)
        {
            EventHandler        myHandler1 = new EventHandler(TlbCmbCharacter_SelectedIndexChanged);
            CancelEventHandler  myHandler2 = new CancelEventHandler(TlbCmbCharacter_SelectedIndexChanging);
            ToolStripComboBoxEx currCombo  = TlbCmbCharacter;

            UInt32 oldCharID = character_AllItems;

            if (null != currCombo.SelectedItem)
            {
                oldCharID = ((TextItemWithUInt32)currCombo.SelectedItem).Data;
            }

            currCombo.Items.Clear();

            TextItemWithUInt32 newItem    = new TextItemWithUInt32("[All items]", character_AllItems);
            TextItemWithUInt32 selectItem = newItem;

            currCombo.Items.Add(newItem);

            newItem = new TextItemWithUInt32("[Edit list...]", character_EditApiKeys);
            currCombo.Items.Add(newItem);

            foreach (Settings.V1._ApiChar currChar in m_Engine.m_Settings.ApiAccess.Chars)
            {
                newItem = new TextItemWithUInt32(currChar.CharacterName, currChar.CharacterID);
                currCombo.Items.Add(newItem);

                if (newItem.Data == oldCharID)
                {
                    selectItem = newItem;
                }
            }

            if (a_IsSilent || (oldCharID == selectItem.Data))
            {
                SilentSetSelectedItem(currCombo, selectItem, myHandler1, myHandler2);
            }
            else
            {
                currCombo.SelectedItem = selectItem;
            }
        }
Exemple #5
0
        private void EveMarketdataCom_Init_CmbStation()
        {
            List <TextItemWithUInt32> items = new List <TextItemWithUInt32>();

            items.Add(new TextItemWithUInt32("[All stations]", 0));

            if (null == Cmb_EveMarketdataCom_Solar.SelectedItem)
            {
                return;                 // Workaround for premature call from PopulateCombo()
            }
            UInt32 solarID = TextItemWithUInt32.GetData(Cmb_EveMarketdataCom_Solar.SelectedItem);

            foreach (EveStation currStation in m_EveDatabase.GetStations(solarID))
            {
                items.Add(new TextItemWithUInt32(currStation.Name, currStation.ID));
            }

            PopulateCombo(Cmb_EveMarketdataCom_Station, items, m_Settings.EveMarketdataCom.StationID);
        }
Exemple #6
0
        private void EveMarketdataCom_Init_CmbSolar()
        {
            List <TextItemWithUInt32> items = new List <TextItemWithUInt32>();

            items.Add(new TextItemWithUInt32("[All solar systems]", 0));

            if (null == Cmb_EveMarketdataCom_Region.SelectedItem)
            {
                return;                 // Workaround for premature call from PopulateCombo()
            }
            UInt32 regionID = TextItemWithUInt32.GetData(Cmb_EveMarketdataCom_Region.SelectedItem);

            foreach (EveSolarSystem currSystem in m_EveDatabase.GetSolarSystems(regionID))
            {
                items.Add(new TextItemWithUInt32(currSystem.Name, currSystem.ID));
            }

            PopulateCombo(Cmb_EveMarketdataCom_Solar, items, m_Settings.EveMarketdataCom.SolarID);
        }
Exemple #7
0
        private void BtnOk_Click(object sender, EventArgs e)
        {
            switch (TabProviders.SelectedIndex)
            {
            case 0:
                m_Settings.Provider = PriceProviders.EveCentral;
                break;

            case 1:
                m_Settings.Provider = PriceProviders.FuzzworkCoUk;
                break;

            case 2:
                m_Settings.Provider = PriceProviders.EveMarketdataCom;
                break;

            default:
                Debug.Assert(false, "Wrong tab page selected");
                break;
            }

            m_Settings.EveCentralCom.RegionID    = TextItemWithUInt32.GetData(Cmb_EveCentralCom_Region.SelectedItem);
            m_Settings.EveCentralCom.SolarID     = TextItemWithUInt32.GetData(Cmb_EveCentralCom_Solar.SelectedItem);
            m_Settings.EveCentralCom.PriceType   = (PriceTypes)TextItemWithUInt32.GetData(Cmb_EveCentralCom_PriceType.SelectedItem);
            m_Settings.EveCentralCom.HistoryDays = (UInt32)Txt_EveCentralCom_PriceHistory.Value;

            m_Settings.FuzzworkCoUk.IsRegion  = Rad_FuzzworkCoUk_Region.Checked;
            m_Settings.FuzzworkCoUk.RegionID  = TextItemWithUInt32.GetData(Cmb_FuzzworkCoUk_Region.SelectedItem);
            m_Settings.FuzzworkCoUk.StationID = TextItemWithUInt32.GetData(Cmb_FuzzworkCoUk_Station.SelectedItem);
            m_Settings.FuzzworkCoUk.PriceType = (PriceTypes)TextItemWithUInt32.GetData(Cmb_FuzzworkCoUk_PriceType.SelectedItem);

            m_Settings.EveMarketdataCom.RegionID  = TextItemWithUInt32.GetData(Cmb_EveMarketdataCom_Region.SelectedItem);
            m_Settings.EveMarketdataCom.SolarID   = TextItemWithUInt32.GetData(Cmb_EveMarketdataCom_Solar.SelectedItem);
            m_Settings.EveMarketdataCom.StationID = TextItemWithUInt32.GetData(Cmb_EveMarketdataCom_Station.SelectedItem);
            m_Settings.EveMarketdataCom.PriceType = (PriceTypes)TextItemWithUInt32.GetData(Cmb_EveMarketdataCom_PriceType.SelectedItem);

            this.DialogResult = DialogResult.OK;
            Close();
        }
Exemple #8
0
        private void BtnLoadSkills_Click(object sender, EventArgs e)
        {
            if (null == CmbLoadSkills.SelectedItem)
            {
                return;
            }

            UInt32 userID = TextItemWithUInt32.GetData(CmbLoadSkills.SelectedItem);

            Settings.V1._ApiKey apiKey = Engine.GetCharacterKey(m_Settings, userID);
            if (null == apiKey)
            {
                ErrorMessageBox.Show("Can't find API key for selected character");
                return;
            }

            Dictionary <UInt32, UInt32> skills = new Dictionary <UInt32, UInt32>();

            if (!LoadSkills(apiKey, userID, skills))
            {
                return;
            }

            EveSkills[] skillIDs = (EveSkills[])Enum.GetValues(typeof(EveSkills));
            foreach (EveSkills currSkill in skillIDs)
            {
                UInt32 skillLevel = 0;
                if (skills.ContainsKey((UInt32)currSkill))
                {
                    skillLevel = skills[(UInt32)currSkill];
                }

                m_Settings.Refining.Skills[(UInt32)currSkill] = skillLevel;
            }

            PrpRefining.Refresh();
        }