public List<string> ListFeaturesQuery(Character mC)
 {
     List<string> tempList = new List<string>();
     foreach (CharacterClass cc in mC.Classes)
     {
         tempList.Add("SELECT feature1, feature2, feature3 FROM '"+cc.Name+"' WHERE level BETWEEN 0 AND "+cc.Level);
     }
     return tempList;
 }
        public void AddCharacter(Character character)
        {
            if (character == null) throw new ArgumentNullException("character");

            if (!_characters.Contains(character))
            {
                _characters.Add(character);
                if (this.CharacterAdded != null)
                    this.CharacterAdded(this, new CharacterAddedEventArgs(character));
            }
        }
 public FeatureRepository(Character mC)
 {
     if (_features == null)
     {
         _features = new List<Feature>();
     }
     List<Feature> tempList = LoadFeatures(mC);
     if (tempList != null)
     {
         _features = tempList;
     }
 }
 public CharacterViewModel()
 {
     MyCharacter = new Character();
     AbilityList = MyCharacter.Abilities;
     AllAbilities = GetAbilityViewModels();
     XP = MyCharacter.XP;
     //AllAbilities = new ObservableCollection<Ability>
     //{
     //    new Ability("Strength"), new Ability("Dexterity"), new Ability("Constitution"), new Ability("Intelligence"), new Ability("Wisdom"), new Ability("Charisma")
     //};
     
     this.PropertyChanged += characterViewModel_PropertyChanged;
 }
 public CharacterViewModel(Character nmc)
 {
     MyCharacter = nmc;
     //AllAbilities = nmc.Abilities;
     PropertyChanged += characterViewModel_PropertyChanged;
 }
 public bool ContainsCharacter(Character character)
 {
     if (character == null)
         throw new ArgumentNullException("character");
     return _characters.Contains(character);
 }
 public CharacterAddedEventArgs(Character newCharacter)
 {
     this.NewCharacter = newCharacter;
 }
        public List<string> GetListTest(Character mC)
        {
            List<string> ListofStuff = new List<string>();

            

            using (SQLiteConnection con = new SQLiteConnection(@"Data Source=database.db;Version=3;"))
            {
                con.Open();
                using (SQLiteCommand fmd = con.CreateCommand())
                {
                    //Query string, need to change
                    foreach (CharacterClass cc in mC.Classes)
                    {
                        fmd.CommandText = "SELECT feature1, feature2, feature3 FROM '"+cc.Name+"' WHERE level BETWEEN 0 AND "+cc.Level;
                        fmd.CommandType = CommandType.Text;
                        SQLiteDataReader dr = fmd.ExecuteReader();
                        while (dr.Read())
                        {
                            for (int ii = 0; ii < 3; ii++)
                            {
                                if (dr.IsDBNull(ii) == false)
                                {
                                    ListofStuff.Add(dr.GetString(ii));
                                }
                            }
                        }
                        dr.Close();
                    
                    
                    //SQLiteCommand command = new SQLiteCommand(q);

                        //ListofStuff.Add(Convert.ToString(dr["feature1"]));
                        //ListofStuff.Add(Convert.ToString(dr["feature2"]));
                        //ListofStuff.Add(Convert.ToString(dr["feature3"]));
                    }
                }
            }
            return ListofStuff;
        }
 public List<string> DetailFeaturesQuery(Character mC)
 {
     List<string> tempList = new List<string>();
     foreach (CharacterClass cc in mC.Classes)
     {
         tempList.Add("SELECT Features.* FROM "+cc.Name+" JOIN Features ON Name = "+cc.Name+".feature1 OR NAME = "+cc.Name+".feature2 OR NAME = "+cc.Name+".feature3 WHERE "+cc.Name+".level BETWEEN 0 AND "+cc.Level); 
     }
     return tempList;
 }
Example #10
0
 public List<Feature> LoadFeatures(Character character)
 {
     List<Feature> featureList = new List<Feature>();
     List<string> tempL = ListFeaturesQuery(character);
     using (SQLiteConnection con = new SQLiteConnection(@"Data Source=database.db;Version=3;"))
     {
         con.Open();
         using (SQLiteCommand fmd = con.CreateCommand())
         {
             foreach (string s in tempL)
             {
                 fmd.CommandText = s;
                 fmd.CommandType = CommandType.Text;
                 SQLiteDataReader dr = fmd.ExecuteReader();
                 while (dr.Read())
                 {
                     for (int ii = 0; ii < 3; ii++)
                     {
                         if (dr.IsDBNull(ii) == false)
                         {
                             featureList.Add(new Feature(dr.GetString(ii)));
                         }
                     }
                 }
                 dr.Close();
             }
         }
     }
     return featureList;
     
 }
 // CONSTRUCTORS
 public CharacterCreationViewModel()
 {
     TestCommand = new RelayCommand(Test);
     NewCharacter = new Character();
     //Strength = NewCharacter.Str.Value;
     //Dexterity = NewCharacter.Dex.Value;
     //Constitution = NewCharacter.Con.Value;
     //Intelligence = NewCharacter.Int.Value;
     //Wisdom = NewCharacter.Wis.Value;
     //Charisma = NewCharacter.Chr.Value;
     RaceViewModelTest = new RaceViewModelTest();
     SelectedRace = new Race();
     RaceViewModelTest.TestName = "Changed Name";
     //PropertyChanged += CharacterCreationViewModel_PropertyChanged;
     PropertyChanging +=CharacterCreationViewModel_PropertyChanging;
 }