private RadialMenuItem GetLauncherMenuItem(LauncherLink launcher)
        {
            var button = new RadialMenuItem()
            {
                Header = launcher.Header
            };

            button.Click += (s, e) => LauncherService.Launch(launcher);

            return(button);
        }
Example #2
0
        public void Launch(LauncherLink launcher)
        {
            try
            {
                foreach (var command in launcher.Commands)
                {
                    var plugin = AllCommandLaunchers.FirstOrDefault(p => p.CanProcess(command));
                    if (plugin == null)
                    {
                        throw new NotSupportedException($"Unable to find a CommandLauncher plugin for the type {command.GetType().FullName}");
                    }

                    plugin.Execute(command);
                }
            }
            catch (Exception exception)
            {
                MessageService.ShowException(exception);
            }
        }
        public LauncherLink ProcessLauncherLink(Repository root, XmlLauncherLink xmlLauncher)
        {
            var resolvedRootPath = root.Path;

            if (root.Path.EndsWith("/") || root.Path.EndsWith(@"\"))
            {
                resolvedRootPath = resolvedRootPath.Substring(0, resolvedRootPath.Length - 1);
            }

            var launcher = new LauncherLink()
            {
                Header   = xmlLauncher.Header,
                Commands = new List <LauncherCommand>()
            };

            foreach (var command in xmlLauncher.Commands)
            {
                launcher.Commands.Add(command.ToCommand(resolvedRootPath));
            }

            return(launcher);
        }