示例#1
0
        private void ReportTimeHandler(object sender, ReportTimeEventArgs e)
        {
            FrameworkElement element = sender as FrameworkElement;
            string           timeStr = e.ClickTime.ToLongTimeString();
            string           content = string.Format("{0}到达{1}", timeStr, element.Name);

            this.listBox.Items.Add(content);
        }
示例#2
0
        //激发路由事件,借用Click事件的激发方法
        protected override void OnClick()
        {
            base.OnClick(); //保证Button原有功能正常使用,Click事件能被激发

            ReportTimeEventArgs args = new ReportTimeEventArgs(ReportTimeEvent, this);

            args.ClickTime = DateTime.Now;
            this.RaiseEvent(args);
        }