本文整理汇总了C#中System.ComponentModel.DoWorkEventArgs.set_Cancel方法的典型用法代码示例。如果您正苦于以下问题:C# DoWorkEventArgs.set_Cancel方法的具体用法?C# DoWorkEventArgs.set_Cancel怎么用?C# DoWorkEventArgs.set_Cancel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ComponentModel.DoWorkEventArgs
的用法示例。
在下文中一共展示了DoWorkEventArgs.set_Cancel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeDataSource
protected override System.Data.DataSet MakeDataSource(DoWorkEventArgs e)
{
System.Data.DataTable table = null;
System.DateTime dateBeg = base.DateBeg;
System.DateTime time6 = new System.DateTime(base.DateEnd.get_Year(), base.DateEnd.get_Month(), base.DateEnd.get_Day());
System.DateTime dateEnd = time6.AddDays((double) 1.0).AddMilliseconds((double) -1.0);
if ((dateBeg == Constants.MinDate) & (dateEnd == Constants.MinDate))
{
Messages.ShowMessage("Заполните даты периода");
return null;
}
CalcOperationGroup opGroup = (CalcOperationGroup) this.calcOperationGroupBindingSource.get_Current();
Organization sp = (Organization) this.m_ServiceProviderBS.get_Current();
ServiceTypeOld st = (ServiceTypeOld) this.serviceTypeBindingSource.get_Current();
if (this.serverBindingSource.get_Current() == Server.Null)
{
foreach (Server server in (ObjectList<Server>) this.serverBindingSource.get_DataSource())
{
if ((base.m_WorkerThread != null) && base.m_WorkerThread.get_CancellationPending())
{
e.set_Cancel(true);
return null;
}
if (server == Server.Null)
{
continue;
}
System.Data.DataTable table2 = this.GetServerReport(server, dateBeg, dateEnd, opGroup, sp, st);
if (table != null)
{
goto Label_0165;
}
table = table2;
goto Label_0174;
Label_013A:
table.Rows.Add(table2.Rows.get_Item(0).get_ItemArray());
table2.Rows.RemoveAt(0);
Label_0165:
if (table2.Rows.get_Count() > 0)
{
goto Label_013A;
}
Label_0174:
base.m_WorkerThread.ReportProgress(0, string.Format("Отчет по участку \"{0}\" сформирован", server.Name));
}
}
else
{
Server srv = (Server) this.serverBindingSource.get_Current();
table = this.GetServerReport(srv, dateBeg, dateEnd, opGroup, sp, st);
}
System.Data.DataSet set = new System.Data.DataSet();
set.Tables.Add(table);
return set;
}
示例2: m_WorkerThread_DoWork
private void m_WorkerThread_DoWork(object sender, DoWorkEventArgs e)
{
if (this.m_WorkerThread.get_CancellationPending())
{
e.set_Cancel(true);
}
else
{
System.Data.DataSet ds = this.MakeDataSource(e);
if (this.m_MakingDataSource != null)
{
this.m_MakingDataSource(ref ds);
}
if ((!this.m_WorkerThread.get_CancellationPending() && (ds != null)) && ((ds.Tables.get_Count() != 0) && (ds.Tables.get_Item(0).Rows.get_Count() != 0)))
{
StiReport report = this.MakeReport(ds);
e.set_Result(report);
}
}
}
示例3: workerExportPdf_DoWork
private void workerExportPdf_DoWork(object sender, DoWorkEventArgs e)
{
char[] chArray2;
int num12;
int num13;
object obj2;
char[] invalidFileNameChars = System.IO.Path.GetInvalidFileNameChars();
BackgroundWorker worker = sender as BackgroundWorker;
NoticeExportPdfParams @params = e.get_Argument() as NoticeExportPdfParams;
ObjectList<NoticeNotice> notices = @params.Notices;
int num = 0;
if (this.rbExportAccountNotices.get_Checked())
{
foreach (NoticeNotice notice in notices)
{
if (worker.get_CancellationPending())
{
e.set_Cancel(true);
break;
}
string str2 = string.IsNullOrEmpty(notice.HouseHolderName) ? ((string) "Неизвестная УК") : notice.HouseHolderName;
chArray2 = invalidFileNameChars;
num12 = 0;
while (num12 < chArray2.Length)
{
char ch = chArray2[num12];
str2 = str2.Replace(ch, ' ');
num12 = (int) (num12 + 1);
}
str2 = str2.Trim();
System.IO.DirectoryInfo info = new System.IO.DirectoryInfo(System.IO.Path.Combine(@params.PeriodDirectory.get_FullName(), str2));
if (!info.get_Exists())
{
info.Create();
}
ObjectList<NoticeNotice> list2 = new ObjectList<NoticeNotice>();
list2.Add(notice);
try
{
using (System.Data.DataTable table = NoticeNotice.GetHeader(list2, this.cbHideClosedAccounts.get_Checked(), this.cbNoticeInformation.get_Checked()))
{
table.set_TableName("header");
using (System.Data.DataSet set = NoticeNotice.GetReport(list2, @params.NoticeTemplate.Sql))
{
if ((set.Tables.get_Count() < 2) || (set.Tables.get_Item(0).Rows.get_Count() == 0))
{
continue;
}
bool flag = false;
foreach (System.Data.DataRow row in table.Rows)
{
if (System.Convert.ToInt64(row.get_Item("id")) == notice.Id)
{
foreach (System.Data.DataRow row2 in set.Tables.get_Item(0).Rows)
{
if (System.Convert.ToInt64(row2.get_Item("id")) == notice.Id)
{
flag = true;
break;
}
}
}
}
if (!flag)
{
continue;
}
set.Tables.get_Item(0).set_TableName("pays");
set.Tables.get_Item(1).set_TableName("counter");
for (int i = 2; i < set.Tables.get_Count(); i = (int) (i + 1))
{
num13 = (int) (i - 1);
set.Tables.get_Item(i).set_TableName("data" + ((int) num13).ToString());
}
if (@params.NoticeTemplate.IdentityName == "Счет на оплату Ульяновск вариант 3")
{
if (set.Tables.get_Count() > 2)
{
set.Tables.get_Item(2).set_TableName("organizations");
}
if (set.Tables.get_Count() > 3)
{
set.Tables.get_Item(3).set_TableName("rates");
}
}
using (StiReport report = new StiReport())
{
report.LoadFromString(@params.NoticeTemplate.Template);
report.ReportCacheMode = StiReportCacheMode.Off;
report.Compile();
foreach (System.Data.DataTable table2 in set.Tables)
{
report.RegData(table2.get_TableName(), (System.Data.DataTable) table2);
}
report.RegData("header", (System.Data.DataTable) table);
string accountNumber = notice.AccountNumber;
string str5 = System.IO.Path.Combine(info.get_FullName(), accountNumber);
if (System.IO.File.Exists(str5 + ".pdf"))
{
int num5 = 1;
//.........这里部分代码省略.........