alertdialog - Pop up Alert box when deadline is coming in wpf -
in wpf application have startdate , enddate of event, implement pop alert box show warning message automatically when enddate coming (say 5 days before enddate). in screenshot when click clientdeadlines (itemtab header in wpf), alert box comes out. how can achieve function? samples appreciate. in advance.
in wpf can use dispatchertimer in system.windows.threading..
dispatchertimer timer = new dispatchertimer(); datetime mydeadline = new datetime(); public void inittimer() { // checks every minute timer.interval = new timespan(0, 1, 0); timer.tick += timer_tick; timer.start(); } void timer_tick(object sender, eventargs e) { if ((mydeadline - datetime.now).totaldays <= 5) messagebox.show("your alert message"); }
edit : want display alert message everytime user clicks clientdeadlines subscribe selectionchanged event in tabcontrol.
<tabcontrol selectionchanged="tabcontrol_selectionchanged_1" horizontalalignment="left" height="100" margin="46,90,0,0" verticalalignment="top" width="397"> <tabitem name="tab1" header="check1"> <grid background="#ffe5e5e5"/> </tabitem> <tabitem name="clientdeadlines" header="check2" height="23" verticalalignment="bottom"> <grid background="#ffe5e5e5"/> </tabitem> </tabcontrol>
and use code behind
private void tabcontrol_selectionchanged_1(object sender, selectionchangedeventargs e) { if (e.source tabcontrol) { if (clientdeadlines.isselected) { // code check time int = 0; } } }
Comments
Post a Comment