本文整理汇总了C#中ICompletionSession.Commit方法的典型用法代码示例。如果您正苦于以下问题:C# ICompletionSession.Commit方法的具体用法?C# ICompletionSession.Commit怎么用?C# ICompletionSession.Commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICompletionSession
的用法示例。
在下文中一共展示了ICompletionSession.Commit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Exec
public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
{
var handled = false;
var hresult = VSConstants.S_OK;
if (pguidCmdGroup == VSConstants.VSStd2K)
{
switch ((VSConstants.VSStd2KCmdID) nCmdID)
{
case VSConstants.VSStd2KCmdID.AUTOCOMPLETE:
case VSConstants.VSStd2KCmdID.COMPLETEWORD:
handled = true;
if (IsSessionStarted) break;
_currentSession = StartSession();
break;
case VSConstants.VSStd2KCmdID.RETURN:
if (!IsSessionStarted) break;
handled = true;
_currentSession.Commit();
break;
case VSConstants.VSStd2KCmdID.TAB:
if (!IsSessionStarted) break;
handled = true;
_currentSession.Commit();
break;
case VSConstants.VSStd2KCmdID.CANCEL:
if (!IsSessionStarted) break;
handled = true;
_currentSession.Dismiss();
break;
}
}
if (!handled) hresult = Next.Exec(pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
if (ErrorHandler.Succeeded(hresult))
{
if (pguidCmdGroup == VSConstants.VSStd2K)
{
switch ((VSConstants.VSStd2KCmdID) nCmdID)
{
case VSConstants.VSStd2KCmdID.TYPECHAR:
if (IsSessionStarted) _currentSession.Filter();
break;
case VSConstants.VSStd2KCmdID.BACKSPACE:
if (IsSessionStarted)
{
_currentSession.Dismiss();
_currentSession = StartSession();
}
break;
}
}
}
return hresult;
}
示例2: TriggerCompletionSession
internal void TriggerCompletionSession(bool completeWord) {
Dismiss();
_activeSession = CompletionBroker.TriggerCompletion(_textView);
if (_activeSession != null) {
FuzzyCompletionSet set;
if (completeWord &&
_activeSession.CompletionSets.Count == 1 &&
(set = _activeSession.CompletionSets[0] as FuzzyCompletionSet) != null &&
set.SelectSingleBest()) {
_activeSession.Commit();
_activeSession = null;
} else {
_activeSession.Filter();
_activeSession.Dismissed += OnCompletionSessionDismissedOrCommitted;
_activeSession.Committed += OnCompletionSessionDismissedOrCommitted;
}
}
}
示例3: SelectSingleBestCompletion
private bool SelectSingleBestCompletion(ICompletionSession session) {
if (session.CompletionSets.Count != 1) {
return false;
}
var set = session.CompletionSets[0] as FuzzyCompletionSet;
if (set == null) {
return false;
}
set.Filter();
if (set.SelectSingleBest()) {
session.Commit();
return true;
}
return false;
}
示例4: TriggerCompletionSession
internal void TriggerCompletionSession(bool completeWord)
{
Dismiss();
_activeSession = CompletionBroker.TriggerCompletion(_textView);
if (_activeSession != null) {
if (completeWord &&
_activeSession.CompletionSets.Count == 1 &&
_activeSession.CompletionSets[0].Completions.Count == 1) {
_activeSession.Commit();
} else {
AttachKeyboardFilter();
_activeSession.Dismissed += new EventHandler(OnSessionDismissedOrCommitted);
_activeSession.Committed += new EventHandler(OnSessionDismissedOrCommitted);
}
}
}