protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); ReminderHitInfo hitInfo = CalcHitInfo(e.Location); HotTrackButtonInfo = null; UpdateButton(hitInfo, State.Pressed); if (HotTrackButtonInfo != null) { ButtonClickEventArgs eventArgs = new ButtonClickEventArgs() { Handled = false, Button = HotTrackButtonInfo.Owner }; RaiseButtonClick(this, eventArgs); if (!eventArgs.Handled) { if (eventArgs.Button.Kind == ButtonKind.HeaderAdd) { Notes.AddNote("New Note", DateTime.Now, RepeatMode.EveryDay); ReminderListBox.SelectedIndex = ReminderListBox.Items.Count - 1; } else if (eventArgs.Button.Kind == ButtonKind.Note) { View = ViewKind.Edit; } else { View = ViewKind.View; } } } }
protected virtual void RaiseButtonClick(System.Object sender, ButtonClickEventArgs ea) { ButtonClickEventHandler handler = ButtonClick; if (handler != null) { handler(sender, ea); } }