private void Form1_Load(object sender, EventArgs e) { CustomProcess theProcess = new CustomProcess(); var x = theProcess.Process().ToObservable(); curProgressBar.Maximum = 10; x.Subscribe((i) => { curProgressBar.Value = i; }); }
private void Form1_Load(object sender, EventArgs e) { CustomProcess theProcess = new CustomProcess(); var x = Observable.FromEventPattern(theProcess, "TaskCompleted"); curProgressBar.Maximum = 4; x.Subscribe((a) => { curProgressBar.Value = ((CustomProcess)a.Sender).Counter; }); theProcess.Process(); }