c# - How to wait for callback event return value -
eidreader eidobj; static fancypopup fancyobj; calss uipdate { uiupdate() { eidobj = new eidreader();//only contact card eidobj.devicearrival += eidobj_devicearrival; eidobj.datareceived += eidreader_datareceived; } } bool eidobj_devicearrival(stirng name) { //device arrived , notifyicon = new taskbaricon(this); notifyicon.icon = resources.led; notifyicon.tooltiptext = devicename + " reader application"; notifyicon.visibility = visibility.visible; fancyobj = new fancypopup(); notifyicon.traypopup = fancyobj; } bool eidreader_datareceived(string[] carddata, string[] publicdata, system.drawing.image imgphoto) { if (carddata != null) { fancyobj.clickcount = publicdata[(int)eidreader.ecardinfo.csnvalue]; // here fancyobj null, rising exception. , dont know why becomming null. } return true; } // in class class eidreader{ public delegate bool ondevicearrival(string devicename); public event ondevicearrival devicearrival; eidreader() { if (devicearrival != null) { devicearrival(readermgr.readers[mdevtype].readername) // here need wait callback return value since ui update going in main form. } } }
i have many callback events ui form , need wait every event whether ui update done or not.
e.g. in devicearrival callback event updating device name in ui, don't know whether ui update done or not here.
when calling datareceived() call event fancyobj instance null. why fancyobj getting null though intialize in callback event.
Comments
Post a Comment