Beispiel #1
0
        async void LoadCmdletsForProject(ClosableTabItem tab)
        {
            String cmd = Utils.GetCommandTypes();

            if (String.IsNullOrEmpty(cmd))
            {
                Utils.MsgBox("Error", Strings.E_EmptyCmds, MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            if (FileProcessor.FindModule(tab.Module.Name))
            {
                tab.Module.ModulePath = null;
            }
            tab.ErrorInfo = null;
            tab.EditorContext.CurrentCmdlet = null;
            List <CmdletObject> nativeCmdlets = new List <CmdletObject>();

            try {
                IEnumerable <CmdletObject> data = await PowerShellProcessor.EnumCmdlets(tab.Module, cmd, false);

                nativeCmdlets.AddRange(data);
                PowerShellProcessor.CompareCmdlets(tab.Module, nativeCmdlets);
            } catch (Exception e) {
                String message = e.Message + "\n\nYou still can use the module project in offline mode";
                message += "\nHowever certain functionality may not be available.";
                Utils.MsgBox("Error while loading cmdlets", message, MessageBoxButton.OK, MessageBoxImage.Error);
                tab.ErrorInfo = e.Message;
                foreach (CmdletObject cmdlet in tab.Module.Cmdlets)
                {
                    cmdlet.GeneralHelp.Status = ItemStatus.Missing;
                }
            } finally {
                UIManager.ShowEditor(tab);
            }
        }