Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- partial class MySustainedDialog : Form {
- public MySustainedDialog(string msg) {
- InitializeComponent();
- lbMessage.Text = msg;
- }
- public new void Show() {
- base.ShowDialog();
- }
- public new void Hide() {
- this.Close();
- }
- }
- public class MyNoConnectionDialog : INoConnectionDialog {
- private FakeSustainedDialog _dialog;
- public void Show() {
- var w = new BackgroundWorker();
- w.DoWork += delegate {
- _dialog = new MySustainedDialog("Connection Lost");
- _dialog.Show();
- };
- w.RunWorkerAsync();
- }
- public void Hide() {
- _dialog.Close();
- }
- }
- public new void Hide()
- {
- if (this.InvokeRequired)
- {
- this.BeginInvoke((MethodInvoker)delegate { this.Hide(); });
- return;
- }
- this.Close();
- }
Add Comment
Please, Sign In to add comment