private void ApplyConfig(MediaConfig config, MediaConfigFile[] mediaFiles)
        {
            foreach (var file in mediaFiles)
            {
                vlcControl.Medias.Add(new LocationMedia(String.Format(MediaFileUriPattern, config.ServiceUrl, file.Id)));
            }

            vlcControl.Stop();
            vlcControl.Play();
        }
Beispiel #2
0
        public MediaConfigControl()
        {
            InitializeComponent();

            config = new MediaConfig();

            if (designtime)
            {
                return;
            }

            taskPool = new TaskPool();
            taskPool.OnAddTask += taskPool_OnAddTask;
            taskPool.OnRemoveTask += taskPool_OnRemoveTask;
        }
Beispiel #3
0
        private async void saveButton_Click(object sender, EventArgs e)
        {
            using (var channel = ChannelManager.CreateChannel())
            {
                try
                {
                    saveButton.Enabled = false;

                    config = await taskPool.AddTask(channel.Service.EditMediaConfig(config));
                }
                catch (OperationCanceledException) { }
                catch (CommunicationObjectAbortedException) { }
                catch (ObjectDisposedException) { }
                catch (InvalidOperationException) { }
                catch (FaultException exception)
                {
                    UIHelper.Warning(exception.Reason.ToString());
                }
                catch (Exception exception)
                {
                    UIHelper.Warning(exception.Message);
                }
                finally
                {
                    saveButton.Enabled = true;
                }
            }
        }
Beispiel #4
0
 private async void MediaConfigControl_Load(object sender, EventArgs e)
 {
     if (designtime)
     {
         return;
     }
     using (var channel = ChannelManager.CreateChannel())
     {
         try
         {
             Config = await taskPool.AddTask(channel.Service.GetMediaConfig());
         }
         catch (OperationCanceledException) { }
         catch (CommunicationObjectAbortedException) { }
         catch (ObjectDisposedException) { }
         catch (InvalidOperationException) { }
         catch (FaultException exception)
         {
             UIHelper.Warning(exception.Reason.ToString());
         }
         catch (Exception exception)
         {
             UIHelper.Warning(exception.Message);
         }
     }
 }
        private async void EditMediaConfigFileForm_Load(object sender, EventArgs e)
        {
            Enabled = false;

            using (var channel = ChannelManager.CreateChannel())
            {
                try
                {
                    mediaConfig = await taskPool.AddTask(channel.Service.GetMediaConfig());

                    if (mediaConfigFileId != Guid.Empty)
                    {
                        MediaConfigFile = await taskPool.AddTask(channel.Service.GetMediaConfigFile(mediaConfigFileId));
                    }
                    else
                    {
                        MediaConfigFile = new MediaConfigFile();
                    }

                    Enabled = true;
                }
                catch (OperationCanceledException) { }
                catch (CommunicationObjectAbortedException) { }
                catch (ObjectDisposedException) { }
                catch (InvalidOperationException) { }
                catch (FaultException exception)
                {
                    UIHelper.Warning(exception.Reason.ToString());
                }
                catch (Exception exception)
                {
                    UIHelper.Warning(exception.Message);
                }
            }
        }
 private void ApplyConfig(MediaConfig config)
 {
     SetTicker(config.Ticker);
     SetSpeed(config.TickerSpeed);
     Start();
 }