Ejemplo n.º 1
0
		public PopupMenu(IPoshConsoleControl console)
        {
            Closed += new EventHandler(Closed_TabComplete);
            Closed += new EventHandler(Closed_History);

            StaysOpen = false;
            _intellisense.SelectionMode = SelectionMode.Single;
            _intellisense.SelectionChanged += new SelectionChangedEventHandler(Intellisense_SelectionChanged);
            _intellisense.IsTextSearchEnabled = true;
            //_intellisense.PreviewTextInput   += new TextCompositionEventHandler(popup_TextInput);

            _console = console;

            Child = _intellisense;
            PlacementTarget = (UIElement)_console;

        }
Ejemplo n.º 2
0
		public PoshHost(IPSUI psUi)
		{
			_buffer = psUi.Console;
			_tabExpander = new TabExpander(this);

			MakeConsole();

			Options = new PoshOptions(this, _buffer);
			_psUi = psUi;

			try
			{
				// we have to be careful here, because this is an interface member ...
				// but in the current implementation, _buffer.RawUI returns _buffer
				_rawUI = new PoshRawUI(_buffer.RawUI);
				_UI = new PoshUI(_rawUI, psUi);

				// pre-create this
				_outDefault = new Command("Out-Default");
				// for now, merge the errors with the rest of the output
				_outDefault.MergeMyResults(PipelineResultTypes.Error, PipelineResultTypes.Output);
				_outDefault.MergeUnclaimedPreviousCommandResults = PipelineResultTypes.Error | PipelineResultTypes.Output;
			}
			catch (Exception ex)
			{
				MessageBox.Show(
					"Can't create PowerShell interface, are you sure PowerShell is installed? \n" + ex.Message + "\nAt:\n" +
						ex.Source, "Error Starting PoshConsole", MessageBoxButton.OK, MessageBoxImage.Stop);
				throw;
			}
			_buffer.CommandBox.IsEnabled = false;
			_buffer.Expander.TabComplete += _tabExpander.Expand;
			_buffer.Command += OnGotUserInput;

			// Some delegates we think we can get away with making only once...
			Properties.Settings.Default.PropertyChanged += SettingsPropertyChanged;

			_runner = new CommandRunner(this, Resources.Prompt);
			_runner.RunspaceReady += (source, args) => _buffer.Dispatcher.BeginInvoke((Action) (() =>
				{
					_buffer.CommandBox.IsEnabled = true;
					ExecutePromptFunction(null, PipelineState.Completed);
				}));

			_runner.ShouldExit += (source, args) => SetShouldExit(args);
		}
Ejemplo n.º 3
0
      public PopupMenu(IPoshConsoleControl console)
      {
         Closed += ClosedTabComplete;
         Closed += ClosedHistory;

         StaysOpen = false;
         _intellisense.SelectionMode = SelectionMode.Single;
         _intellisense.SelectionChanged += IntellisenseSelectionChanged;
         _intellisense.IsTextSearchEnabled = true;
         //_intellisense.PreviewTextInput   += new TextCompositionEventHandler(popup_TextInput);

         _console = console;

         Child = _intellisense;
         PlacementTarget = _console.CommandBox;

      }