public MainWindowViewModel() { Weapon = new Weapon(); var typesTableAdapter = new Database1DataSetTableAdapters.TypesTableAdapter(); TypesDataTable = typesTableAdapter.GetData(); WeaponTypes = new ObservableCollection <Type>(TypesDataTable.Select(typesRow => new Type(typesRow))); var variantsTableAdapter = new Database1DataSetTableAdapters.VariantsTableAdapter(); VariantsDataTable = variantsTableAdapter.GetData(); var weaponsTableAdapter = new Database1DataSetTableAdapters.WeaponsTableAdapter(); WeaponsDataTable = weaponsTableAdapter.GetData(); //var weapons = WeaponsDataTable.Select(weaponsRow => new Weapon(weaponsRow)).ToList(); BaseBulletDamageString = "100"; XString = "0,6"; Firearms = 100; ReloadSpeedString = "0,5"; HeadshotDamageString = "1,5"; CriticalHitChanceString = "0,5"; CriticalHitDamageString = "0,5"; MagazineSizeBonusString = "0,5"; PropertyChanged += OnPropertyChanged; }
internal static Type GetType(string typeName) { var typeTableAdapter = new Database1DataSetTableAdapters.TypesTableAdapter(); var types = typeTableAdapter.GetData(); var typeRow = types.FirstOrDefault(row => row.Name == typeName); return(new Type(typeRow)); }