SHARE
TWEET

Untitled

a guest Jun 24th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class myClass
  2.     {
  3.        public delegate void OverTheLimitDlg(int arg);
  4.        public event OverTheLimitDlg OverTheLimit;
  5.        public myClass()
  6.        {
  7.            myValue = 0;
  8.        }
  9.        private int myvalue = 0;
  10.        public int myValue
  11.        {
  12.           get { return myvalue;}
  13.           set
  14.           {
  15.              myValue = value;
  16.              if(value > 5)
  17.                 OvertheLimit(value);
  18.           }
  19.         }
  20.     }
  21.      
  22. myClass myObj;
  23.  
  24. private void Form_Load(object sender, EventArgs e)
  25. {
  26.    myObj = new myClass();
  27.    myObj.OverTheLimit += SubsMethod;
  28.    backgroundworker.RunWorkerAsync();
  29. }
  30. backgroundworker_DoWork(...)
  31. {
  32.    myObj.myValue = 10;
  33.    //Some expressions.
  34. }
  35.  
  36. private void SubsMethod(int someInt)
  37. {
  38.    myLabel.Text = "Oh it's over the limit!";
  39. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top