با سلام
تو کد مربوط به فرم:
delegatevoiddelServerStatus( bool isStarted );
publicvoid ServerStatus2( bool isStarted ) {
delServerStatus myDel = newdelServerStatus( ServerStatus );
Invoke( myDel, newobject[] { isStarted } );
}
publicvoid ServerStatus( bool isStarted ) {
lblStatus.ImageIndex = isStarted ? 1 : 0;
}
و در کد مربوط به thread دیگه ( که در یک static class قرار داره ):
publicstaticShowStatusDelegate ShowStatus;
privatestaticbool isStarted {
get { return _isStarted; }
set {
_isStarted = value;
ShowStatus( _isStarted );
}
}
که این ShowStatus در متد load فرم مقدار میگیرد به این شکل:
SSPCServer.ShowStatus = new SSPCManager.ShowStatusDelegate( ServerStatus2 );
خودم هم متوجه هستم که ظاهراً یه جایی دارم اشتباه میکنم. اما نکته اینه که برنامه کاملاً درست کار میکنه. حالا هم دوست دارم بدونم که چرا اینطوری داره کار میکنه و هم این که میخوام بدونم درستش چطوریه.
با سپاس
صبا صبوحی