Exemplo n.º 1
0
        protected override void OnClick()
        {
            base.OnClick();
            ReportTimeEventArgs newEvent = new ReportTimeEventArgs(MyClickEvent, this);

            newEvent.ClickTime = DateTime.Now;
            this.RaiseEvent(newEvent);
        }
Exemplo n.º 2
0
        private void MyButton_MyClick(object sender, ReportTimeEventArgs e)
        {
            FrameworkElement element = sender as FrameworkElement;

            if (element != null)
            {
                string timeStr = e.ClickTime.ToLongDateString();
                string content = string.Format("{0} arrived {1}", timeStr, element.Name);
                listBox.Items.Add(content);
            }
        }