コード例 #1
0
		/// <summary>
		/// Return true to handle the keypress, return false to let the text area handle the keypress
		/// </summary>
		private bool TextAreaKeyEventHandler(char key)
		{
			if (_codeCompletionWindow != null)
			{
				// If completion window is open and wants to handle the key, don't let the text area
				// handle it
				if (_codeCompletionWindow.ProcessKeyEvent(key))
					return true;
			}

			if (key == '.')
			{
				ICompletionDataProvider completionDataProvider = new CodeCompletionProvider(_iForm);

				_codeCompletionWindow = CodeCompletionWindow.ShowCompletionWindow(
					_iForm, // The parent window for the completion window
					_editor, // The text editor to show the window for
					IntellisenseForm.DummyFileName, // Filename - will be passed back to the provider
					completionDataProvider, // Provider to get the list of possible completions
					key // Key pressed - will be passed to the provider
					);
				if (_codeCompletionWindow != null)
				{
					// ShowCompletionWindow can return null when the provider returns an empty list
					_codeCompletionWindow.Closed += CloseCodeCompletionWindow;
				}
			}
			else if ((key == '('))
			{
				if (_insightWindow != null && (!_insightWindow.IsDisposed))
				{
					// provider returned an empty list, so the window never been opened
					CloseInsightWindow(this, EventArgs.Empty);
				}
				IInsightDataProvider insightdataprovider = new MethodInsightDataProvider(_iForm);
				_insightWindow = new InsightWindow(_iForm, _editor);
				_insightWindow.Closed += CloseInsightWindow;
				_insightWindow.AddInsightDataProvider(insightdataprovider, IntellisenseForm.DummyFileName);
				_insightWindow.ShowInsightWindow();
			}
			return false;
		}