public async void LoadCmdlets(Object helpPath, Boolean importCBH) { ClosableTabItem previousTab = _mwvm.SelectedTab; UIElement previousElement = ((Grid)previousTab.Content).Children[0]; String cmd = Utils.GetCommandTypes(); if (String.IsNullOrEmpty(cmd)) { Utils.MsgBox("Error", Strings.E_EmptyCmds, MessageBoxButton.OK, MessageBoxImage.Error); return; } UIManager.ShowBusy(previousTab, Strings.InfoCmdletsLoading); try { IEnumerable <CmdletObject> data = await PowerShellProcessor.EnumCmdlets(_mwvm.SelectedModule, cmd, importCBH); _mwvm.SelectedModule.Cmdlets.Clear(); foreach (CmdletObject item in data) { _mwvm.SelectedModule.Cmdlets.Add(item); } if (helpPath != null) { _mwvm.SelectedModule.ImportedFromHelp = true; XmlProcessor.ImportFromXml((String)helpPath, _mwvm.SelectedModule); } previousTab.Module = _mwvm.SelectedModule; _mwvm.SelectedModule = null; UIManager.ShowEditor(previousTab); } catch (Exception e) { Utils.MsgBox("Error while loading cmdlets", e.Message, MessageBoxButton.OK, MessageBoxImage.Error); _mwvm.SelectedTab.ErrorInfo = e.Message; UIManager.RestoreControl(previousTab, previousElement); } }