-
Notifications
You must be signed in to change notification settings - Fork 0
/
RCallback.cs
76 lines (73 loc) · 1.53 KB
/
RCallback.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
* Created by SharpDevelop.
* User: Jake Gustafson, all rights reserved (Owner)
* Date: 11/26/2005
* Time: 7:25 PM
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Windows.Forms;
namespace ExpertMultimedia {
/// <summary>
/// Class to be used as thread-safe reporting delegate.
/// </summary>
public class RCallback {
public System.Windows.Forms.Form formX=null;
public System.Windows.Forms.TextBox sbX=null;
public bool bFreeze=false;//whether to keep message on top
public RCallback() {
//formX=null;
//sbX=null;
//bFreeze=false
}
public string sStatus {
set {
UpdateStatus(value);
}
}
public bool UpdateForm() {
try {
if (formX!=null) formX.Refresh();
}
catch (Exception exn) {
return false;
}
return true;
}
public bool UpdateStatus(string sUpdate) {
bool bGood=true;
try {
if (!bFreeze) {
if (sbX!=null) sbX.Text=sUpdate;
bGood=UpdateStatus();
}
}
catch (Exception exn) {
return false;
}
if (bGood) bGood=UpdateForm();
return bGood;
}
public string GetStatus() {
bool bGood=true;
string sReturn="";
try {
if (sbX!=null) sReturn=sbX.Text;
}
catch (Exception exn) {
return "Can't get status.";
}
return sReturn;
}
public bool UpdateStatus() {
try {
if (formX!=null) formX.Refresh();
}
catch (Exception exn) {
return false;
}
return true;
}
}
}