本文整理汇总了C#中DoWorkEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# DoWorkEventArgs类的具体用法?C# DoWorkEventArgs怎么用?C# DoWorkEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DoWorkEventArgs类属于命名空间,在下文中一共展示了DoWorkEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: bg_DoWork
void bg_DoWork(object sender, DoWorkEventArgs e)
{
ObservableCollection<WirelessDevice> devices = new ObservableCollection<WirelessDevice>();
WlanClient client = new WlanClient();
foreach (WlanClient.WlanInterface wlanIface in client.Interfaces)
{
// Lists all networks in the vicinity
Wlan.WlanAvailableNetwork[] networks = wlanIface.GetAvailableNetworkList(0);
foreach (Wlan.WlanAvailableNetwork network in networks)
{
string ssid = GetStringForSSID(network.dot11Ssid);
string msg = "Found network with SSID " + ssid;
log.dispatchLogMessage(msg);
msg = "Signal: " + network.wlanSignalQuality;
log.dispatchLogMessage(msg);
msg = "BSS Type : " + network.dot11BssType;
log.dispatchLogMessage(msg);
msg = "Profile Name : " + network.profileName;
log.dispatchLogMessage(msg);
log.dispatchLogMessage("");
WirelessDevice d = new WirelessDevice(ssid, network.wlanSignalQuality);
devices.Add(d);
}
}
_unsecuredDevices = devices;
e.Result = _unsecuredDevices;
}
示例2: RTBackground_DoWork
private void RTBackground_DoWork(object sender, DoWorkEventArgs e)
{
try
{
ProcessStartInfo RTStartInfo = new ProcessStartInfo();
if (Environment.OSVersion.Platform == PlatformID.Win32NT) { RTStartInfo = new ProcessStartInfo("\"" + MySettings.ProgramPath + "\"", e.Argument.ToString()); }
else if (Environment.OSVersion.Platform == PlatformID.Unix) { RTStartInfo = new ProcessStartInfo("rawtherapee", e.Argument.ToString()); }
else if (Environment.OSVersion.Platform == PlatformID.MacOSX) { RTStartInfo = new ProcessStartInfo("rawtherapee", e.Argument.ToString()); }
else { e.Result = InfoType.InvalidOS; return; }
RTStartInfo.UseShellExecute = false;
RTStartInfo.CreateNoWindow = true;
RT.StartInfo = RTStartInfo;
RT.Start();
lastTime = DateTime.Now.Ticks;
RT.WaitForExit();
e.Result = InfoType.OK;
}
catch (Exception ex)
{
ThreadException = ex;
e.Result = InfoType.Error;
}
}
示例3: checkPeriodically
public void checkPeriodically(object sender, DoWorkEventArgs e)
{
Thread.Sleep(1000);//Wait 10s for Steambot to fully initialize
while (true)
{
double newConversionRate = getConversionRate();
if (newConversionRate != -1)
conversionRate = newConversionRate;
DataSet verified_adds = returnQuery("SELECT * FROM add_verification a,users u WHERE verified=1 AND a.userID=u.userID");
if (verified_adds != null)
{
for (int r = 0; r < verified_adds.Tables[0].Rows.Count; r++)
{
BotManager.mainLog.Success("Add verified: " + verified_adds.Tables[0].Rows[r][2].ToString() + " DOGE to user " + verified_adds.Tables[0].Rows[r][1].ToString());
returnQuery("UPDATE users SET balance = balance + " + verified_adds.Tables[0].Rows[r][2].ToString() + " WHERE userID = " + verified_adds.Tables[0].Rows[r][1].ToString());
returnQuery("DELETE FROM add_verification WHERE addID = " + verified_adds.Tables[0].Rows[r][0].ToString());
SteamID userID = new SteamID();
userID.SetFromUInt64(ulong.Parse(verified_adds.Tables[0].Rows[r][6].ToString()));
Bot.SteamFriends.SendChatMessage(userID, EChatEntryType.ChatMsg, verified_adds.Tables[0].Rows[r][2].ToString() + " DOGE was successfully added to your tipping balance.");
BotManager.mainLog.Success("Registered user successfully added " + verified_adds.Tables[0].Rows[r][2].ToString() + " DOGE to their balance.");
}
}
Thread.Sleep(30000);
}
}
示例4: bkgndWkr_DoWork
void bkgndWkr_DoWork (Object sender, DoWorkEventArgs e)
{
e.Result = 5566;
e.Cancel = true;
m_doWorkException = new RankException ("Rank exception manually created and thrown in _DoWork.");
throw m_doWorkException;
}
示例5: CtorTest
public static void CtorTest(object expectedArgument)
{
var target = new DoWorkEventArgs(expectedArgument);
Assert.Equal(expectedArgument, target.Argument);
Assert.False(target.Cancel);
Assert.Null(target.Result);
}
示例6: bgwInit_DoWork
private void bgwInit_DoWork(object sender, DoWorkEventArgs e)
{
UserAccessLevel accessLvl = UserAccessLevel.None;
DataRow dtrRow = (DataRow)e.Argument;
switch ((string)dtrRow["role"])
{
case "Admin":
accessLvl = UserAccessLevel.Admin;
break;
case "Instructor":
accessLvl = UserAccessLevel.Instructor;
break;
case "Counter Staff":
accessLvl = UserAccessLevel.CounterStaff;
break;
case "Owner":
accessLvl = UserAccessLevel.Owner;
break;
default:
MessageBox.Show(this, "Database error.\n Unexpected value in Staff.Role. Notify an administrator.",
"Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
Application.Exit();
break;
}
contentForm = new frmMain(programDatabase, new User((string)dtrRow["name"], (string)dtrRow["username"], (string)dtrRow["password"], accessLvl));
}
示例7: HandleWorkerDoWork
/// <summary>
/// This runs in a different thread and outputs to the javascript log.
/// </summary>
/// <param name='sender'>
/// Sender.
/// </param>
/// <param name='e'>
/// E.
/// </param>
void HandleWorkerDoWork(object sender, DoWorkEventArgs e)
{
JavascriptLogger jsLogger = new JavascriptLogger("Threaded Logger");
while(true)
{
jsLogger.LogInfo("Ping " + DateTime.Now);
Thread.Sleep(3000);
}
}
示例8: bw_DoWork
void bw_DoWork(object sender, DoWorkEventArgs e)
{
try
{
Start();
}
catch (Exception ex)
{
WriteError(ex.Message);
}
}
示例9: bwExport_DoWork
void bwExport_DoWork(object sender, DoWorkEventArgs e)
{
try
{
mb.ExportToFile(Program.TargetFile);
}
catch (Exception ex)
{
CloseConnection();
MessageBox.Show(ex.ToString());
}
}
示例10: worker_DoWork
static void worker_DoWork(object sender, DoWorkEventArgs e)
{
Console.WriteLine("Starting to do some work now...");
int i;
for (i = 1; i < 10; i++)
{
Thread.Sleep(1000);
worker.ReportProgress(Convert.ToInt32((100.0 * i) / 10));
}
e.Result = i;
}
示例11: bgwAuditLogs_DoWork
private void bgwAuditLogs_DoWork(object sender, DoWorkEventArgs e)
{
try
{
string[] arg = e.Argument.ToString().Split('|');
AccessTypes AccessType = (AccessTypes)Enum.Parse(typeof(AccessTypes), arg[0]);
string Remarks = arg[1];
Methods.InsertAuditLog(mclsTerminalDetails, mCashierName, AccessType, Remarks);
}
catch{ }
}
示例12: backgroundWorker1_DoWork
private void backgroundWorker1_DoWork(
object sender,
DoWorkEventArgs e)
{
document = new XmlDocument();
// Uncomment the following line to
// simulate a noticeable latency.
//Thread.Sleep(5000);
// Replace this file name with a valid file name.
document.Load(@"http://www.tailspintoys.com/sample.xml");
}
示例13: DoWork
private void DoWork(object sender, DoWorkEventArgs e)
{
ExternalApp app = new ExternalApp();
Options opts = sender as Options;
app.Options = sender as Options;
if (!app.Run())
{
//MessageBox.Show("HDFExporter tool has failed.", "ATTENTION", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
示例14: bgwTurret_DoWork
private void bgwTurret_DoWork(object sender, DoWorkEventArgs e)
{
try
{
string[] arg = e.Argument.ToString().Split('|');
string szString = arg[0].ToString();
string strTransactionNo = arg[1].ToString();
RawPrinterHelper.SendStringToPrinter(mclsTerminalDetails.TurretName, "\f" + szString, "RetailPlus Turret Disp: " + strTransactionNo);
}
catch { }
}
示例15: bgwPrintInvoice_DoWork
void bgwPrintInvoice_DoWork(object sender, DoWorkEventArgs e)
{
//Print Invoice for Currently selected record
try
{
PrintDocument pd = (PrintDocument)e.Argument;
pd.PrintPage += new PrintPageEventHandler(PrintPage);
pd.Print();
((BackgroundWorker)sender).ReportProgress(100, "Print Completed");
}
catch (Exception ae)
{
((BackgroundWorker)sender).ReportProgress(0, "Error");
MessageBox.Show(ae.Message,"Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}