Last active
August 29, 2015 13:57
-
-
Save evonsdesigns/9521811 to your computer and use it in GitHub Desktop.
Threadsafe calls for C# WinForms, with zero parameters in method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create the callback method | |
delegate Boolean checkIfMoveToUploadedFolderCallback(); | |
// define the method to be called | |
private Boolean checkIfMoveToUploadedFolder() | |
{ | |
// check control property InvokeRequired | |
if (cb_moveToUploadedFolder.InvokeRequired) | |
{ | |
// create an instance of the delegate with this method's name | |
checkIfMoveToUploadedFolderCallback s = new checkIfMoveToUploadedFolderCallback(checkIfMoveToUploadedFolder); | |
// return a casted invocation of the callback | |
return (Boolean)this.Invoke(s); | |
} | |
else | |
{ | |
// perform the access on the control's object as expected | |
return cb_moveToUploadedFolder.Checked; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment