Esempio n. 1
0
        private static Task StartAndSetupEventSystem(MPCHomeCinema mpcClient)
        {
            var factory = new ConnectionFactory()
            {
                HostName = "localhost"
            };

            using (var connection = factory.CreateConnection())
                using (var channel = connection.CreateModel())
                {
                    channel.QueueDeclare(queue: "hello",
                                         durable: false,
                                         exclusive: false,
                                         autoDelete: false,
                                         arguments: null);


                    _mpcHcObserver = new MPCHomeCinemaObserver(mpcClient);

                    _mpcHcObserver.PropertyChanged += (sender, args) => PropChanged(args, channel);

                    var port   = 50051;
                    var ip     = "localhost";
                    var server = new MediaPlayerServer(ip, port, new MediaPlayerServiceImpl(mpcClient, Init, Stop, Start));

                    server.Start();
                    Console.WriteLine($"Started GRPC server on {ip}:{port}");


                    Console.ReadLine();
                }
            return(Task.CompletedTask);
        }
Esempio n. 2
0
        static async Task Main(string[] args)
        {
            var url = "http://localhost:13579";

            _mpcClient = new MPCHomeCinema(url);

            await StartAndSetupEventSystem(_mpcClient);
        }
        public MainWindow()
        {
            InitializeComponent();

            mpcHomeCinema = new MPCHomeCinema("http://localhost:13579");

            mmiC          = new MmiCommunication("localhost", 8000, "User1", "GUI");
            mmiC.Message += MmiC_Message;
            mmiC.Start();
        }
        public CommandServiceIntergrationTest()
        {
            _mediaPlayerConfig = new MediaPlayerConfig("http://*****:*****@"D:\Program Files (x86)\MPC-HC\mpc-hc.exe");
//            _requestService = new RequestService(new HttpClient(), "http://localhost:13579", new LogService());
            _mpcHomeCinema = new MPCHomeCinema("http://localhost:13579");
            var x = AsyncHelpers.RunSync(InitMediaPlayer);

            if (x.ResultCode == ResultCode.Fail)
            {
                throw new Exception("Can't open media file.");
            }
        }
Esempio n. 5
0
        public MPCController()
        {
            Console.WriteLine("[MPC] init");
            player         = new MPCHomeCinema(Settings.MPCWebUIAddress);
            updateInterval = new TimeSpan(0, 0, 1);

            // Wait connection
            Task.Run(async() =>
            {
                Console.WriteLine("[MPC] init GetInfo");
                var task = await player.GetInfo();
                Console.WriteLine(task.ToString());
                initialized?.Invoke(this, new EventArgs());
            }).GetAwaiter();

            /*
             * playerObserver = new MPCHomeCinemaObserver(player);
             * playerObserver.PropertyChanged += (sender, args) =>
             * {
             *  switch (args.Property)
             *  {
             *      case Property.File:
             *          Console.WriteLine($"Property changed from {args.OldInfo.FileName}, -> {args.NewInfo.FileName}");
             *          break;
             *      case Property.State:
             *          Console.WriteLine($"Property changed from {args.OldInfo.State}, -> {args.NewInfo.State}");
             *          break;
             *      case Property.Possition:
             *          Console.WriteLine($"Property changed from {args.OldInfo.Position}, -> {args.NewInfo.Position}");
             *          break;
             *      default:
             *          throw new ArgumentOutOfRangeException();
             *  }
             * };*/

            // Update normaly
            RunUpdate();
        }
Esempio n. 6
0
 private static void StartGrpcServer(string ip, int port, MPCHomeCinema mpcClient)
 {
 }