Ejemplo n.º 1
0
        private SelectableAction[] GetActions(string path)
        {
            var actions = new List <SelectableAction>
            {
                new SelectableAction("Open", () => FolderService.OpenLocation(path)),
            };

            //if (false) // Disable until I can figure it out
            //{
            //    actions.Add(new SelectableAction("Terminal", () => TerminalService.OpenTerminal(path)));
            //}

            var hasGit = GitService.TryGetRemoteGitLocation(path, out string uri);

            if (hasGit)
            {
                actions.Add(new SelectableAction("Web", () => StartProgramService.StartProgram(uri)));
            }

            foreach (var type in m_programTypesToStart)
            {
                actions.Add(new SelectableAction(type, () => StartProgramService.StartProgramOfType(type, path, true)));
            }

            foreach (var type in m_programTypesTopFolderToStart)
            {
                actions.Add(new SelectableAction(type, () => StartProgramService.StartProgramOfType(type, path, false)));
            }

            foreach (var script in m_scripts)
            {
                actions.Add(new SelectableAction(script.Key, () => StartProgramService.RunScript(script, path)));
            }

            return(actions.ToArray());
        }