Beispiel #1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            m_Player.OnSnapClientErrored    += Player_OnSnapClientErrored;// force device refresh if errors happened (to avoid confusing in case device got disconnected)
            m_Player.DevicePlayStateChanged += Player_DevicePlayStateChanged;
            m_DeviceAutoPlayFlags            = SnapSettings.GetDeviceAutoPlayFlags();

            _ListDevices();
        }
Beispiel #2
0
        /// <summary>
        /// Checks which devices need to start playing on startup, and plays them
        /// This method should only be called after the control port has connected successfully
        /// </summary>
        public async Task StartAutoPlayAsync()
        {
            // if we were already playing, stop
            if (m_ActivePlayers.Count > 0)
            {
                StopAll();
            }

            // load settings, see if we need to start auto-playing
            Dictionary <string, Tuple <bool, string> > deviceAutoPlayFlags = SnapSettings.GetDeviceAutoPlayFlags();
            List <Task> tasks = new List <Task>();

            foreach (KeyValuePair <string, Tuple <bool, string> > kvp in deviceAutoPlayFlags)
            {
                if (kvp.Value.Item1 == true)
                {
                    Logger.Info("Starting auto-play for {0}", kvp.Value.Item2);
                    tasks.Add(PlayAsync(kvp.Key, kvp.Value.Item2));
                }
            }
            await Task.WhenAll(tasks.ToArray()).ConfigureAwait(false);
        }