本文整理汇总了C#中System.Windows.Forms.UserControl.BeginInvoke方法的典型用法代码示例。如果您正苦于以下问题:C# UserControl.BeginInvoke方法的具体用法?C# UserControl.BeginInvoke怎么用?C# UserControl.BeginInvoke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.UserControl
的用法示例。
在下文中一共展示了UserControl.BeginInvoke方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetCtrlEnable
public static void SetCtrlEnable(UserControl parentCtrl, Control ctrl, bool value)
{
if (parentCtrl.InvokeRequired)
{
SetCtrlEnableHandler method = new SetCtrlEnableHandler(SetCtrlEnableMethod);
parentCtrl.BeginInvoke(method, new object[] { ctrl, value });
}
else
{
SetCtrlEnableMethod(ctrl, value);
}
}
示例2: DoMerge
/// <summary>
/// Does the main merge operation for selected items and checks-in every changeset.
/// </summary>
/// <param name="mfrm">The UserControl.</param>
/// <param name="lvcoll">The Collection of ListViewItems.</param>
/// <param name="trg">The target path.</param>
internal static void DoMerge(UserControl mfrm, IEnumerable<ListViewItem> lvcoll, string trg)
{
Workspace wrkspc = Utilities.vcext.Explorer.Workspace;
if (!ServerItemExists(trg))
{
MessageBox.Show("Target server path is cloacked or doesn't exist.", Utilities.AppTitle);
return;
}
if (wrkspc.GetPendingChanges().Length > 0)
{
MessageBox.Show("Please resolve all pending changes before going on.", Utilities.AppTitle);
return;
}
//object prgmerge = CreateProgressMerge(vcsrv);
//ShowProgressMerge(prgmerge, mfrm);
int idx = 0;
bool bcanceled = false;
int icanceled;
var dlg = Utilities.CreateThreadedWaitDialog("Merging changesets", "Stating changesets merge...", "status", 100);
ErrorHandler.ThrowOnFailure(dlg.UpdateProgress("Merging changesets", "Stating changesets merge...", "status", idx++, 100, false, out bcanceled));
if (bcanceled) return;
foreach (var lvItem in lvcoll)
{
string MergeTypeText = lvItem.SubItems[MergeTypeIndex].Text;
if (MergeTypeText == "none") continue;
Changeset ch = Utilities.vcsrv.GetChangeset((lvItem.Tag as ListViewItemTag).ChangesetID);
Utilities.OutputCommandString("Preparing for merge changeset: " + ch.ChangesetId);
if (LinkWorkItems)
{
foreach (var workItm in ch.WorkItems)
Utilities.OutputCommandString("Associated WorkItem: " + workItm.Id);
}
ErrorHandler.ThrowOnFailure(dlg.UpdateProgress("Merging changesets", "Merging changeset: " + ch.ChangesetId, "status", idx++, 100, false, out bcanceled));
if (bcanceled) return;
var chverspc = new ChangesetVersionSpec(ch.ChangesetId);
Utilities.OutputCommandString("Changeset Version: " + chverspc.DisplayString);
MergeOptionsEx mergeType = (MergeTypeText == "baseless" ? MergeOptionsEx.Baseless : MergeTypeText == "force" ? MergeOptionsEx.ForceMerge : MergeOptionsEx.None);
mergeType |= mergeOptions;
GetStatus sts = wrkspc.Merge((lvItem.Tag as ListViewItemTag).sourcePath, trg, chverspc, chverspc, LockLevel.Unchanged, RecursionType.Full, mergeType);
Utilities.OutputCommandString("Merge summary: MergeOptionsEx=" + mergeType + ", NoActionNeeded=" + sts.NoActionNeeded + ", NumFailures=" + sts.NumFailures + ", NumOperations=" + sts.NumOperations + ", NumUpdated=" + sts.NumUpdated + ", NumWarnings=" + sts.NumWarnings);
if (mergeOptions != MergeOptionsEx.NoMerge)
{
while (wrkspc.QueryConflicts(ch.Changes.Select(x => x.Item.ServerItem).ToArray(), true).Length > 0)
{
//foreach (var conflict in conflicts) wrkspc.ResolveConflict(conflict);
DialogResult res = MessageBox.Show("Merge conflicts where found. Resolve them or click Cancel to break merge operaton.", "Merge conflicts", MessageBoxButtons.OKCancel);
if (res == DialogResult.Cancel)
{
ErrorHandler.ThrowOnFailure(dlg.EndWaitDialog(out icanceled));
return;
}
if (mfrm.InvokeRequired)
{
var asynchres = mfrm.BeginInvoke(new MethodInvoker(Utilities.ShowResolveConflictsDlg));
mfrm.EndInvoke(asynchres);
}
else
{
Utilities.ShowResolveConflictsDlg();
}
}
var pendingCh = wrkspc.GetPendingChanges();//ch.Changes.Select(x => new ItemSpec(x.Item.ServerItem, RecursionType.Full, x.Item.DeletionId)).ToArray(), true).ToArray();
if (pendingCh.Length == 0)
{
Utilities.OutputCommandString("No pending changes found.");
continue;
}
var wrkitmch = (LinkWorkItems ? ch.WorkItems.Select(x => new WorkItemCheckinInfo(x, WorkItemCheckinAction.Associate)).ToArray() : null);
foreach (var pendChItem in pendingCh)
Utilities.OutputCommandString("Found pending change " + pendChItem.ChangeTypeName + ": " + pendChItem.SourceServerItem);
int newchid = wrkspc.CheckIn(pendingCh, ch.Committer, ch.Comment, ch.CheckinNote, wrkitmch, null, CheckinOptions.SuppressEvent);
Utilities.OutputCommandString("Created new changeset: " + newchid);
}
if (idx == 100) idx = 0;
}
ErrorHandler.ThrowOnFailure(dlg.EndWaitDialog(out icanceled));
//CloseProgressMerge(prgmerge);
//.........这里部分代码省略.........