private void btnAddPpt_Click(object sender, RoutedEventArgs e) { bool?ret = IsVideo(this.lbSelectedFiles.SelectedItem); if (ret != null && !ret.Value && !(this.lbSelectedFiles.SelectedItem is ViewModel.PPTViewModel)) { int index = this.lbSelectedFiles.SelectedIndex; Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog() { Filter = "PowerPoint Document (*.PPT)|*.ppt", AddExtension = true, Multiselect = true, }; if (openFileDialog.ShowDialog().Value) { foreach (string strPptFile in openFileDialog.FileNames) { // 11-30-2011 Scott foreach (Object obj in this.lbSelectedFiles.Items) { if (obj is PPTViewModel && strPptFile == (obj as PPTViewModel).PptPath) { return; } } // end PowerPoint ppt = new PowerPoint(strPptFile); PPTViewModel pptVM = new PPTViewModel(ppt, null); this.lbSelectedFiles.Items.Insert(index + 1, pptVM); } } } else { MessageBox.Show("Please select a play or formation to add ppts"); } }
public PPTView() { InitializeComponent(); DataContext = new PPTViewModel(); }
public void SetPresentation() { lbSelectedFiles.Items.Clear(); foreach (PresentationPlay pPlay in Presentation.Plays) { string strStandardFilePath = new System.IO.FileInfo(pPlay.PlayPath).FullName; if (strStandardFilePath.EndsWith(".Ttl", true, null)) { Title title = new Title(strStandardFilePath); TitleViewModel tvm = new TitleViewModel(title, null); lbSelectedFiles.Items.Add(tvm); } else { if (strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Offensive\Formation\Offensive") || strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Defensive\Formation\Offensive") || strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Kicks\Formation\Offensive")) { Formation formation = new Formation(strStandardFilePath); FormationViewModel fvm = new FormationViewModel(formation, null); lbSelectedFiles.Items.Add(fvm); } if (strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Offensive\Formation\Defensive") || strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Defensive\Formation\Defensive") || strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Kicks\Formation\Defensive")) { Formation formation = new Formation(strStandardFilePath); FormationViewModel fvm = new FormationViewModel(formation, null); lbSelectedFiles.Items.Add(fvm); } if (strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Offensive\Formation\Kicks") || strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Defensive\Formation\Kicks") || strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Kicks\Formation\Kicks")) { Formation formation = new Formation(strStandardFilePath); FormationViewModel fvm = new FormationViewModel(formation, null); lbSelectedFiles.Items.Add(fvm); } if (strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Offensive\Playbook") || strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Defensive\Playbook") || strStandardFilePath.Contains(AppDomain.CurrentDomain.BaseDirectory + @"Kicks\Playbook")) { Play play = new Play(strStandardFilePath); PlayViewModel pvm = new PlayViewModel(play, null); lbSelectedFiles.Items.Add(pvm); } } foreach (Object objVideo in pPlay.Videos) { if (objVideo.ToString().EndsWith(".ppt", true, null)) { PowerPoint ppt = new PowerPoint(objVideo.ToString()); PPTViewModel pptVM = new PPTViewModel(ppt, null); lbSelectedFiles.Items.Add(pptVM); } else { VideoCoachingPointInfo vcpi = null; if (!(objVideo is VideoCoachingPointInfo)) { vcpi = new VideoCoachingPointInfo(objVideo.ToString()); } else { vcpi = objVideo as VideoCoachingPointInfo; } VideoViewModel vvm = new VideoViewModel(vcpi, null); this.lbSelectedFiles.Items.Add(vvm); } } } }
private bool Contains(ViewModel.TreeViewItemViewModel tvivSelect) { string strSelectPath = string.Empty; PlayViewModel pvmSelect = tvivSelect as PlayViewModel; FormationViewModel fvmSelect = tvivSelect as FormationViewModel; TitleViewModel tvmSelect = tvivSelect as TitleViewModel; PPTViewModel pptVMSelect = tvivSelect as PPTViewModel; if (pvmSelect != null) { strSelectPath = pvmSelect.PlayPath; } if (fvmSelect != null) { strSelectPath = fvmSelect.FormationPath; } if (tvmSelect != null) { strSelectPath = tvmSelect.TitlePath; } if (pptVMSelect != null) { strSelectPath = pptVMSelect.PptPath; } if (strSelectPath != string.Empty) { foreach (object o in lbSelectedFiles.Items) { if (o is PlayViewModel) { PlayViewModel pvm = o as PlayViewModel; if (strSelectPath == pvm.PlayPath) { return(true); } } if (o is FormationViewModel) { FormationViewModel fvm = o as FormationViewModel; if (strSelectPath == fvm.FormationPath) { return(true); } } if (o is TitleViewModel) { TitleViewModel tvm = o as TitleViewModel; if (strSelectPath == tvm.TitlePath) { return(true); } } if (o is PPTViewModel) { PPTViewModel pptVM = o as PPTViewModel; if (strSelectPath == pptVM.PptPath) { return(true); } } } } return(false); }