-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWaitForm1.cs
More file actions
66 lines (62 loc) · 2.08 KB
/
WaitForm1.cs
File metadata and controls
66 lines (62 loc) · 2.08 KB
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
// Developer Express Code Central Example:
// How to cancel time-consuming operation from the WaitForm
//
// This example illustrates how to cancel a time-consuming operation on a WaitForm.
// To accomplish this task, place a BackgroundWorker and SplashScreenManager onto a
// Form, and add the Cancel button in the WaitForm's designer. The main idea is to
// perform data loading in a background thread, pass the ILocked object both to the
// WaitForm and to this thread, and check its condition while data is loading.
//
// You can find sample updates and versions for different programming languages here:
// http://www.devexpress.com/example=E4524
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraWaitForm;
using System.Threading;
namespace WaitFormCanceling
{
public partial class WaitForm1 : WaitForm
{
public WaitForm1()
{
InitializeComponent();
this.progressPanel1.AutoHeight = true;
}
object locker;
#region Overrides
public override void SetCaption(string caption)
{
base.SetCaption(caption);
this.progressPanel1.Caption = caption;
}
public override void SetDescription(string description)
{
base.SetDescription(description);
this.progressPanel1.Description = description;
}
public override void ProcessCommand(Enum cmd, object arg)
{
base.ProcessCommand(cmd, arg);
WaitFormCommand command = (WaitFormCommand)cmd;
if (command == WaitFormCommand.SendObject)
{
locker = arg;
}
}
#endregion
public enum WaitFormCommand
{
SendObject
}
private void simpleButton1_Click(object sender, EventArgs e)
{
if(locker!=null)
((ILocked)locker).IsCanceled = true;
}
}
}