本文整理汇总了C#中UI.SetProgress方法的典型用法代码示例。如果您正苦于以下问题:C# UI.SetProgress方法的具体用法?C# UI.SetProgress怎么用?C# UI.SetProgress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UI
的用法示例。
在下文中一共展示了UI.SetProgress方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
public void Start(SP.ISPDatabase sharepointDatabase, SP.SPListDefinition list, UI.IProgressNotifier notifier)
{
notifier.Reset("Initializing...");
_Formatter.Initialize();
SP.SPFieldDefinitionCollection oFieldList = list.Fields;
notifier.SetProgress("Retrieving records from Sharepoint database...", 0);
System.Data.IDataReader oReader = sharepointDatabase.GetListItemsAsReader(list, true, false);
oReader.Read();
int nTotalRecords = oReader.GetInt32(0);
int nProcessedRecords = 0;
notifier.SetProgress(string.Format("{0} records retrieved. Now exporting...", nTotalRecords.ToString()), 10);
oReader.NextResult();
while (oReader.Read())
{
int nListItemID = Convert.ToInt32(oReader["ID"]);
_Formatter.BeginExportRow(nListItemID.ToString());
foreach (SP.SPFieldDefinition oField in oFieldList)
{
_Formatter.ExportField(oField.InternalName, sharepointDatabase.GetFieldText(oField, oReader));
}
if (_Formatter.SupportAttachments && oReader.GetBoolean(oReader.GetOrdinal("HasAttachments")))
{
DataTable oAttachmentList = sharepointDatabase.GetListItemAttachmentsList(list, nListItemID, true);
int nCounter = 1;
foreach (DataRow oAttachment in oAttachmentList.Rows)
{
_Formatter.ExportAttachment(nCounter, oAttachment["Folder"].ToString(), oAttachment["Filename"].ToString(), (byte[]) oAttachment["Content"]);
nCounter++;
}
}
_Formatter.EndExportRow();
nProcessedRecords++;
if (nProcessedRecords % 100 == 0)
notifier.SetProgress(null, (short) (10 + (nProcessedRecords * 90 / nTotalRecords)));
}
_Formatter.Terminate();
notifier.SetComplete(null);
}