internal void InsertRecord(ConstructionDock rpData) { var rPort = KanColleGame.Current.Port; var rShip = rpData.Ship; var rSecretaryShip = rPort.Fleets[1].Ships[0].Info; var rHeadquarterLevel = rPort.Admiral.Level; var rEmptyDockCount = !rpData.IsLargeShipConstruction.Value ? (int?)null : rPort.ConstructionDocks.Values.Count(r => r.State == ConstructionDockState.Idle); using (var rCommand = Connection.CreateCommand()) { rCommand.CommandText = "INSERT INTO construction(time, ship, fuel, bullet, steel, bauxite, dev_material, flagship, hq_level, is_lsc, empty_dock) " + "VALUES(strftime('%s', 'now'), @ship, @fuel, @bullet, @steel, @bauxite, @dev_material, @flagship, @hq_level, @is_lsc, @empty_dock);"; rCommand.Parameters.AddWithValue("@ship", rShip.ID); rCommand.Parameters.AddWithValue("@fuel", rpData.FuelConsumption); rCommand.Parameters.AddWithValue("@bullet", rpData.BulletConsumption); rCommand.Parameters.AddWithValue("@steel", rpData.SteelConsumption); rCommand.Parameters.AddWithValue("@bauxite", rpData.BauxiteConsumption); rCommand.Parameters.AddWithValue("@dev_material", rpData.DevelopmentMaterialConsumption); rCommand.Parameters.AddWithValue("@flagship", rSecretaryShip.ID); rCommand.Parameters.AddWithValue("@hq_level", rHeadquarterLevel); rCommand.Parameters.AddWithValue("@is_lsc", rpData.IsLargeShipConstruction); rCommand.Parameters.AddWithValue("@empty_dock", rEmptyDockCount); rCommand.ExecuteNonQuery(); } }
internal ConstructionDockViewModel(ConstructionDock rpConstructionDock) { r_Source = rpConstructionDock; Observable.FromEventPattern <PropertyChangedEventArgs>(r_Source, nameof(r_Source.PropertyChanged)) .Select(r => r.EventArgs.PropertyName).Subscribe(OnPropertyChanged); }