Ejemplo n.º 1
0
        private void SingleInstanceApplication_NewInstanceMessage(object sender, object message)
        {
            string[] s = message as string[];

            if (s != null)
            {
                if (s.Length == 2)
                {
                    controller.AddAndPlay(s[1], CommandLineActionType.Play);
                }
                else if (s.Length >= 3)
                {
                    switch (s[1].ToLowerInvariant())
                    {
                    case "/enqueue":
                        for (int i = 2; i < s.Length; i++)
                        {
                            controller.AddAndPlay(s[i], CommandLineActionType.Enqueue);
                        }
                        break;

                    case "/playnext":
                        for (int i = s.Length - 1; i >= 2; i--)
                        {
                            controller.AddAndPlay(s[i], CommandLineActionType.PlayNext);
                        }
                        break;

                    case "/add":
                        for (int i = 2; i < s.Length; i++)
                        {
                            controller.AddAndPlay(s[i], CommandLineActionType.Add);
                        }
                        break;

                    case "/hideicons":
                        break;

                    case "/showicons":
                        break;

                    case "/reinstall":
                        break;

                    default:
                        for (int i = 3; i < s.Length; i++)
                        {
                            controller.AddAndPlay(s[i], CommandLineActionType.Enqueue);
                        }
                        controller.AddAndPlay(s[2], CommandLineActionType.Play);
                        break;
                    }
                }
            }
        }