本文整理汇总了C#中OSGeo.DeleteResource方法的典型用法代码示例。如果您正苦于以下问题:C# OSGeo.DeleteResource方法的具体用法?C# OSGeo.DeleteResource怎么用?C# OSGeo.DeleteResource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSGeo
的用法示例。
在下文中一共展示了OSGeo.DeleteResource方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoDelete
private void DoDelete(Workbench wb, OSGeo.MapGuide.MaestroAPI.Services.IResourceService resSvc, RepositoryItem[] items)
{
var pdlg = new ProgressDialog();
pdlg.CancelAbortsThread = true;
string[] args = new string[items.Length];
for (int i = 0; i < items.Length; i++)
{
args[i] = items[i].ResourceId;
}
var work = new Maestro.Shared.UI.ProgressDialog.DoBackgroundWork((worker, e, target) =>
{
int deleted = 0;
if (target == null || target.Length == 0)
return deleted;
int step = 100 / target.Length;
int current = 0;
foreach (RepositoryItem item in target)
{
if (worker.CancellationPending || e.Cancel)
return deleted;
current += step;
if (item.IsRoot) //Wait a minute...!
{
continue;
}
else
{
resSvc.DeleteResource(item.ResourceId);
deleted++;
worker.ReportProgress(current, item.ResourceId);
}
}
//collect affected parents and update the model
foreach (RepositoryItem item in target)
{
var parent = item.Parent;
if (parent != null)
{
parent.RemoveChild(item);
}
}
return deleted;
});
pdlg.RunOperationAsync(wb, work, items);
}