Exemplo n.º 1
0
        public MainPage()
        {
            this.InitializeComponent();

            connection = new RemoteConnection();
            connection.OnGetMusicEvent(OnGetMusic)
                .OnPlayMusicEvent(OnPlayMusic)
                .OnPauseMusicEvent(OnPauseMusic)
                .OnStopMusicEvent(OnStopMusic)
                .OnPlayRandomMusicEvent(OnPlayRandomMusic);

            deviceWatcher = DeviceInformation.CreateWatcher(DeviceClass.PortableStorageDevice);
            deviceWatcher.Added += DeviceWatcher_Added;
            deviceWatcher.Removed += DeviceWatcher_Removed;
            deviceWatcher.EnumerationCompleted += DeviceWatcher_EnumerationCompleted;
            deviceWatcher.Stopped += DeviceWatcher_Stopped;

            audioFiles = new Dictionary<string, IStorageFile>();
            random = new Random(unchecked((int)(DateTime.Now.Ticks)));
        }