/// <summary> /// Listen for changes to a collection item property change /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ListItem_PropertyChanged(object sender, PropertyChangedEventArgs e) { if ("IsReceived" == e.PropertyName.ToString()) { SelectedCartOwner = sender as GolfCart; if (SelectedCartOwner.IsReceived) { SelectedCartOwner.ReceivedDate = DateTime.Now; } else { SelectedCartOwner.ReceivedDate = null; } if (this.IsDirty) { RaisePropertyChanged("DataChanged"); } } }
static void Main(string[] args) { Commander theCommander = new Commander("Adama", "William", "Cylonsred"); CheifMate theCheifMate = new CheifMate("John", "Doe", "Black"); Engine ftl = new Engine(0001, true, "Faster than light dirve"); Engine cbe = new Engine(0100, false, "Yamaha G19"); Galactica galactica = new Galactica("Battlestar Galactica", 1978, true, ftl, theCommander, theCheifMate, "gray"); GolfCart viper = new GolfCart("Slow Car", 1470, false, cbe, theCommander, "green"); galactica.ParkTheVehicle(); viper.ParkTheVehicle(); theCommander.Drinking(); theCheifMate.Turning(); Console.WriteLine($"{galactica.Commander.FirstName} are the {galactica.Commander.Rank} of the {galactica.Brand}"); Console.WriteLine($"{galactica.CheifMate.FirstName} are the {galactica.CheifMate.Rank} of the {galactica.Brand}"); Console.ReadKey(); }
/// <summary> /// Validates a grid row /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tableViewDetail_ValidateRow(object sender, DevExpress.Xpf.Grid.GridRowValidationEventArgs e) { GolfCart row = e.Row as GolfCart; try { if (null != row) { // TO-DO: add validation rules } } catch (Exception ex) { MessageBox.Show("Row Error: " + ex.Message); } finally { if (e.IsValid) { // TO-DO: ? } e.Handled = true; } }