Exemplo n.º 1
0
        public IEnumerable <IResult> OpenLiveMatch()
        {
            var dialog = new OpenFileDialogResult()
            {
                Title  = "Open match...",
                Filter = Format.XML.DialogFilter,
            };

            yield return(dialog);

            FileName = dialog.Result;

            var deserialization = new DeserializeMatchResult(FileName, Format.XML.Serializer);

            yield return(deserialization
                         .Rescue()
                         .WithMessage("Error loading the match", string.Format("Could not load a match from {0}.", dialog.Result))
                         .Propagate()); // Reraise the error to abort the coroutine

            Match          = deserialization.Result;
            ActivePlaylist = Match.Playlists.Where(p => p.Name == "Alle").FirstOrDefault();

            Events.PublishOnUIThread(new MatchOpenedEvent(Match));
            Events.PublishOnUIThread(new HideMenuEvent());
            MatchModified = false;
            MatchSaveAs   = true;
            NotifyOfPropertyChange("MatchSaveAs");
            NotifyOfPropertyChange("MatchModified");
        }
Exemplo n.º 2
0
        public IEnumerable <IResult> OpenMatch(string fileName = null)
        {
            Events.PublishOnUIThread(new MediaControlEvent(Media.Control.Stop, Media.Source.Viewer));
            bool newVideoLoaded = false;

            var dialog = new OpenFileDialogResult()
            {
                Title  = "Open match...",
                Filter = Format.XML.DialogFilter,
            };

            if (fileName == null || !File.Exists(fileName))
            {
                yield return(dialog);

                FileName = dialog.Result;
            }
            else
            {
                FileName = fileName;
            }

            var deserialization = new DeserializeMatchResult(FileName, Format.XML.Serializer);

            yield return(deserialization
                         .Rescue()
                         .WithMessage("Error loading the match", string.Format("Could not load a match from {0}.", dialog.Result))
                         .Propagate()); // Reraise the error to abort the coroutine

            var tempMatch = deserialization.Result;

            if (string.IsNullOrEmpty(tempMatch.VideoFile) || !File.Exists(tempMatch.VideoFile))
            {
                foreach (var result in LoadVideo(tempMatch))
                {
                    yield return(result);
                }
                newVideoLoaded = true;
            }
            else
            {
                Events.PublishOnUIThread(new VideoLoadedEvent(tempMatch.VideoFile));
                newVideoLoaded = false;
            }

            this.Match = tempMatch;
            if (!newVideoLoaded)
            {
                MatchModified = false;
            }
            MatchSaveAs = true;
            NotifyOfPropertyChange("MatchSaveAs");
            ActivePlaylist = Match.Playlists.Where(p => p.Name == "Alle").FirstOrDefault();
            Events.PublishOnUIThread(new MatchOpenedEvent(Match));
            Events.PublishOnUIThread(new HideMenuEvent());
            //Events.PublishOnUIThread(new FullscreenEvent(false));
        }
Exemplo n.º 3
0
        public IEnumerable <IResult> DeserializeMatch(string path)
        {
            var deserialization = new DeserializeMatchResult(path, Format.XML.Serializer);

            yield return(deserialization
                         .Rescue()
                         .WithMessage("Error loading the match", string.Format("Could not load a match from {0}.", path))
                         .Propagate()); // Reraise the error to abort the coroutine

            var tempMatch = deserialization.Result;
        }