Exemple #1
0
    private void LoadSavedPosition(PositionViewModel position)

    {

        PositionViewModel model = position;

        MediaElement element = new MediaElement
        {

            LoadedBehavior = MediaState.Manual,

            Stretch = Stretch.Fill

        };

        if (model.Width.HasValue)

        {

            double? nullable4 = model.Width + 15.0;

            element.Width = (nullable4.Value / 768.0) * SystemParameters.PrimaryScreenWidth;

        }

        if (model.Height.HasValue)

        {

            double? nullable8 = model.Height + 15.0;

            element.Height = (nullable8.Value / 1366.0) * SystemParameters.PrimaryScreenHeight;

        }

        if (model.X.HasValue && model.Y.HasValue)

        {

            element.Margin = new Thickness((model.X.Value / 768.0) * SystemParameters.PrimaryScreenWidth, (model.Y.Value / 1366.0) * SystemParameters.PrimaryScreenHeight, 0.0, 0.0);

        }

        this.Playlist = new List<MediaListModel>();

        IEnumerable<MediaListModel> enumerable = this.LoadPositionMedia(position);

        this.MediaCanvas.Children.Add(element);

        Player player = new Player(this.Playlist, element);

        foreach (MediaListModel model2 in enumerable)

        {

            PageSwitcher.DownloadMedium(model2, this.Playlist, player);

        }

        this.Players.Add(player);

        player.Start();

    }
Exemple #2
0
    private void LoadPosition(PositionViewModel position)

    {

        Func<long, MediaListModel> selector = null;

        PositionViewModel model = position;

        MediaElement element = new MediaElement
        {

            LoadedBehavior = MediaState.Manual,

            Stretch = Stretch.Fill

        };

        if (model.Width.HasValue)

        {

            double? nullable4 = model.Width + 15.0;

            element.Width = (nullable4.Value / 768.0) * SystemParameters.PrimaryScreenWidth;

        }

        if (model.Height.HasValue)

        {

            double? nullable8 = model.Height + 15.0;

            element.Height = (nullable8.Value / 1366.0) * SystemParameters.PrimaryScreenHeight;

        }

        if (model.X.HasValue && model.Y.HasValue)

        {

            element.Margin = new Thickness((model.X.Value / 768.0) * SystemParameters.PrimaryScreenWidth, (model.Y.Value / 1366.0) * SystemParameters.PrimaryScreenHeight, 0.0, 0.0);

        }

        this.Playlist = new List<MediaListModel>();

        ServiceClient myService1 = new ServiceClient("BasicHttpBinding_IService", Constants.ServerAddress);

        try

        {

            if (selector == null)

            {

                selector = media => new MediaListModel { MediaID = media, DisplayLocation = myService1.GetMediaLocation(media), Duration = myService1.GetMediaDuration(media) };

            }

            List<MediaListModel> list = position.Media; // position.Media.Select<long, MediaListModel>(selector).ToList<MediaListModel>();

            myService1.Close();

            List<MediaListModel> playlist = (from m in list select new MediaListModel { MediaID = m.MediaID, DisplayLocation = m.DisplayLocation, Duration = m.Duration }).ToList<MediaListModel>();

            this.SavePositionMedia(position, playlist);

            this.MediaCanvas.Children.Add(element);

            Player player = new Player(this.Playlist, element);

            foreach (MediaListModel model2 in list.ToArray())

            {

                PageSwitcher.DownloadMedium(model2, this.Playlist, player);

            }

            this.Players.Add(player);

            player.Start();

        }

        catch (Exception exception)

        {

            Console.WriteLine(exception.StackTrace + "\n\n" + exception.Message);

        }

    }