예제 #1
0
        private void ButtonSave(object sender, RoutedEventArgs e)
        {
            if (!Playlist.Any())
            {
                this.ShowMessageAsync("No Recording", string.Format("Playlist empty"));
                return;
            }

            if (!File.Exists(Playlist.First().GetFullPath()))
            {
                this.ShowMessageAsync("No Recording", string.Format("Recording file {0} could not be found", Playlist.First().GetFullPath()));
                return;
            }

            var fileDialog = new SaveFileDialog();

            fileDialog.InitialDirectory = RecordingDir;
            fileDialog.Filter           = "TKinectRecording (*.xed)|*.xed|All Files (*.*)|*.*";
            fileDialog.FilterIndex      = 1;

            bool?userClickedOk = fileDialog.ShowDialog();

            if (userClickedOk == true)
            {
                File.Copy(Path.Combine(TempRecordingDir, TempRecordingName), fileDialog.FileName);

                var fileInfo = new FileInfo(fileDialog.FileName);
                if (RecordingDir == fileInfo.DirectoryName)
                {
                    Recordings.Add(new Recording(fileInfo.Name, fileInfo.DirectoryName));
                }
            }
        }
예제 #2
0
        private void OnLoadRecordings()
        {
            try
            {
                for (int i = 0; i < Recordings.Count; i++)
                {
                    Recordings.RemoveAt(i);
                }

                RegionManager.Regions[RegionNames.RecordingRegion].RemoveAll();

                foreach (var recording in TvHeadend.GetRecordings())
                {
                    Recordings.Add(recording);
                }

                foreach (var recording in Recordings.OrderBy(r => r.Start))
                {
                    var navigationParams = new NavigationParameters {
                        { "DataContext", recording }
                    };
                    RegionManager.RequestNavigate(RegionNames.RecordingRegion, new Uri("Recording", UriKind.Relative), NavigationCompleted, navigationParams);
                }

                EventAggregator.GetEvent <StatusChangedEvent>().Publish(new StatusInfo($"{Recordings.Count} Recordings."));
            }
            catch (Exception ex)
            {
                EventAggregator.GetEvent <StatusChangedEvent>().Publish(new StatusInfo(ex.Message));
            }
        }
		public RecordingViewModel()
		{
			Recordings.Add(new RecordingModel()
			{
				ArtistName = "Bach",
				CompositionName = "B Minor",
				ReleaseDateTime = new DateTime(1748, 7, 8)
			});

			Recordings.Add(new RecordingModel()
			{
				ArtistName = "Abu",
				CompositionName = "X Minor",
				ReleaseDateTime = new DateTime(1788, 7, 8)
			});

			Recordings.Add(new RecordingModel()
			{
				ArtistName = "Ali",
				CompositionName = "D Minor",
				ReleaseDateTime = new DateTime(1755, 7, 8)
			});
		}
        protected override async void OnAppearing()
        {
            base.OnAppearing();

            TitleLabel.Text = Release.Title;

            // load cover art
            Release.CoverArtUrl = await Client.GetCoverArtUrl(Release.MbId.ToString());

            if (!string.IsNullOrEmpty(Release.CoverArtUrl))
            {
                CoverImage.Source = new Uri(Release.CoverArtUrl);
            }

            Recordings.Clear();
            foreach (Recording recording in await Client.GetRecordings(Release.MbId.ToString()))
            {
                Recordings.Add(recording);
            }

            SearchingLabel.IsVisible     = false;
            RecordingsListView.IsVisible = true;
        }