Exemplo n.º 1
0
        private void TargetingAddSettingBtn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (!String.IsNullOrEmpty(TargetingAddSettingTxt.Text))
                {

                    if (TargetingMonstersListBox.SelectedItems.Count == 0)
                    {
                        System.Windows.Forms.MessageBox.Show("Firstly select a monster to which you want to add a setting","ExTibia",System.Windows.Forms.MessageBoxButtons.OK,System.Windows.Forms.MessageBoxIcon.Information);
                        return;
                    }

                    var dataContext = TargetingMonstersListBox.SelectedItems[0];
                    TargetinRule targetingRule = (TargetinRule)dataContext;

                    TargetSetting settingOne = new TargetSetting();
                    settingOne.Name = String.Format("Settings {0}", targetingRule.Settings.Count + 1);
                    targetingRule.Settings.Add(settingOne);
                    TargetingAddSettingTxt.Text = "";
                }
            }
            catch(Exception ex)
            {
                Helpers.Debug.Report(ex);
            }
        }
Exemplo n.º 2
0
        private void TargetingAddMonsterbtn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (!String.IsNullOrEmpty(TargetingAddMonsterTxt.Text))
                {
                    TargetinRule targetingRule = new TargetinRule();
                    targetingRule.MonsterName = TargetingAddMonsterTxt.Text;

                    TargetSetting settingOne = new TargetSetting();

                    settingOne.Name = String.Format("Settings {0}", targetingRule.Settings.Count + 1);

                    targetingRule.Settings.Add(settingOne);

                    Targeting.Instance.TargetingRules.Add(targetingRule);

                    TargetingAddMonsterTxt.Text = "";
                }
            }
            catch
            {

            }
        }