コード例 #1
0
ファイル: Shell.cs プロジェクト: wangzq/bips
        private void InitializeRunspaceAndHost()
        {
            if (null == _shellConfiguration.RunspaceConfiguration)
            {
                _shellConfiguration.RunspaceConfiguration = RunspaceConfiguration.Create();
            }

            _shellConfiguration.Cmdlets.ToList().ForEach(
                cce => _shellConfiguration.RunspaceConfiguration.Cmdlets.Append(cce)
                );

            _rawUi  = new HostRawUI(_consoleWindow, _shellConfiguration.ShellName);
            _hostUi = new HostUI(_consoleWindow, _shellConfiguration.UISettings, _rawUi);
            _host   = new Host.Host(_shellConfiguration.ShellName, _shellConfiguration.ShellVersion, _hostUi,
                                    _shellConfiguration.RunspaceConfiguration);

            _hostUi.Progress += NotifyProgress;

            _runspace = _host.Runspace;
            _runspace.Open();

            _commandExecutor = new Executor(_runspace);

            _shellConfiguration.InitialVariables.ToList().ForEach(pair =>
                                                                  _runspace.SessionStateProxy.PSVariable.Set(pair)
                                                                  );
        }
コード例 #2
0
ファイル: PluginMarker.cs プロジェクト: timyaukey/CheckNET
 private void IntuitExportClickHandler(object sender, EventArgs e)
 {
     try
     {
         ExportEngine engine = new ExportEngine(HostUI);
         using (ExportForm frm = new ExportForm())
         {
             if (frm.ShowDialog(engine, HostUI) != System.Windows.Forms.DialogResult.OK)
             {
                 HostUI.InfoMessageBox("Export canceled.");
                 return;
             }
         }
         if (engine.Run())
         {
             HostUI.InfoMessageBox("Exported to " + engine.OutputPath);
         }
         else
         {
             HostUI.ErrorMessageBox("Export canceled.");
         }
     }
     catch (Exception ex)
     {
         ErrorHandling.TopException(ex);
     }
 }
コード例 #3
0
ファイル: PluginMarker.cs プロジェクト: timyaukey/CheckNET
 private void RenumberChecksClickHandler(object sender, RegisterEventArgs e)
 {
     try
     {
         using (RenumberChecksForm frm = new RenumberChecksForm())
         {
             if (frm.ShowDialog(HostUI) != System.Windows.Forms.DialogResult.OK)
             {
                 HostUI.InfoMessageBox("Renumber checks canceled.");
                 return;
             }
         }
     }
     catch (Exception ex)
     {
         ErrorHandling.TopException(ex);
     }
 }
コード例 #4
0
 private void HelpHandler(object sender, EventArgs e)
 {
     HostUI.ShowHelp("BudgetDashboard.html");
 }