private void ActivityDetailForm_Load(object sender, EventArgs e) { DataRowView view = this.BindingContext[adaScheduleDataSet1, ACTIVITY_TABLE].Current as DataRowView; ADAScheduleDataSet.ActivityRow activityRow = view.Row as ADAScheduleDataSet.ActivityRow; if (!activityRow.IsSymbolIdNull()) { if (!activityRow.SymbolRow.IsImageNull()) { byte[] image = activityRow.SymbolRow.Image; this.pictureBoxImage.Image = ImageEngine.Resize(ImageEngine.FromArray(image), this.pictureBoxImage.Size); } } ADAScheduleDataSet.Activity_ReminderRow[] activityReminderRows = activityRow.GetActivity_ReminderRows(); foreach (ADAScheduleDataSet.Activity_ReminderRow activityReminderRow in activityReminderRows) { if (!activityReminderRow.IsTimeNull() && activityReminderRow.ReminderId == ADADataAccess.Constants.ALARM_REMINDER_ID) { this.dateTimePickerAlarm.Value = activityReminderRow.Time; _alarmTimeSpan = activityReminderRow.Time - activityRow.EndTime; } } buttonPlaySound.Enabled = (!activityRow.IsSymbolIdNull() && !activityRow.SymbolRow.IsSoundNull()); }
private void buttonChangeSymbol_Click(object sender, EventArgs e) { DataRowView view = this.BindingContext[adaScheduleDataSet1, ACTIVITY_TABLE].Current as DataRowView; ADAScheduleDataSet.ActivityRow activityRow = view.Row as ADAScheduleDataSet.ActivityRow; SymbolPicker picker = new SymbolPicker(); SymbolDataSet.LocalizedSymbolRow symbolRow = picker.PickSymbol(this, activityRow.IsSymbolIdNull() ? -1 : activityRow.SymbolId); if (symbolRow != null) { if (adaScheduleDataSet1.Symbol.FindBySymbolId(symbolRow.SymbolId) == null) { ADAScheduleDataSet.SymbolRow newRow = adaScheduleDataSet1.Symbol.NewSymbolRow(); newRow.SymbolId = symbolRow.SymbolId; if (!symbolRow.IsSoundNull()) { newRow.Sound = symbolRow.Sound; } if (!symbolRow.IsImageNull()) { newRow.Image = symbolRow.Image; } adaScheduleDataSet1.Symbol.AddSymbolRow(newRow); } byte[] image = symbolRow.Image; if (image != null) { this.pictureBoxImage.Image = ImageEngine.Resize(ImageEngine.FromArray(image), this.pictureBoxImage.Size); } buttonPlaySound.Enabled = !symbolRow.IsSoundNull(); this.BindingContext[adaScheduleDataSet1, ACTIVITY_TABLE].EndCurrentEdit(); view.BeginEdit(); activityRow.Name = symbolRow.Name; activityRow.SymbolId = symbolRow.SymbolId; activityRow.Image = image; view.EndEdit(); } }