Exemplo n.º 1
0
        public VideoViewModel(IApplicationController app, VideoPlaybackViewModel videoPlaybackViewModel, CompareVaultsViewModel compareVaultsViewModel, string videoPath)
            : base()
        {
            _app = app;
            this.videoPlaybackViewModel = videoPlaybackViewModel;
            this.compareVaultsViewModel = compareVaultsViewModel;
            IsPlaying = false;
            LoadingVisibility = Visibility.Visible;
            FailedLoadingVisibility = Visibility.Hidden;

            filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RunApproachStatistics");
            filePath = Path.Combine(filePath, videoPath);

            if (!File.Exists(filePath))
            {
                Thread thread = new Thread(() =>
                {
                    try
                    {
                        WebClient myWebClient = new WebClient();
                        NetworkCredential myCredentials = new NetworkCredential("snijhof", "MKD7529s09");
                        myWebClient.Credentials = myCredentials;
                        myWebClient.DownloadFile("ftp://student.aii.avans.nl/GRP/42IN11EWd/Videos/" + videoPath, filePath);

                        System.Windows.Application.Current.Dispatcher.Invoke(new Action(() =>
                        {
                            addVideoElement(filePath);
                        }));
                    }
                    catch (Exception e)
                    {
                        LoadingVisibility = Visibility.Hidden;
                        FailedLoadingVisibility = Visibility.Visible;
                    }
                });
                thread.Start();
            }
            else
            {
                addVideoElement(filePath);
            }

            Maximum = 0;
        }
Exemplo n.º 2
0
 public void ShowCompareVaultsView(List<vault> vaults)
 {
     CompareVaultsViewModel compareVaultsViewModel = new CompareVaultsViewModel(this);
     _setContent(compareVaultsViewModel);
     compareVaultsViewModel.setVaultsToCompare(vaults);
 }