// Show when item is entered private void List_ItemActivated(object sender, ItemActivatedArgs args) { movieinfo = new YahooTrailersInfo(); movieinfo.Title = ((YahooTrailersListItem)_trailerlist.SelectedItem).Title.Text; movieinfo.Details = replaceSpecials(((YahooTrailersListItem)_trailerlist.SelectedItem)._details); movieinfo.Starring = replaceSpecials(((YahooTrailersListItem)_trailerlist.SelectedItem)._starring); movieinfo.Genre = replaceSpecials(((YahooTrailersListItem)_trailerlist.SelectedItem)._genre); movieinfo.ReleaseDate = replaceSpecials(((YahooTrailersListItem)_trailerlist.SelectedItem)._releasedate); movieinfo.Rating = replaceSpecials(((YahooTrailersListItem)_trailerlist.SelectedItem)._rating); movieinfo.JPEGURL = replaceSpecials(((YahooTrailersListItem)_trailerlist.SelectedItem)._jpegURL); if (((YahooTrailersListItem)_trailerlist.SelectedItem)._trailer2URL != null) { movieinfo._trailer2URL = ((YahooTrailersListItem)_trailerlist.SelectedItem)._trailer2URL; } if (((YahooTrailersListItem)_trailerlist.SelectedItem)._trailerURL != null) { movieinfo._trailerURL = ((YahooTrailersListItem)_trailerlist.SelectedItem)._trailerURL; } if (((YahooTrailersListItem)_trailerlist.SelectedItem)._teaser2URL != null) { movieinfo._teaser2URL = ((YahooTrailersListItem)_trailerlist.SelectedItem)._teaser2URL; } if (((YahooTrailersListItem)_trailerlist.SelectedItem)._teaserURL != null) { movieinfo._teaserURL = ((YahooTrailersListItem)_trailerlist.SelectedItem)._teaserURL; } ShowScreen s = new ShowScreen("YahooTrailersDetailsScreen", movieinfo); s.Execute(); return; }
// Show slideshow when item is entered private void ComicsViewer_ItemActivated(object sender, ItemActivatedArgs args) { if (((ComicListItem)(_comicsViewer.SelectedItem)).Caption.Text == "Downloading Comics... Click to refresh") { Fillcomics(); return; } ArrayList aComics; aComics = new ArrayList(); foreach (ComicListItem item in _comicsViewer.Items) { aComics.Add(item.FullName); } string[] comics = (string[])aComics.ToArray(typeof(string)); double zoom; try { string sZoom; SingletonConfig.Instance.GetPropertyAsString("Comics.DefaultZoom", out sZoom); zoom = double.Parse(sZoom); zoom /= 100; } catch { zoom = 1.5; } ShowScreen s = new ShowScreen("ComicsSlideShowScreen", new object[] { comics, _comicsViewer.SelectedIndex, false, zoom, true }); s.Execute(); return; }
// Play selected trailer private void List_ItemActivated(object sender, ItemActivatedArgs args) { string movieURL = ((Trailer)_trailers.SelectedItem)._movieURL.Replace("&", "&"); SnapStream.Logging.WriteLog(movieURL); movURL = null; // Create a webclient try { // Get the trailer qtl file HttpWebRequest webreq = (HttpWebRequest)WebRequest.Create(new System.Uri(movieURL)); webreq.Referer = "http://movies.yahoo.com/"; webreq.AllowAutoRedirect = false; HttpWebResponse webres = (HttpWebResponse)webreq.GetResponse(); Stream resStream = webres.GetResponseStream(); string response = new StreamReader(resStream).ReadToEnd(); //SnapStream.Logging.WriteLog("Movie URL Response: " + response); int startindex = response.IndexOf("HREF=\"") + 6; int endindex = response.IndexOf("\">", startindex); string qtlURL = response.Substring(startindex, endindex - startindex).Trim(); //SnapStream.Logging.WriteLog("QTL URL: " + qtlURL); // Get the sid in the qtl file webreq = (HttpWebRequest)WebRequest.Create(new System.Uri(qtlURL.Replace("&", "&"))); webreq.AllowAutoRedirect = true; // was false webreq.Referer = "http://movies.yahoo.com/"; webres = (HttpWebResponse)webreq.GetResponse(); resStream = webres.GetResponseStream(); response = new StreamReader(resStream).ReadToEnd(); //SnapStream.Logging.WriteLog("QTL URL Response: " + response); startindex = response.IndexOf("sid=") + 4; endindex = response.IndexOf("&t", startindex); movURL = "http://playlist.yahoo.com/makeplaylist.dll?sdm=web&pt=rd&sid=" + response.Substring(startindex, endindex - startindex).Trim(); //SnapStream.Logging.WriteLog("MOV URL: " + movURL); webreq = (HttpWebRequest)WebRequest.Create(new System.Uri(movURL.Replace("&", "&"))); webreq.AllowAutoRedirect = false; // was false webres = (HttpWebResponse)webreq.GetResponse(); resStream = webres.GetResponseStream(); response = new StreamReader(resStream).ReadToEnd(); //SnapStream.Logging.WriteLog("QTL URL Response: " + response); // Create local movie file path movTitle = _header.Text + "_" + ((Trailer)_trailers.SelectedItem).Title; movLocalFile = movTitle + ".mov"; movLocalFile = movLocalFile.Replace(":", "").Replace("?", ""); movLocalPath = homedir + "\\Trailers\\" + movLocalFile; //SnapStream.Logging.WriteLog(movLocalFile); // Download or Play trailer if (((Trailer)_trailers.SelectedItem).Title.StartsWith("PLAY")) { movLocalPath = movLocalPath.Replace("PLAY ", ""); //SnapStream.Logging.WriteLog("Playing: " + movLocalPath); ShowScreen s = new ShowScreen("VideoPlayerScreen", movLocalPath); s.Execute(); } else { //SnapStream.Logging.WriteLog("Downloading"); //dlThread = new Thread(new ThreadStart(download)); //dlThread.Start(); SingletonDownloader.Instance.movLocalPath = movLocalPath; SingletonDownloader.Instance.movURL = movURL; SingletonDownloader.Instance.Download(); ((Trailer)_trailers.SelectedItem).ChangeControl("PLAY"); //SnapStream.Logging.WriteLog(SingletonDownloader.Instance.isDownloading.ToString()); } } catch (Exception exp) { string str = exp.Message; } }
// Go to the other View private void _view_Click(object sender, EventArgs e) { ShowScreen s = new ShowScreen( "YahooTrailersPosterScreen" ); s.Execute(); }
// Go to the Trailer Library Screen private void _library_Click(object sender, EventArgs e) { ShowScreen s = new ShowScreen( "MovFileBrowserScreen" ); s.Execute(); }
// Show when item is entered private void List_ItemActivated( object sender, ItemActivatedArgs args ) { movieinfo = new YahooTrailersInfo(); movieinfo.Title = ((YahooTrailersListItem)_trailerlist.SelectedItem).Title.Text; movieinfo.Details = replaceSpecials(((YahooTrailersListItem)_trailerlist.SelectedItem)._details); movieinfo.Starring = replaceSpecials(((YahooTrailersListItem)_trailerlist.SelectedItem)._starring); movieinfo.Genre = replaceSpecials(((YahooTrailersListItem)_trailerlist.SelectedItem)._genre); movieinfo.ReleaseDate = replaceSpecials(((YahooTrailersListItem)_trailerlist.SelectedItem)._releasedate); movieinfo.Rating = replaceSpecials(((YahooTrailersListItem)_trailerlist.SelectedItem)._rating); movieinfo.JPEGURL = replaceSpecials(((YahooTrailersListItem)_trailerlist.SelectedItem)._jpegURL); if ( ((YahooTrailersListItem)_trailerlist.SelectedItem)._trailer2URL != null ) movieinfo._trailer2URL = ((YahooTrailersListItem)_trailerlist.SelectedItem)._trailer2URL; if ( ((YahooTrailersListItem)_trailerlist.SelectedItem)._trailerURL != null ) movieinfo._trailerURL = ((YahooTrailersListItem)_trailerlist.SelectedItem)._trailerURL; if ( ((YahooTrailersListItem)_trailerlist.SelectedItem)._teaser2URL != null ) movieinfo._teaser2URL = ((YahooTrailersListItem)_trailerlist.SelectedItem)._teaser2URL; if ( ((YahooTrailersListItem)_trailerlist.SelectedItem)._teaserURL != null ) movieinfo._teaserURL = ((YahooTrailersListItem)_trailerlist.SelectedItem)._teaserURL; ShowScreen s = new ShowScreen( "YahooTrailersDetailsScreen", movieinfo ); s.Execute(); return; }
// Go to the other View private void _view_Click(object sender, EventArgs e) { ShowScreen s = new ShowScreen("YahooTrailersPosterScreen"); s.Execute(); }
// Go to the Trailer Library Screen private void _library_Click(object sender, EventArgs e) { ShowScreen s = new ShowScreen("MovFileBrowserScreen"); s.Execute(); }
// Show slideshow when item is entered private void ComicsViewer_ItemActivated( object sender, ItemActivatedArgs args ) { if (((ComicListItem)(_comicsViewer.SelectedItem)).Caption.Text == "Downloading Comics... Click to refresh") { Fillcomics(); return; } ArrayList aComics; aComics = new ArrayList(); foreach( ComicListItem item in _comicsViewer.Items ) { aComics.Add( item.FullName ); } string[] comics = (string[])aComics.ToArray( typeof(string) ); double zoom; try { string sZoom; SingletonConfig.Instance.GetPropertyAsString( "Comics.DefaultZoom", out sZoom ); zoom = double.Parse( sZoom ); zoom /= 100; } catch { zoom = 1.5; } ShowScreen s = new ShowScreen( "ComicsSlideShowScreen", new object[] { comics, _comicsViewer.SelectedIndex, false, zoom, true } ); s.Execute(); return; }
// Play selected trailer private void List_ItemActivated( object sender, ItemActivatedArgs args ) { string movieURL = ((Trailer)_trailers.SelectedItem)._movieURL.Replace("&","&"); SnapStream.Logging.WriteLog(movieURL); movURL = null; // Create a webclient try { // Get the trailer qtl file HttpWebRequest webreq = (HttpWebRequest)WebRequest.Create(new System.Uri(movieURL)); webreq.Referer = "http://movies.yahoo.com/"; webreq.AllowAutoRedirect = false; HttpWebResponse webres = (HttpWebResponse)webreq.GetResponse(); Stream resStream = webres.GetResponseStream(); string response = new StreamReader( resStream ).ReadToEnd(); //SnapStream.Logging.WriteLog("Movie URL Response: " + response); int startindex = response.IndexOf("HREF=\"")+6; int endindex = response.IndexOf("\">",startindex); string qtlURL = response.Substring(startindex,endindex-startindex).Trim(); //SnapStream.Logging.WriteLog("QTL URL: " + qtlURL); // Get the sid in the qtl file webreq = (HttpWebRequest)WebRequest.Create(new System.Uri(qtlURL.Replace("&","&"))); webreq.AllowAutoRedirect = true; // was false webreq.Referer = "http://movies.yahoo.com/"; webres = (HttpWebResponse)webreq.GetResponse(); resStream = webres.GetResponseStream(); response = new StreamReader( resStream ).ReadToEnd(); //SnapStream.Logging.WriteLog("QTL URL Response: " + response); startindex = response.IndexOf("sid=")+4; endindex = response.IndexOf("&t",startindex); movURL = "http://playlist.yahoo.com/makeplaylist.dll?sdm=web&pt=rd&sid=" + response.Substring(startindex,endindex-startindex).Trim(); //SnapStream.Logging.WriteLog("MOV URL: " + movURL); webreq = (HttpWebRequest)WebRequest.Create(new System.Uri(movURL.Replace("&","&"))); webreq.AllowAutoRedirect = false; // was false webres = (HttpWebResponse)webreq.GetResponse(); resStream = webres.GetResponseStream(); response = new StreamReader( resStream ).ReadToEnd(); //SnapStream.Logging.WriteLog("QTL URL Response: " + response); // Create local movie file path movTitle = _header.Text + "_" + ((Trailer)_trailers.SelectedItem).Title; movLocalFile = movTitle + ".mov"; movLocalFile = movLocalFile.Replace(":","").Replace("?",""); movLocalPath = homedir + "\\Trailers\\" + movLocalFile; //SnapStream.Logging.WriteLog(movLocalFile); // Download or Play trailer if (((Trailer)_trailers.SelectedItem).Title.StartsWith("PLAY")) { movLocalPath = movLocalPath.Replace("PLAY ",""); //SnapStream.Logging.WriteLog("Playing: " + movLocalPath); ShowScreen s = new ShowScreen("VideoPlayerScreen", movLocalPath); s.Execute(); } else { //SnapStream.Logging.WriteLog("Downloading"); //dlThread = new Thread(new ThreadStart(download)); //dlThread.Start(); SingletonDownloader.Instance.movLocalPath = movLocalPath; SingletonDownloader.Instance.movURL = movURL; SingletonDownloader.Instance.Download(); ((Trailer)_trailers.SelectedItem).ChangeControl("PLAY"); //SnapStream.Logging.WriteLog(SingletonDownloader.Instance.isDownloading.ToString()); } } catch(Exception exp) { string str = exp.Message; } }