Exemplo n.º 1
0
        public MonsterUI()
        {
            try { app = MonsterGear.GetInstance(); }
            catch (Exception ex) { Error(ex.Message); }

            InitializeComponent();

            about.Visible       = false;
            resultInfo.Text     = "";
            skillNameText.Text  = "";
            skillDescText.Text  = "";
            skillExtraText.Text = "";

            skillsList.DataSource    = MonsterGear.skills;
            favoritesList.DataSource = favorites;

            gemSlot1_Combo.DataSource = new int[] { 0, 1, 2, 3 };
            gemSlot2_Combo.DataSource = new int[] { 0, 1, 2, 3 };
            gemSlot3_Combo.DataSource = new int[] { 0, 1, 2, 3 };
            // These must be added here otherwise the event is fired when assigning DataSource, while not all combobox are ready.
            gemSlot1_Combo.SelectedIndexChanged += new EventHandler(this.weaponSlot_Changed);
            gemSlot2_Combo.SelectedIndexChanged += new EventHandler(this.weaponSlot_Changed);
            gemSlot3_Combo.SelectedIndexChanged += new EventHandler(this.weaponSlot_Changed);

            resultPanel.Controls.Add(resultControl);

            LoadConfig();
        }
Exemplo n.º 2
0
 public static MonsterGear GetInstance()
 {
     if (_singleton == null)
     {
         _singleton = new MonsterGear();
     }
     return(_singleton);
 }
Exemplo n.º 3
0
 private void LoadConfig()
 {
     try
     {
         Configuration config = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath);
         string        conf   = config.AppSettings.Settings["favs"].Value;
         if (conf != null && conf.Length != 0)
         {
             string[] favs = conf.Split(';');
             foreach (string f in favs)
             {
                 try
                 {
                     int     id = int.Parse(f);
                     SkillId s  = MonsterGear.GetSkillId(id);
                     addFavorite(s);
                 }
                 catch (Exception) {} // Just discard this buggy favorite entry
             }
         }
     }
     catch (Exception) {} // Happens at least when no config exists. It will be created when the program closes anyway.
 }