From: <gre...@us...> - 2007-04-26 15:21:53
|
Revision: 346 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=346&view=rev Author: gregmac45 Date: 2007-04-26 08:16:31 -0700 (Thu, 26 Apr 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/OnlinePhotos/Flickr.cs trunk/plugins/OnlinePhotos/MyClass.cs Modified: trunk/plugins/OnlinePhotos/Flickr.cs =================================================================== --- trunk/plugins/OnlinePhotos/Flickr.cs 2007-04-26 00:24:38 UTC (rev 345) +++ trunk/plugins/OnlinePhotos/Flickr.cs 2007-04-26 15:16:31 UTC (rev 346) @@ -58,12 +58,14 @@ } public static List<MyPhoto> getPhotosByTag(String tag) { - Photos photos = _flickr.PhotosSearch(tag,""); + PhotoSearchExtras extras = new PhotoSearchExtras(); + Photos photos = _flickr.PhotosSearch( + tag,TagMode.AllTags,"",extras); return loadMyPhotoList(photos); } public static List<MyPhoto> getPhotosByText(String text) { - Photos photos = _flickr.PhotosSearchText(text, ""); + Photos photos = _flickr.PhotosSearchText(text); return loadMyPhotoList(photos); } private static List<MyPhoto> loadMyPhotoList(Photos photos) Modified: trunk/plugins/OnlinePhotos/MyClass.cs =================================================================== --- trunk/plugins/OnlinePhotos/MyClass.cs 2007-04-26 00:24:38 UTC (rev 345) +++ trunk/plugins/OnlinePhotos/MyClass.cs 2007-04-26 15:16:31 UTC (rev 346) @@ -180,15 +180,38 @@ { //_log.Info("onPageLoad state home"); GUIPropertyManager.SetProperty("#header.label", "Online Photos"); + DisplayHome(); //DisplaySites(); } + else if (_CurrentState == State.categories) + { + DisplayCurrentPhotos(); + } currentView = View.Icons; ChangeFacadeView(); base.OnPageLoad(); } - + public override void OnAction(Action action) + { + if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU) + { + if (_CurrentState == State.videos) + { + //DisplayCategories(); + //_CurrentState = State.categories; + //return; + } + else if (_CurrentState == State.categories) + { + DisplayHome(); + _CurrentState = State.home; + return; + } + } + base.OnAction(action); + } protected override void OnPageDestroy(int new_windowId) { @@ -205,6 +228,41 @@ { OnSlideShow(); } + else if (control == facadeView) + { + String SelectedSiteId = facadeView.SelectedListItem.Path; + switch (SelectedSiteId) + { + case "1": + DisplayInterestingFlickrPhotos(); + _CurrentState = State.categories; + break; + case "2": + DisplayRecentFlickrPhotos(); + _CurrentState = State.categories; + break; + case "3": + string q = ""; + if (GetUserInputString(ref q)) + { + + DisplayFlickrPhotosWithTags(q); + _CurrentState = State.categories; + + } + break; + case "4": + string text = ""; + if (GetUserInputString(ref text)) + { + + DisplayFlickrPhotosWithText(text); + _CurrentState = State.categories; + + } + break; + } + } } public void DisplayInterestingFlickrPhotos() { @@ -222,6 +280,21 @@ CurrentPhotoList = MyFlickr.getPhotosByTag(tags); DisplayCurrentPhotos(); } + public void DisplayFlickrPhotosWithText(String text) + { + CurrentPhotoList = MyFlickr.getPhotosByText(text); + DisplayCurrentPhotos(); + } + private bool GetUserInputString(ref string sString) + { + VirtualKeyboard keyBoard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD); + keyBoard.Reset(); + keyBoard.IsSearchKeyboard = true; + keyBoard.Text = sString; + keyBoard.DoModal(GetID); // show it... + if (keyBoard.IsConfirmed) sString = keyBoard.Text; + return keyBoard.IsConfirmed; + } public void DisplayCurrentPhotos() { facadeView.Clear(); @@ -442,7 +515,7 @@ Log.Error(e); } } - private void DisplaySites() + private void DisplayHome() { //facadeView.Clear(); GUIControl.ClearControl(GetID, facadeView.GetID); @@ -450,17 +523,32 @@ GUIListItem loListItem; //foreach (Site loSite in moSiteList.Values) //{ - loListItem = new GUIListItem("Flickr"); + loListItem = new GUIListItem("Flickr - Interesting Photos"); loListItem.Path = "1"; loListItem.IsFolder = true; MediaPortal.Util.Utils.SetDefaultIcons(loListItem); facadeView.Add(loListItem); - - loListItem = new GUIListItem("Picasa Web"); + + loListItem = new GUIListItem("Flickr - Recent Photos"); loListItem.Path = "2"; loListItem.IsFolder = true; MediaPortal.Util.Utils.SetDefaultIcons(loListItem); facadeView.Add(loListItem); + + + loListItem = new GUIListItem("Flickr - Search by tag"); + loListItem.Path = "3"; + loListItem.IsFolder = true; + MediaPortal.Util.Utils.SetDefaultIcons(loListItem); + facadeView.Add(loListItem); + + loListItem = new GUIListItem("Flickr - Search by text"); + loListItem.Path = "4"; + loListItem.IsFolder = true; + MediaPortal.Util.Utils.SetDefaultIcons(loListItem); + facadeView.Add(loListItem); + + //} //GUIPropertyManager.SetProperty("#itemcount", facadeView.Count-1 + ""); } @@ -516,7 +604,7 @@ GUIListItem item = facadeView[i]; if (!item.IsFolder && !item.IsRemote) { - SlideShow.Add(CurrentPhotoList[i].smallUrl); + SlideShow.Add(facadeView[i].ThumbnailImage); } i++; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gre...@us...> - 2007-04-28 00:26:06
|
Revision: 348 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=348&view=rev Author: gregmac45 Date: 2007-04-27 17:25:53 -0700 (Fri, 27 Apr 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/OnlinePhotos/Flickr.cs trunk/plugins/OnlinePhotos/MyClass.cs Modified: trunk/plugins/OnlinePhotos/Flickr.cs =================================================================== --- trunk/plugins/OnlinePhotos/Flickr.cs 2007-04-27 16:26:25 UTC (rev 347) +++ trunk/plugins/OnlinePhotos/Flickr.cs 2007-04-28 00:25:53 UTC (rev 348) @@ -46,6 +46,70 @@ } + public static List<MyAlbum> getUserPhotoSets(String username) + { + List<MyAlbum> myPhotoSets = new List<MyAlbum>(); + String userID = getUserId(username); + if (userID == String.Empty) + { + return myPhotoSets; + } + //_flickr.Photo + Photosets sets = _flickr.PhotosetsGetList(userID); + + + foreach (Photoset set in sets.PhotosetCollection) + { + myPhotoSets.Add(loadPhotoSet(set)); + } + //set. + return myPhotoSets; + + + } + public static MyAlbum loadPhotoSet(Photoset set) + { + MyAlbum album = new MyAlbum(); + album.id = set.PhotosetId; + album.title = set.Title; + album.coverThumbnailUrl = set.PhotosetThumbnailUrl; + album.photoCollection = loadMyPhotoList(set.PhotoCollection); + return album; + + } + public static List<MyPhoto> getPhotoSetPhotos(String photoSetId) + { + Photo[] userPhotosArray = _flickr.PhotosetsGetPhotos(photoSetId); + Photos userPhotos = new Photos(); + foreach (Photo photo in userPhotosArray) + { + userPhotos.PhotoCollection.Add(photo); + } + return loadMyPhotoList(userPhotos); + + + } + public static List<MyAlbum> getGroupsByText(String text) + { + GroupSearchResults results = _flickr.GroupsSearch(text); + List<MyAlbum> groups = new List<MyAlbum>(); + MyAlbum group ; + foreach (GroupSearchResult result in results.Groups) + { + group = new MyAlbum(); + group.id = result.GroupId; + group.title = result.GroupName; + groups.Add(group); + } + return groups; + //result. + } + public static void getGroupPhotos(String groupId){ + //brasil-brazil + _flickr.GroupPoolGetPhotos(groupId); + } + + public static List<MyPhoto> getInterestingPhotos(){ PhotoSearchExtras extras = new PhotoSearchExtras(); Photos photos = _flickr.InterestingnessGetList(extras,50,1); @@ -68,6 +132,15 @@ Photos photos = _flickr.PhotosSearchText(text); return loadMyPhotoList(photos); } + private static List<MyPhoto> loadMyPhotoList(Photo[] photoArray) + { + Photos photos = new Photos(); + foreach(Photo photo in photoArray) + { + photos.PhotoCollection.Add(photo); + } + return loadMyPhotoList(photos); + } private static List<MyPhoto> loadMyPhotoList(Photos photos) { List<MyPhoto> myPhotoList = new List<MyPhoto>(); Modified: trunk/plugins/OnlinePhotos/MyClass.cs =================================================================== --- trunk/plugins/OnlinePhotos/MyClass.cs 2007-04-27 16:26:25 UTC (rev 347) +++ trunk/plugins/OnlinePhotos/MyClass.cs 2007-04-28 00:25:53 UTC (rev 348) @@ -42,6 +42,13 @@ public String smallUrl; public String ThumbName; } + public class MyAlbum + { + public string id; + public string title; + public string coverThumbnailUrl; + public List<MyPhoto> photoCollection = new List<MyPhoto>(); + } /// <summary> /// Description of MyClass. @@ -57,6 +64,7 @@ private State _CurrentState = State.home; protected View currentView = View.List; protected List<MyPhoto> CurrentPhotoList; + protected List<MyAlbum> CurrentAlbumList; protected bool _imagesDone = true; public enum State { @@ -261,6 +269,22 @@ } break; + case "5": + DisplayFlickrUserPhotos("gregmac45"); + _CurrentState = State.categories; + + + break; + case "6": + string gtext = ""; + if (GetUserInputString(ref gtext)) + { + + DisplayFlickrGroupsWithText(gtext); + _CurrentState = State.categories; + + } + break; } } } @@ -285,6 +309,17 @@ CurrentPhotoList = MyFlickr.getPhotosByText(text); DisplayCurrentPhotos(); } + public void DisplayFlickrGroupsWithText(String text) + { + CurrentAlbumList = MyFlickr.getGroupsByText(text); + DisplayCurrentAlbums(); + } + public void DisplayFlickrUserPhotos(String user) + { + CurrentPhotoList = MyFlickr.getUserPhotos(user); + DisplayCurrentPhotos(); + } + private bool GetUserInputString(ref string sString) { VirtualKeyboard keyBoard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD); @@ -295,6 +330,7 @@ if (keyBoard.IsConfirmed) sString = keyBoard.Text; return keyBoard.IsConfirmed; } + public void DisplayCurrentPhotos() { facadeView.Clear(); @@ -330,6 +366,39 @@ } } + public void DisplayCurrentAlbums() + { + facadeView.Clear(); + GUIListItem item; + int i = 0; + List<String> ImageList = new List<string>(); + foreach (MyAlbum album in CurrentAlbumList) + { + item = new GUIListItem(album.title); + item.Path = album.id; + item.ItemId = i; + item.RetrieveArt = false; + item.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); + item.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(item_OnItemSelected); + ImageList.Add(album.coverThumbnailUrl); + facadeView.Add(item); + GUIWindowManager.Process(); + i++; + + } + BackgroundWorker worker = new BackgroundWorker(); + + worker.DoWork += new DoWorkEventHandler(downloadImages); + worker.RunWorkerAsync(ImageList); + + using (WaitCursor cursor = new WaitCursor()) + { + while (_imagesDone == false) + { + GUIWindowManager.Process(); + } + } + } private String GetThumbnail(String lsUrl) { string lsThumb = MediaPortal.Util.Utils.GetThumb(lsUrl); @@ -547,8 +616,18 @@ loListItem.IsFolder = true; MediaPortal.Util.Utils.SetDefaultIcons(loListItem); facadeView.Add(loListItem); - + loListItem = new GUIListItem("Flickr - My Photos"); + loListItem.Path = "5"; + loListItem.IsFolder = true; + MediaPortal.Util.Utils.SetDefaultIcons(loListItem); + facadeView.Add(loListItem); + + loListItem = new GUIListItem("Flickr - Search Groups"); + loListItem.Path = "6"; + loListItem.IsFolder = true; + MediaPortal.Util.Utils.SetDefaultIcons(loListItem); + facadeView.Add(loListItem); //} //GUIPropertyManager.SetProperty("#itemcount", facadeView.Count-1 + ""); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gre...@us...> - 2007-05-04 00:46:25
|
Revision: 371 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=371&view=rev Author: gregmac45 Date: 2007-05-03 17:46:15 -0700 (Thu, 03 May 2007) Log Message: ----------- Added Picasa access Modified Paths: -------------- trunk/plugins/OnlinePhotos/Flickr.cs trunk/plugins/OnlinePhotos/MyClass.cs trunk/plugins/OnlinePhotos/OnlinePhotos.csproj trunk/plugins/OnlinePhotos/OnlinePhotos.sln trunk/plugins/OnlinePhotos/OnlinePhotos.suo Added Paths: ----------- trunk/plugins/OnlinePhotos/Picasa.cs trunk/plugins/OnlinePhotos/google-sharp/ trunk/plugins/OnlinePhotos/google-sharp/AssemblyInfo.cs trunk/plugins/OnlinePhotos/google-sharp/Mono.Google/ trunk/plugins/OnlinePhotos/google-sharp/Mono.Google/Authentication.cs trunk/plugins/OnlinePhotos/google-sharp/Mono.Google/CaptchaException.cs trunk/plugins/OnlinePhotos/google-sharp/Mono.Google/GoogleConnection.cs trunk/plugins/OnlinePhotos/google-sharp/Mono.Google/GoogleService.cs trunk/plugins/OnlinePhotos/google-sharp/Mono.Google/MultipartRequest.cs trunk/plugins/OnlinePhotos/google-sharp/Mono.Google/NoCheckCertificatePolicy.cs trunk/plugins/OnlinePhotos/google-sharp/Mono.Google.Picasa/ trunk/plugins/OnlinePhotos/google-sharp/Mono.Google.Picasa/AlbumAccess.cs trunk/plugins/OnlinePhotos/google-sharp/Mono.Google.Picasa/CreateAlbumException.cs trunk/plugins/OnlinePhotos/google-sharp/Mono.Google.Picasa/DeleteAlbumException.cs trunk/plugins/OnlinePhotos/google-sharp/Mono.Google.Picasa/GDataApi.cs trunk/plugins/OnlinePhotos/google-sharp/Mono.Google.Picasa/PicasaAlbum.cs trunk/plugins/OnlinePhotos/google-sharp/Mono.Google.Picasa/PicasaAlbumCollection.cs trunk/plugins/OnlinePhotos/google-sharp/Mono.Google.Picasa/PicasaPicture.cs trunk/plugins/OnlinePhotos/google-sharp/Mono.Google.Picasa/PicasaPictureCollection.cs trunk/plugins/OnlinePhotos/google-sharp/Mono.Google.Picasa/PicasaWeb.cs trunk/plugins/OnlinePhotos/google-sharp/Mono.Google.Picasa/UploadPictureException.cs trunk/plugins/OnlinePhotos/google-sharp/Mono.Google.Picasa/UploadProgressEventArgs.cs trunk/plugins/OnlinePhotos/google-sharp/Mono.Google.Picasa/UploadProgressEventHandler.cs trunk/plugins/OnlinePhotos/google-sharp/Mono.Google.Picasa/XmlUtil.cs trunk/plugins/OnlinePhotos/google-sharp/PicasaNet.csproj Modified: trunk/plugins/OnlinePhotos/Flickr.cs =================================================================== --- trunk/plugins/OnlinePhotos/Flickr.cs 2007-05-03 08:25:35 UTC (rev 370) +++ trunk/plugins/OnlinePhotos/Flickr.cs 2007-05-04 00:46:15 UTC (rev 371) @@ -46,6 +46,16 @@ } + public static List<MyPhoto> getUserFavoritePhotos(String username){ + List<MyPhoto> myPhotoList = new List<MyPhoto>(); + String userID = getUserId(username); + if (userID == String.Empty) + { + return myPhotoList; + } + Photos userPhotos = _flickr.FavoritesGetPublicList(userID); + return loadMyPhotoList(userPhotos); + } public static List<MyAlbum> getUserPhotoSets(String username) { List<MyAlbum> myPhotoSets = new List<MyAlbum>(); @@ -71,7 +81,7 @@ { MyAlbum album = new MyAlbum(); album.id = set.PhotosetId; - album.title = set.Title; + album.Title = set.Title; album.coverThumbnailUrl = set.PhotosetThumbnailUrl; album.photoCollection = loadMyPhotoList(set.PhotoCollection); return album; @@ -98,7 +108,7 @@ { group = new MyAlbum(); group.id = result.GroupId; - group.title = result.GroupName; + group.Title = result.GroupName; groups.Add(group); } return groups; Modified: trunk/plugins/OnlinePhotos/MyClass.cs =================================================================== --- trunk/plugins/OnlinePhotos/MyClass.cs 2007-05-03 08:25:35 UTC (rev 370) +++ trunk/plugins/OnlinePhotos/MyClass.cs 2007-05-04 00:46:15 UTC (rev 371) @@ -16,497 +16,597 @@ using System.Xml; using System.Net; using System.Web; +using System.IO; using System.ComponentModel; namespace OnlinePhotos { - public class MyPhoto - { - private String title; - public String Title - { - get - { - return title; - } - set - { - title = value; - ThumbName = Utils.GetFilename(Utils.GetThumb(value)); - } - } - public String id; - public String thumbnailUrl; - public String largeUrl; - public String mediumUrl; - public String smallUrl; - public String ThumbName; - } - public class MyAlbum - { - public string id; - public string title; - public string coverThumbnailUrl; - public List<MyPhoto> photoCollection = new List<MyPhoto>(); - } + public class MyPhoto + { + private String title; + public String Title + { + get + { + return title; + } + set + { + title = value; + + } + } + public String id; + public String thumbnailUrl; + public String largeUrl; + public String mediumUrl; + public String smallUrl; + private String thumbName; + public String ThumbName{ + get{ + if(String.IsNullOrEmpty(thumbName)){ + thumbName = Utils.GetFilename(Utils.GetThumb(title))+id; + } + return thumbName; + } + } + } + public class MyAlbum + { + public string id; + private string title; + public string coverThumbnailUrl; + private String thumbName; + public List<MyPhoto> photoCollection = new List<MyPhoto>(); + public String Title + { + get + { + return title; + } + set + { + title = value; + //ThumbName = "alb"+Utils.GetFilename(Utils.GetThumb(value)); + } + } + public String ThumbName{ + get{ + if(String.IsNullOrEmpty(thumbName)){ + thumbName = Utils.GetFilename(Utils.GetThumb(title))+id; + } + return thumbName; + } + } + } - /// <summary> - /// Description of MyClass. - /// </summary> - public class MyOnlinePhotos : GUIWindow, ISetupForm - { - [SkinControlAttribute(2)] - protected GUIButtonControl btnViewAs = null; - [SkinControlAttribute(3)] - protected GUIButtonControl btnSlide = null; - [SkinControlAttribute(50)] - protected GUIFacadeControl facadeView = null; - private State _CurrentState = State.home; - protected View currentView = View.List; - protected List<MyPhoto> CurrentPhotoList; - protected List<MyAlbum> CurrentAlbumList; - protected bool _imagesDone = true; - public enum State - { - home = 0, - categories = 1, - videos = 2 - } - public enum View - { - List = 0, - Icons = 1, - LargeIcons = 2, - FilmStrip = 3 - } + /// <summary> + /// Description of MyClass. + /// </summary> + public class MyOnlinePhotos : GUIWindow, ISetupForm + { + [SkinControlAttribute(2)] + protected GUIButtonControl btnViewAs = null; + [SkinControlAttribute(3)] + protected GUIButtonControl btnSlide = null; + [SkinControlAttribute(50)] + protected GUIFacadeControl facadeView = null; + private State _CurrentState = State.home; + protected View currentView = View.List; + protected List<MyPhoto> CurrentPhotoList; + protected List<MyAlbum> CurrentAlbumList; + protected MyAlbum CurrentAlbum; + protected bool _imagesDone = true; + protected bool _stopImgDownload = false; + public enum State + { + home = 0, + albums = 1, + photos = 2, + album_photos = 3 + } + public enum View + { + List = 0, + Icons = 1, + LargeIcons = 2, + FilmStrip = 3 + } - public string PluginName() - { + public string PluginName() + { - return "Online Photos"; + return "Online Photos"; - } + } - // Returns the description of the plugin is shown in the plugin menu + // Returns the description of the plugin is shown in the plugin menu - public string Description() - { + public string Description() + { - return "Flickr and Google Photo Plugin"; + return "Flickr and Google Photo Plugin"; - } + } - // Returns the author of the plugin which is shown in the plugin menu + // Returns the author of the plugin which is shown in the plugin menu - public string Author() - { + public string Author() + { - return "GregMac45"; + return "GregMac45"; - } + } - // show the setup dialog + // show the setup dialog - public void ShowPlugin() - { + public void ShowPlugin() + { - //MessageBox.Show("Nothing to configure, this is just an example"); + //MessageBox.Show("Nothing to configure, this is just an example"); - } + } - // Indicates whether plugin can be enabled/disabled + // Indicates whether plugin can be enabled/disabled - public bool CanEnable() - { + public bool CanEnable() + { - return true; + return true; - } + } - // get ID of windowplugin belonging to this setup + // get ID of windowplugin belonging to this setup - public int GetWindowId() - { + public int GetWindowId() + { - return GetID; + return GetID; - } + } - // Indicates if plugin is enabled by default; + // Indicates if plugin is enabled by default; - public bool DefaultEnabled() - { + public bool DefaultEnabled() + { - return true; + return true; - } + } - // indicates if a plugin has its own setup screen + // indicates if a plugin has its own setup screen - public bool HasSetup() - { + public bool HasSetup() + { - return false; + return false; - } - public override int GetID - { - get - { - return 5757; - } - set - { - } - } + } + public override int GetID + { + get + { + return 5757; + } + set + { + } + } - public override bool Init() - { - LoadSettings(); - return Load(GUIGraphicsContext.Skin + @"\myonlinephotos.xml"); + public override bool Init() + { + LoadSettings(); + return Load(GUIGraphicsContext.Skin + @"\myonlinephotos.xml"); - } - public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage) - { - strButtonText = PluginName(); + } + public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage) + { + strButtonText = PluginName(); - strButtonImage = String.Empty; + strButtonImage = String.Empty; - strButtonImageFocus = String.Empty; + strButtonImageFocus = String.Empty; - strPictureImage = String.Empty; + strPictureImage = String.Empty; - return true; - } - public bool ShowDefaultHome() - { - return true; - } - protected override void OnPageLoad() - { - if (_CurrentState == State.home) - { - //_log.Info("onPageLoad state home"); - GUIPropertyManager.SetProperty("#header.label", "Online Photos"); - DisplayHome(); - //DisplaySites(); - } - else if (_CurrentState == State.categories) - { - DisplayCurrentPhotos(); - } - currentView = View.Icons; - ChangeFacadeView(); - - - base.OnPageLoad(); - } - public override void OnAction(Action action) - { - if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU) - { - if (_CurrentState == State.videos) - { - //DisplayCategories(); - //_CurrentState = State.categories; - //return; - } - else if (_CurrentState == State.categories) - { - DisplayHome(); - _CurrentState = State.home; - return; - } - } - base.OnAction(action); - } - protected override void OnPageDestroy(int new_windowId) - { + return true; + } + public bool ShowDefaultHome() + { + return true; + } + protected override void OnPageLoad() + { + if (_CurrentState == State.home) + { + //_log.Info("onPageLoad state home"); + GUIPropertyManager.SetProperty("#header.label", "Online Photos"); + DisplayHome(); + //DisplaySites(); + } + else if (_CurrentState == State.photos) + { + DisplayCurrentPhotos(false); + } + currentView = View.Icons; + ChangeFacadeView(); + + + base.OnPageLoad(); + } + public override void OnAction(Action action) + { + if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU) + { + if (_CurrentState == State.album_photos) + { + DisplayCurrentAlbums(); + _CurrentState = State.albums; + return; + } + else if (_CurrentState == State.albums || _CurrentState == State.photos) + { + DisplayHome(); + _CurrentState = State.home; + return; + } + _stopImgDownload = true; + + } + base.OnAction(action); + } + protected override void OnPageDestroy(int new_windowId) + { - base.OnPageDestroy(new_windowId); - } - - protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType) - { - if (control == btnViewAs) - { - ChangeFacadeView(); - } - else if (control == btnSlide) - { - OnSlideShow(); - } - else if (control == facadeView) - { - String SelectedSiteId = facadeView.SelectedListItem.Path; - switch (SelectedSiteId) - { - case "1": - DisplayInterestingFlickrPhotos(); - _CurrentState = State.categories; - break; - case "2": - DisplayRecentFlickrPhotos(); - _CurrentState = State.categories; - break; - case "3": - string q = ""; - if (GetUserInputString(ref q)) - { + base.OnPageDestroy(new_windowId); + } + + protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType) + { + if (control == btnViewAs) + { + ChangeFacadeView(); + } + else if (control == btnSlide) + { + OnSlideShow(); + } + else if (control == facadeView && _CurrentState == State.home) + { + String SelectedSiteId = facadeView.SelectedListItem.Path; + switch (SelectedSiteId) + { + case "1": + DisplayInterestingFlickrPhotos(); + _CurrentState = State.photos; + break; + case "2": + DisplayRecentFlickrPhotos(); + _CurrentState = State.photos; + break; + case "3": + string q = ""; + if (GetUserInputString(ref q)) + { - DisplayFlickrPhotosWithTags(q); - _CurrentState = State.categories; - - } - break; - case "4": - string text = ""; - if (GetUserInputString(ref text)) - { + DisplayFlickrPhotosWithTags(q); + _CurrentState = State.photos; + + } + break; + case "4": + string text = ""; + if (GetUserInputString(ref text)) + { - DisplayFlickrPhotosWithText(text); - _CurrentState = State.categories; + DisplayFlickrPhotosWithText(text); + _CurrentState = State.photos; - } - break; - case "5": - DisplayFlickrUserPhotos("gregmac45"); - _CurrentState = State.categories; + } + break; + case "5": + DisplayFlickrUserPhotos("gregmac45"); + _CurrentState = State.photos; - - break; - case "6": - string gtext = ""; - if (GetUserInputString(ref gtext)) - { + + break; + case "6": + string gtext = ""; + if (GetUserInputString(ref gtext)) + { + DisplayFlickrGroupsWithText(gtext); + _CurrentState = State.photos; + } + break; + case "7": + DisplayFlickrUserFavoritePhotos("gregmac45"); + _CurrentState = State.photos; + break; + case "8": + DisplayPicasaAlbums("gregmac45"); + _CurrentState = State.albums; + break; + } + } + else if (control == facadeView && _CurrentState == State.albums) + { + _stopImgDownload = true; + CurrentAlbum = CurrentAlbumList[facadeView.SelectedListItemIndex]; + DisplayAlbumPhotos(); + + _CurrentState = State.album_photos; + } + else if (control == facadeView && (_CurrentState == State.photos || _CurrentState== State.album_photos)) + { + OnShowPicture(facadeView.SelectedListItem.ThumbnailImage); + } + } + public void DisplayInterestingFlickrPhotos() + { + CurrentPhotoList = + MyFlickr.getInterestingPhotos(); + DisplayCurrentPhotos(); + } + public void DisplayRecentFlickrPhotos() + { + CurrentPhotoList = MyFlickr.getRecentPhotos(); + DisplayCurrentPhotos(); + } + public void DisplayFlickrPhotosWithTags(String tags) + { + CurrentPhotoList = MyFlickr.getPhotosByTag(tags); + DisplayCurrentPhotos(); + } + public void DisplayFlickrPhotosWithText(String text) + { + CurrentPhotoList = MyFlickr.getPhotosByText(text); + DisplayCurrentPhotos(); + } + public void DisplayFlickrGroupsWithText(String text) + { + CurrentAlbumList = MyFlickr.getGroupsByText(text); + DisplayCurrentAlbums(); + } + public void DisplayFlickrUserPhotos(String user) + { + CurrentPhotoList = MyFlickr.getUserPhotos(user); + DisplayCurrentPhotos(); + } + public void DisplayFlickrUserFavoritePhotos(String user) + { + CurrentPhotoList = MyFlickr.getUserFavoritePhotos(user); + DisplayCurrentPhotos(); + } + public void DisplayPicasaAlbums(String user) + { + CurrentAlbumList = MyPicasa.getUserAlbums(user); + DisplayCurrentAlbums(); + } + private bool GetUserInputString(ref string sString) + { + VirtualKeyboard keyBoard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD); + keyBoard.Reset(); + keyBoard.IsSearchKeyboard = true; + keyBoard.Text = sString; + keyBoard.DoModal(GetID); // show it... + if (keyBoard.IsConfirmed) sString = keyBoard.Text; + return keyBoard.IsConfirmed; + } + public void DisplayCurrentPhotos(){ + DisplayCurrentPhotos(true); + } + public void DisplayCurrentPhotos(bool refresh) + { + facadeView.Clear(); + GUIListItem item; + int i = 0; + List<String> ImageList = new List<string>(); + foreach (MyPhoto photo in CurrentPhotoList) + { + item = new GUIListItem(photo.Title); + item.Path = photo.mediumUrl; + item.ItemId = i; + item.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(item_OnItemSelected); + if(refresh){ + item.RetrieveArt = false; + item.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); + + + ImageList.Add(photo.mediumUrl); + Log.Info("setting photo to url " + photo.mediumUrl); + }else{ + item.RetrieveArt = true; + item.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); + } + facadeView.Add(item); + //GUIWindowManager.Process(); + i++; - DisplayFlickrGroupsWithText(gtext); - _CurrentState = State.categories; + } + if(refresh){ + BackgroundWorker worker = new BackgroundWorker(); - } - break; - } - } - } - public void DisplayInterestingFlickrPhotos() - { - CurrentPhotoList = - MyFlickr.getInterestingPhotos(); - DisplayCurrentPhotos(); - } - public void DisplayRecentFlickrPhotos() - { - CurrentPhotoList = MyFlickr.getRecentPhotos(); - DisplayCurrentPhotos(); - } - public void DisplayFlickrPhotosWithTags(String tags) - { - CurrentPhotoList = MyFlickr.getPhotosByTag(tags); - DisplayCurrentPhotos(); - } - public void DisplayFlickrPhotosWithText(String text) - { - CurrentPhotoList = MyFlickr.getPhotosByText(text); - DisplayCurrentPhotos(); - } - public void DisplayFlickrGroupsWithText(String text) - { - CurrentAlbumList = MyFlickr.getGroupsByText(text); - DisplayCurrentAlbums(); - } - public void DisplayFlickrUserPhotos(String user) - { - CurrentPhotoList = MyFlickr.getUserPhotos(user); - DisplayCurrentPhotos(); - } + worker.DoWork += new DoWorkEventHandler(downloadImages); + worker.RunWorkerAsync(ImageList); - private bool GetUserInputString(ref string sString) - { - VirtualKeyboard keyBoard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD); - keyBoard.Reset(); - keyBoard.IsSearchKeyboard = true; - keyBoard.Text = sString; - keyBoard.DoModal(GetID); // show it... - if (keyBoard.IsConfirmed) sString = keyBoard.Text; - return keyBoard.IsConfirmed; - } - - public void DisplayCurrentPhotos() - { - facadeView.Clear(); - GUIListItem item; - int i = 0; - List<String> ImageList = new List<string>(); - foreach (MyPhoto photo in CurrentPhotoList) - { - item = new GUIListItem(photo.Title); - item.Path = photo.mediumUrl; - item.ItemId = i; - item.RetrieveArt = false; - item.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); - item.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(item_OnItemSelected); - ImageList.Add(photo.mediumUrl); - Log.Info("setting photo to url " + photo.mediumUrl); - facadeView.Add(item); - GUIWindowManager.Process(); - i++; + using (WaitCursor cursor = new WaitCursor()) + { + while (_imagesDone == false) + { + GUIWindowManager.Process(); + } + } + } - } - BackgroundWorker worker = new BackgroundWorker(); + } + public void DisplayCurrentAlbums() + { + facadeView.Clear(); + GUIListItem item; + int i = 0; + List<String> ImageList = new List<string>(); + foreach (MyAlbum album in CurrentAlbumList) + { + item = new GUIListItem(album.Title); + item.Path = album.id; + item.ItemId = i; + //item.IsFolder = true; + item.RetrieveArt = false; + item.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); + item.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(item_OnItemSelected); + ImageList.Add(album.coverThumbnailUrl); + Log.Info("album thumbnail for {0} is {1}",album.Title,album.coverThumbnailUrl); + facadeView.Add(item); + GUIWindowManager.Process(); + i++; - worker.DoWork += new DoWorkEventHandler(downloadImages); - worker.RunWorkerAsync(ImageList); + } + BackgroundWorker worker = new BackgroundWorker(); - using (WaitCursor cursor = new WaitCursor()) - { - while (_imagesDone == false) - { - GUIWindowManager.Process(); - } - } + worker.DoWork += new DoWorkEventHandler(downloadImages); + worker.RunWorkerAsync(ImageList); - } - public void DisplayCurrentAlbums() - { - facadeView.Clear(); - GUIListItem item; - int i = 0; - List<String> ImageList = new List<string>(); - foreach (MyAlbum album in CurrentAlbumList) - { - item = new GUIListItem(album.title); - item.Path = album.id; - item.ItemId = i; - item.RetrieveArt = false; - item.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); - item.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(item_OnItemSelected); - ImageList.Add(album.coverThumbnailUrl); - facadeView.Add(item); - GUIWindowManager.Process(); - i++; + using (WaitCursor cursor = new WaitCursor()) + { + while (_imagesDone == false) + { + GUIWindowManager.Process(); + } + } + } + private void DisplayAlbumPhotos(){ + CurrentPhotoList = MyPicasa.getAlbumPhotos(CurrentAlbum.id); + DisplayCurrentPhotos(); + } + private String GetThumbnail(String lsUrl) + { + string lsThumb = MediaPortal.Util.Utils.GetThumb(lsUrl); + lsThumb = System.IO.Path.GetFileName(lsThumb); + string lsThumbsDir = "C:\\Temp\\"; + if (System.IO.Directory.Exists(lsThumbsDir) == false) + { + System.IO.Directory.CreateDirectory(lsThumbsDir); + } + lsThumb = lsThumbsDir + lsThumb; + //Log.Info(lsThumb); + if (System.IO.File.Exists(lsThumb) == false) + { + String lsFilename = System.IO.Path.GetFileName(lsThumb); + //moLog.Info("Filename will be {0}", lsFilename); + MediaPortal.Util.Utils.DownLoadImage(lsUrl, lsThumb); + } + if (System.IO.File.Exists(lsThumb)) + { + //facadeView[liIdx].IconImageBig = lsThumb; + return lsThumb; + } + else + { + return ""; + //facadeView[liIdx].IconImageBig = ""; + } + } + public void downloadImages(object sender, DoWorkEventArgs e) + { + _imagesDone = false; + _stopImgDownload = false; + List<String> imageList = (List<String>)e.Argument; + WebClient client = new WebClient(); + int i=0; + String imageLocation; + foreach (String url in imageList) + { + if(_stopImgDownload){ + break; + } + if(inPhotoState() ){ + imageLocation = "C:\\Temp\\" + CurrentPhotoList[i].ThumbName + ".jpg"; + }else{ + imageLocation = "C:\\Temp\\" + CurrentAlbumList[i].ThumbName + ".jpg"; + } + if(System.IO.File.Exists(imageLocation) == false){ + client.DownloadFile(url, imageLocation); + } + facadeView[i].RetrieveArt = true; + facadeView[i].RefreshCoverArt(); + i++; + + + } + _imagesDone = true; + } + public bool inPhotoState(){ + return _CurrentState == State.album_photos || _CurrentState == State.photos; + } + void OnRetrieveCoverArt(GUIListItem item) + { + if(inPhotoState() ){ + item.ThumbnailImage = "C:\\Temp\\" + CurrentPhotoList[item.ItemId].ThumbName + ".jpg"; + }else{ + item.ThumbnailImage = "C:\\Temp\\" + CurrentAlbumList[item.ItemId].ThumbName + ".jpg"; + } + } - } - BackgroundWorker worker = new BackgroundWorker(); + private void item_OnItemSelected(GUIListItem item, GUIControl parent) + { + GUIFilmstripControl filmstrip = parent as GUIFilmstripControl; + if (filmstrip == null) + return; + filmstrip.InfoImageFileName = item.ThumbnailImage; + } - worker.DoWork += new DoWorkEventHandler(downloadImages); - worker.RunWorkerAsync(ImageList); + private void ChangeFacadeView() + { + + + switch (currentView) + { + case View.List: + currentView = View.Icons; + facadeView.View = GUIFacadeControl.ViewMode.SmallIcons; + break; + case View.Icons: + currentView = View.LargeIcons; + facadeView.View = GUIFacadeControl.ViewMode.LargeIcons; + break; + case View.LargeIcons: + currentView = View.FilmStrip; + facadeView.View = GUIFacadeControl.ViewMode.Filmstrip; + break; + case View.FilmStrip: + currentView = View.List; + facadeView.View = GUIFacadeControl.ViewMode.List; + break; + } + GUIControl.FocusControl(GetID, facadeView.GetID); - using (WaitCursor cursor = new WaitCursor()) - { - while (_imagesDone == false) - { - GUIWindowManager.Process(); - } - } - } - private String GetThumbnail(String lsUrl) - { - string lsThumb = MediaPortal.Util.Utils.GetThumb(lsUrl); - lsThumb = System.IO.Path.GetFileName(lsThumb); - string lsThumbsDir = "C:\\Temp\\"; - if (System.IO.Directory.Exists(lsThumbsDir) == false) - { - System.IO.Directory.CreateDirectory(lsThumbsDir); - } - lsThumb = lsThumbsDir + lsThumb; - //Log.Info(lsThumb); - if (System.IO.File.Exists(lsThumb) == false) - { - String lsFilename = System.IO.Path.GetFileName(lsThumb); - //moLog.Info("Filename will be {0}", lsFilename); - MediaPortal.Util.Utils.DownLoadImage(lsUrl, lsThumb); - } - if (System.IO.File.Exists(lsThumb)) - { - //facadeView[liIdx].IconImageBig = lsThumb; - return lsThumb; - } - else - { - return ""; - //facadeView[liIdx].IconImageBig = ""; - } - } - public void downloadImages(object sender, DoWorkEventArgs e) - { - _imagesDone = false; - List<String> imageList = (List<String>)e.Argument; - WebClient client = new WebClient(); - int i=0; - foreach (String url in imageList) - { - client.DownloadFile(url, "C:\\Temp\\" + CurrentPhotoList[i].ThumbName + ".jpg"); - facadeView[i].RetrieveArt = true; - facadeView[i].RefreshCoverArt(); - i++; - } - _imagesDone = true; - } - void OnRetrieveCoverArt(GUIListItem item) - { - item.ThumbnailImage = "C:\\Temp\\" + CurrentPhotoList[item.ItemId].ThumbName + ".jpg"; - } + string strLine = String.Empty; + View view = currentView; + switch (view) + { + case View.List: + strLine = GUILocalizeStrings.Get(101); + break; + case View.Icons: + strLine = GUILocalizeStrings.Get(100); + break; + case View.LargeIcons: + strLine = GUILocalizeStrings.Get(417); + break; + case View.FilmStrip: + strLine = GUILocalizeStrings.Get(733); + break; + } + GUIControl.SetControlLabel(GetID, btnViewAs.GetID, strLine); - private void item_OnItemSelected(GUIListItem item, GUIControl parent) - { - GUIFilmstripControl filmstrip = parent as GUIFilmstripControl; - if (filmstrip == null) - return; - filmstrip.InfoImageFileName = item.ThumbnailImage; - } - - private void ChangeFacadeView() - { - - - switch (currentView) - { - case View.List: - currentView = View.Icons; - facadeView.View = GUIFacadeControl.ViewMode.SmallIcons; - break; - case View.Icons: - currentView = View.LargeIcons; - facadeView.View = GUIFacadeControl.ViewMode.LargeIcons; - break; - case View.LargeIcons: - currentView = View.FilmStrip; - facadeView.View = GUIFacadeControl.ViewMode.Filmstrip; - break; - case View.FilmStrip: - currentView = View.List; - facadeView.View = GUIFacadeControl.ViewMode.List; - break; - } - GUIControl.FocusControl(GetID, facadeView.GetID); - - string strLine = String.Empty; - View view = currentView; - switch (view) - { - case View.List: - strLine = GUILocalizeStrings.Get(101); - break; - case View.Icons: - strLine = GUILocalizeStrings.Get(100); - break; - case View.LargeIcons: - strLine = GUILocalizeStrings.Get(417); - break; - case View.FilmStrip: - strLine = GUILocalizeStrings.Get(733); - break; - } - GUIControl.SetControlLabel(GetID, btnViewAs.GetID, strLine); - - } - private void LoadSettings() - { - XmlDocument doc = new XmlDocument(); - try - { - doc.Load("OnlinePhotoSettings.xml"); - /* + } + private void LoadSettings() + { + XmlDocument doc = new XmlDocument(); + try + { + doc.Load("OnlinePhotoSettings.xml"); + /* XmlNode filter = doc.SelectSingleNode("//settings/filter"); String lsFilter = filter.InnerText; msFilterArray = lsFilter.Split(new char[] { ',' }); @@ -575,130 +675,175 @@ } moSiteList.Add(loSite.id, loSite); } - * */ - } + * */ + } - catch (Exception e) - { - //moLog.Error(e); - Log.Error(e); - } - } - private void DisplayHome() - { - //facadeView.Clear(); - GUIControl.ClearControl(GetID, facadeView.GetID); + catch (Exception e) + { + //moLog.Error(e); + Log.Error(e); + } + } + private void DisplayHome() + { + //facadeView.Clear(); + GUIControl.ClearControl(GetID, facadeView.GetID); - GUIListItem loListItem; - //foreach (Site loSite in moSiteList.Values) - //{ - loListItem = new GUIListItem("Flickr - Interesting Photos"); - loListItem.Path = "1"; - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - facadeView.Add(loListItem); - - loListItem = new GUIListItem("Flickr - Recent Photos"); - loListItem.Path = "2"; - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - facadeView.Add(loListItem); + GUIListItem loListItem; + //foreach (Site loSite in moSiteList.Values) + //{ + loListItem = new GUIListItem("Flickr - Interesting Photos"); + loListItem.Path = "1"; + loListItem.IsFolder = true; + MediaPortal.Util.Utils.SetDefaultIcons(loListItem); + facadeView.Add(loListItem); + + loListItem = new GUIListItem("Flickr - Recent Photos"); + loListItem.Path = "2"; + loListItem.IsFolder = true; + MediaPortal.Util.Utils.SetDefaultIcons(loListItem); + facadeView.Add(loListItem); - loListItem = new GUIListItem("Flickr - Search by tag"); - loListItem.Path = "3"; - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - facadeView.Add(loListItem); - - loListItem = new GUIListItem("Flickr - Search by text"); - loListItem.Path = "4"; - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - facadeView.Add(loListItem); + loListItem = new GUIListItem("Flickr - Search by tag"); + loListItem.Path = "3"; + loListItem.IsFolder = true; + MediaPortal.Util.Utils.SetDefaultIcons(loListItem); + facadeView.Add(loListItem); + + loListItem = new GUIListItem("Flickr - Search by text"); + loListItem.Path = "4"; + loListItem.IsFolder = true; + MediaPortal.Util.Utils.SetDefaultIcons(loListItem); + facadeView.Add(loListItem); - loListItem = new GUIListItem("Flickr - My Photos"); - loListItem.Path = "5"; - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - facadeView.Add(loListItem); + loListItem = new GUIListItem("Flickr - My Photos"); + loListItem.Path = "5"; + loListItem.IsFolder = true; + MediaPortal.Util.Utils.SetDefaultIcons(loListItem); + facadeView.Add(loListItem); - loListItem = new GUIListItem("Flickr - Search Groups"); - loListItem.Path = "6"; - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - facadeView.Add(loListItem); - //} - //GUIPropertyManager.SetProperty("#itemcount", facadeView.Count-1 + ""); - } - private void LoadFlickrCategories() - { - GUIControl.ClearControl(GetID, facadeView.GetID); + loListItem = new GUIListItem("Flickr - My Favorites"); + loListItem.Path = "7"; + loListItem.IsFolder = true; + MediaPortal.Util.Utils.SetDefaultIcons(loListItem); + facadeView.Add(loListItem); + + loListItem = new GUIListItem("Flickr - Search Groups"); + loListItem.Path = "6"; + loListItem.IsFolder = true; + MediaPortal.Util.Utils.SetDefaultIcons(loListItem); + facadeView.Add(loListItem); + + loListItem = new GUIListItem("Picasa - My Photos"); + loListItem.Path = "8"; + loListItem.IsFolder = true; + MediaPortal.Util.Utils.SetDefaultIcons(loListItem); + facadeView.Add(loListItem); + + //} + //GUIPropertyManager.SetProperty("#itemcount", facadeView.Count-1 + ""); + } + private void LoadFlickrCategories() + { + GUIControl.ClearControl(GetID, facadeView.GetID); - GUIListItem loListItem; - loListItem = new GUIListItem(".."); - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - facadeView.Add(loListItem); + GUIListItem loListItem; + loListItem = new GUIListItem(".."); + loListItem.IsFolder = true; + MediaPortal.Util.Utils.SetDefaultIcons(loListItem); + facadeView.Add(loListItem); - loListItem = new GUIListItem("Interesting Photos"); - loListItem.Path = "1"; - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - facadeView.Add(loListItem); + loListItem = new GUIListItem("Interesting Photos"); + loListItem.Path = "1"; + loListItem.IsFolder = true; + MediaPortal.Util.Utils.SetDefaultIcons(loListItem); + facadeView.Add(loListItem); - loListItem = new GUIListItem("Recent Photos"); - loListItem.Path = "2"; - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - facadeView.Add(loListItem); + loListItem = new GUIListItem("Recent Photos"); + loListItem.Path = "2"; + loListItem.IsFolder = true; + MediaPortal.Util.Utils.SetDefaultIcons(loListItem); + facadeView.Add(loListItem); - loListItem = new GUIListItem("My Photos"); - loListItem.Path = "3"; - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - facadeView.Add(loListItem); + loListItem = new GUIListItem("My Photos"); + loListItem.Path = "3"; + loListItem.IsFolder = true; + MediaPortal.Util.Utils.SetDefaultIcons(loListItem); + facadeView.Add(loListItem); - } - void OnSlideShow() - { - OnSlideShow(0); - } - - void OnSlideShow(int iStartItem) - { + } + void OnSlideShow() + { + OnSlideShow(0); + } + + void OnSlideShow(int iStartItem) + { - GUISlideShow SlideShow = (GUISlideShow)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW); - if (SlideShow == null) - return; + GUISlideShow SlideShow = (GUISlideShow)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW); + if (SlideShow == null) + return; - SlideShow.Reset(); + SlideShow.Reset(); - if ((iStartItem < 0) || (iStartItem > CurrentPhotoList.Count)) - iStartItem = 0; - int i = iStartItem; - do - { - GUIListItem item = facadeView[i]; - if (!item.IsFolder && !item.IsRemote) - { - SlideShow.Add(facadeView[i].ThumbnailImage); - } + if ((iStartItem < 0) || (iStartItem > CurrentPhotoList.Count)) + iStartItem = 0; + int i = iStartItem; + do + { + GUIListItem item = facadeView[i]; + if (!item.IsFolder && !item.IsRemote) + { + SlideShow.Add(facadeView[i].ThumbnailImage); + } - i++; - if (i >= CurrentPhotoList.Count) - { - i = 0; - } - } - while (i != iStartItem); + i++; + if (i >= CurrentPhotoList.Count) + { + i = 0; + } + } + while (i != iStartItem); - if (SlideShow.Count > 0) - { - SlideShow.StartSlideShow(); - GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW); - } - } - } -} \ No newline at end of file + if (SlideShow.Count > 0) + { + SlideShow.StartSlideShow(); + GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW); + } + } + void OnShowPicture(string strFile) + { + GUISlideShow SlideShow = (GUISlideShow)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW); + if (SlideShow == null) + return; + + + SlideShow.Reset(); + SlideShow.Add(strFile); + + GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW); + // SlideShow.Select(strFile); + + } + public void TestSlideShow(String user){ + List<MyPhoto> photoList = MyFlickr.getInterestingPhotos(); + GUISlideShow SlideShow = (GUISlideShow)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW); + if (SlideShow == null) + return; + + SlideShow.Reset(); + + foreach(MyPhoto photo in photoList){ + SlideShow.Add(photo.mediumUrl); + } + + if (SlideShow.Count > 0) + { + SlideShow.StartSlideShow(); + GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW); + } + } + } +} Modified: trunk/plugins/OnlinePhotos/OnlinePhotos.csproj =================================================================== --- trunk/plugins/OnlinePhotos/OnlinePhotos.csproj 2007-05-03 08:25:35 UTC (rev 370) +++ trunk/plugins/OnlinePhotos/OnlinePhotos.csproj 2007-05-04 00:46:15 UTC (rev 371) @@ -6,13 +6,18 @@ <OutputType>Library</OutputType> <RootNamespace>OnlinePhotos</RootNamespace> <AssemblyName>OnlinePhotos</AssemblyName> + <AllowUnsafeBlocks>False</AllowUnsafeBlocks> + <NoStdLib>False</NoStdLib> + <WarningLevel>4</WarningLevel> + <TreatWarningsAsErrors>false</TreatWarningsAsErrors> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> - <OutputPath>bin\Debug\</OutputPath> - <DebugSymbols>True</DebugSymbols> + <OutputPath>..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Plugins\Windows\</OutputPath> + <DebugSymbols>true</DebugSymbols> <DebugType>Full</DebugType> <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> <DefineConstants>DEBUG;TRACE</DefineConstants> + <Optimize>False</Optimize> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> <OutputPath>..\..\..\Program Files\Team MediaPortal\MediaPortal\Plugins\Windows\</OutputPath> @@ -21,6 +26,13 @@ <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> <DefineConstants>TRACE</DefineConstants> </PropertyGroup> + <PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' "> + <RegisterForComInterop>False</RegisterForComInterop> + <GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> + <BaseAddress>4194304</BaseAddress> + <PlatformTarget>AnyCPU</PlatformTarget> + <FileAlignment>4096</FileAlignment> + </PropertyGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> <ItemGroup> <Reference Include="Core"> @@ -29,7 +41,7 @@ <Private>False</Private> </Reference> <Reference Include="Databases"> - <HintPath>..\..\MediaPortal\Databases\bin\Release\Databases.DLL</HintPath> + <HintPath>..\..\Mediaportal\Databases\bin\Release\Databases.DLL</HintPath> <SpecificVersion>False</SpecificVersion> <Private>False</Private> </Reference> @@ -59,5 +71,12 @@ <Compile Include="AssemblyInfo.cs" /> <Compile Include="Flickr.cs" /> <Compile Include="MyClass.cs" /> + <Compile Include="Picasa.cs" /> </ItemGroup> + <ItemGroup> + <ProjectReference Include="google-sharp\PicasaNet.csproj"> + <Project>{7B1FD153-0301-41F0-87EA-FB862148D6C9}</Project> + <Name>PicasaNet</Name> + </ProjectReference> + </ItemGroup> </Project> \ No newline at end of file Modified: trunk/plugins/OnlinePhotos/OnlinePhotos.sln =================================================================== --- trunk/plugins/OnlinePhotos/OnlinePhotos.sln 2007-05-03 08:25:35 UTC (rev 370) +++ trunk/plugins/OnlinePhotos/OnlinePhotos.sln 2007-05-04 00:46:15 UTC (rev 371) @@ -6,6 +6,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestRunner", "..\TestRunner\TestRunner.csproj", "{1EE2BACD-3C01-495E-A06E-F739D649A1ED}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PicasaNet", "google-sharp\PicasaNet.csproj", "{7B1FD153-0301-41F0-87EA-FB862148D6C9}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -20,5 +22,17 @@ {1EE2BACD-3C01-495E-A06E-F739D649A1ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1EE2BACD-3C01-495E-A06E-F739D649A1ED}.Release|Any CPU.Build.0 = Release|Any CPU {1EE2BACD-3C01-495E-A06E-F739D649A1ED}.Release|Any CPU.ActiveCfg = Release|Any CPU + E4238A46-225D-4827-A429-849098A94F8A.Debug|Any CPU.Build.0 = Debug|Any CPU + E4238A46-225D-4827-A429-849098A94F8A.Debug|Any CPU.ActiveCfg = Debug|Any CPU + E4238A46-225D-4827-A429-849098A94F8A.Release|Any CPU.Build.0 = Release|Any CPU + E4238A46-225D-4827-A429-849098A94F8A.Release|Any CPU.ActiveCfg = Release|Any CPU + 83DEF1F5-4D7D-40CB-A997-D390B372FF71.Debug|Any CPU.Build.0 = Debug|Any CPU + 83DEF1F5-4D7D-40CB-A997-D390B372FF71.Debug|Any CPU.ActiveCfg = Debug|Any CPU + 83DEF1F5-4D7D-40CB-A997-D390B372FF71.Release|Any CPU.Build.0 = Release|Any CPU + 83DEF1F5-4D7D-40CB-A997-D390B372FF71.Release|Any CPU.ActiveCfg = Release|Any CPU + {7B1FD153-0301-41F0-87EA-FB862148D6C9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7B1FD153-0301-41F0-87EA-FB862148D6C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7B1FD153-0301-41F0-87EA-FB862148D6C9}.Release|Any CPU.Build.0 = Release|Any CPU + {7B1FD153-0301-41F0-87EA-FB862148D6C9}.Release|Any CPU.ActiveCfg = Release|Any CPU EndGlobalSection EndGlobal Modified: trunk/plugins/OnlinePhotos/OnlinePhotos.suo =================================================================== (Binary files differ) Added: trunk/plugins/OnlinePhotos/Picasa.cs =================================================================== --- trunk/plugins/OnlinePhotos/Picasa.cs (rev 0) +++ trunk/plugins/OnlinePhotos/Picasa.cs 2007-05-04 00:46:15 UTC (rev 371) @@ -0,0 +1,75 @@ +/* + * Created by SharpDevelop. + * User: GZamor1 + * Date: 5/3/2007 + * Time: 2:11 PM + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ + +using System; +using Mono.Google; +using Mono.Google.Picasa; +using System.Collections.Generic; +namespace OnlinePhotos +{ + /// <summary> + /// Description of Picasa. + /// </summary> + public class MyPicasa + { + private static PicasaAlbumCollection _albumCollection; + + public static List<MyAlbum> getUserAlbums(String user){ + List<MyAlbum> MyAlbumList = new List<MyAlbum>(); + GoogleConnection conn = new GoogleConnection (GoogleService.Picasa); + //conn.Authenticate("gregandsamira","53025302"); + PicasaWeb picasa = new PicasaWeb(conn,user); + _albumCollection = picasa.GetAlbums(); + foreach(PicasaAlbum album in _albumCollection.AllValues){ + MyAlbumList.Add(loadPhotoAlbum(album)); + } + return MyAlbumList; + } + public static List<MyPhoto> getAlbumPhotos(String id){ + List<MyPhoto> photoList = new List<MyPhoto>(); + if(_albumCollection==null){ + return photoList; + } + return loadMyPhotoList(_albumCollection[id].GetPictures()); + } + private static MyAlbum loadPhotoAlbum(PicasaAlbum picasaAlbum) + { + MyAlbum myAlbum = new MyAlbum(); + myAlbum.id = picasaAlbum.UniqueID; + myAlbum.Title = picasaAlbum.Title; + myAlbum.coverThumbnailUrl = picasaAlbum.Thumbnail; + //myAlbum.photoCollection = loadMyPhotoList(picasaAlbum.GetPictures()); + return myAlbum; + + } + private static List<MyPhoto> loadMyPhotoList(PicasaPictureCollection photos) + { + List<MyPhoto> myPhotoList = new List<MyPhoto>(); + if(photos == null || photos.Count ==0){ + return myPhotoList; + } + MyPhoto myPhoto; + foreach (PicasaPicture photo in photos.AllValues) + { + myPhoto = new MyPhoto(); + myPhoto.id = photo.UniqueID; + myPhoto.Title = photo.Title; + myPhoto.largeUrl = photo.ImageURL; + myPhoto.mediumUrl = photo.ImageURL; + myPhoto.smallUrl = photo.ImageURL; + myPhoto.thumbnailUrl = photo.ThumbnailURL; + myPhotoList.Add(myPhoto); + //photo.; + } + + return myPhotoList; + + } + } +} Added: trunk/plugins/OnlinePhotos/google-sharp/AssemblyInfo.cs =================================================================== --- trunk/plugins/OnlinePhotos/google-sharp/AssemblyInfo.cs (rev 0) +++ trunk/plugins/OnlinePhotos/google-sharp/AssemblyInfo.cs 2007-05-04 00:46:15 UTC (rev 371) @@ -0,0 +1,31 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Information about this assembly is defined by the following +// attributes. +// +// change them to the information which is associated with the assembly +// you compile. + +[assembly: AssemblyTitle("PicasaNet")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("PicasaNet")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// This sets the default COM visibility of types in the assembly to invisible. +// If you need to expose a type to COM, use [ComVisible(true)] on that type. +[assembly: ComVisible(false)] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all values by your own or you can build default build and revision +// numbers with the '*' character (the default): + +[assembly: AssemblyVersion("1.0.*")] Added: trunk/plugins/OnlinePhotos/google-sharp/Mono.Google/Authentication.cs =================================================================== --- trunk/plugins/OnlinePhotos/google-sharp/Mono.Google/Authentication.cs (rev 0) +++ trunk/plugins/OnlinePhotos/google-sharp/Mono.Google/Authentication.cs 2007-05-04 00:46:15 UTC (rev 371) @@ -0,0 +1,158 @@ +// +// Mono.Google.Authentication.cs: +// +// Authors: +// Gonzalo Paniagua Javier (go...@xi...) +// Stephane Delcroix (ste...@de...) +// +// (C) Copyright 2006 Novell, Inc. (http://www.novell.com) +// (C) Copyright 2007 S. Delcroix +// + +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// Check the Google Authentication Page at http://code.google.com/apis/accounts/AuthForInstalledApps.html +// + +using System; +using System.IO; +using System.Net; +using System.Text; +using System.Web; + +namespace Mono.Google { + class Authentication { + static string client_login_url = "https://www.google.com/accounts/ClientLogin"; + + public static string GetAuthorization (GoogleConnection conn, string email, string password, + GoogleService service, string token, string captcha) + { + if (email == null || email == String.Empty || password == null || password == String.Empty) + return null; + + email = HttpUtility.UrlEncode (email); + password = HttpUtility.UrlEncode (password); + string appname = HttpUtility.UrlEncode (conn.ApplicationName); + string service_code = service.ServiceCode; + + StringBuilder content = new StringBuilder (); + content.Append ("accountType=HOSTED_OR_GOOGLE"); + content.AppendFormat ("&Email={0}", email); + content.AppendFormat ("&Passwd={0}", password); + content.AppendFormat ("&email={0}", email); + content.AppendFormat ("&service={0}", service_code); + content.AppendFormat ("&source={0}", appname); + + if (token != null) { + content.AppendFormat ("&logintoken={0}", token); + content.AppendFormat ("&logincaptcha={0}", captcha); + } + byte [] bytes = Encoding.UTF8.GetBytes (content.ToString ()); + + HttpWebRequest request = (HttpWebRequest) WebRequest.Create (client_login_url); + request.Method = "POST"; + request.ContentType = "application/x-www-form-urlencoded"; + request.ContentLength = bytes.Length; + + Stream output = request.GetRequestStream (); + output.Write (bytes, 0, bytes.Length); + output.Close (); + + HttpWebResponse response = null; + try { + response = (HttpWebResponse) request.GetResponse (); + } catch (WebException wexc) { + response = wexc.Response as HttpWebResponse; + if (response == null) + throw; + ThrowOnError (response); + throw; // if the method above does not throw, we do + } + + //string sid = null; + //string lsid = null; + string auth = null; + + using (Stream stream = response.GetResponseStream ()) { + StreamReader sr = new StreamReader (stream, Encoding.UTF8); + string s; + while ((s = sr.ReadLine ()) != null) { + if (s.StartsWith ("Auth=")) + auth = s.Substring (5); + //else if (s.StartsWith ("LSID=")) + // lsid = s.Substring (5); + //else if (s.StartsWith ("SID=")) + // sid = s.Substring (4); + } + } + response.Close (); + + return auth; + } + + static void ThrowOnError (HttpWebResponse response) + { + if (response.StatusCode != HttpStatusCode.Forbidden) + return; + + string url = null; + string token = null; + string captcha_url = null; + string code = null; + using (StreamReader reader = new StreamReader (response.GetResponseStream ())) { + string str; + while ((str = reader.ReadLine ()) != null) { + if (str.StartsWith ("Url=")) { + url = str.Substring (4); + } else if (str.StartsWith ("Error=")) { + /* These are the values for Error + None, + BadAuthentication, + NotVerified, + TermsNotAgreed, + CaptchaRequired, + Unknown, + AccountDeleted, + AccountDisabled, + ServiceUnavailable + */ + code = str.Substring (6); + } else if (str.StartsWith ("CaptchaToken=")) { + token = str.Substring (13); + } else if (str.StartsWith ("CaptchaUrl=")) { + captcha_url = str.Substring (11); + } + } + } + if (code == "CaptchaRequired" && token != null && captcha_url != null) { + if (url != null) { + Uri uri = new Uri (url); + captcha_url = new Uri (uri, captcha_url).ToString (); + } else if (!captcha_url.StartsWith ("https://")) { + captcha_url = "https://www.google.com/accounts/" + captcha_url; + } + throw new CaptchaException (url, token, captcha_url); + } + + throw new UnauthorizedAccessException (String.Format ("Access to '{0}' is denied ({1})", url, code)); + } + } +} + Added: trunk/plugins/OnlinePhotos/google-sharp/Mono.Google/CaptchaException.cs =================================================================== --- trunk/plugins/OnlinePhotos/google-sharp/Mono.Google/CaptchaException.cs (rev 0) +++ trunk/plugins/OnlinePhotos/google-sharp/Mono.Google/CaptchaException.cs 2007-05-04 00:46:15 UTC (rev 371) @@ -0,0 +1,87 @@ +// +// Mono.Google.CaptchaException +// +// Authors: +// Gonzalo Paniagua Javier (go...@no...) +// +// Copyright (c) 2006 Novell, Inc. (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Runtime.Serialization; + +namespace Mono.Google { + [Serializable] + public class CaptchaException : UnauthorizedAccessException, ISerializable + { + public static string UnlockCaptchaURL = "https://www.google.com/accounts/DisplayUnlockCaptcha"; + string url; + string token; + string captcha_url; + + public CaptchaException () + { + } + + public CaptchaException (string url, string token, string captcha_url) + {... [truncated message content] |
From: <gre...@us...> - 2007-05-05 00:39:14
|
Revision: 377 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=377&view=rev Author: gregmac45 Date: 2007-05-04 17:39:12 -0700 (Fri, 04 May 2007) Log Message: ----------- Modified Paths: -------------- trunk/plugins/OnlinePhotos/MyClass.cs trunk/plugins/OnlinePhotos/OnlinePhotos.csproj trunk/plugins/OnlinePhotos/OnlinePhotos.suo trunk/plugins/OnlinePhotos/myonlinephotos.xml Modified: trunk/plugins/OnlinePhotos/MyClass.cs =================================================================== --- trunk/plugins/OnlinePhotos/MyClass.cs 2007-05-04 17:23:57 UTC (rev 376) +++ trunk/plugins/OnlinePhotos/MyClass.cs 2007-05-05 00:39:12 UTC (rev 377) @@ -9,14 +9,18 @@ using System; using MediaPortal; using MediaPortal.Util; +using MediaPortal.Utils; using MediaPortal.GUI.Library; using MediaPortal.Dialogs; using MediaPortal.GUI.Pictures; using System.Collections.Generic; +using System.Collections.Specialized; using System.Xml; using System.Net; using System.Web; using System.IO; +using System.Drawing; +using System.Drawing.Imaging; using System.ComponentModel; namespace OnlinePhotos @@ -36,6 +40,7 @@ } } + public String id; public String thumbnailUrl; public String largeUrl; @@ -87,10 +92,37 @@ { [SkinControlAttribute(2)] protected GUIButtonControl btnViewAs = null; - [SkinControlAttribute(3)] + [SkinControlAttribute(3)] + protected GUIButtonControl btnFlickr = null; + [SkinControlAttribute(31)] + protected GUIButtonControl btnFlickrPhotos = null; + [SkinControlAttribute(32)] + protected GUIButtonControl btnFlickrSets = null; + [SkinControlAttribute(33)] + protected GUIButtonControl btnFlickrFav = null; + [SkinControlAttribute(34)] + protected GUIButtonControl btnInterest = null; + [SkinControlAttribute(35)] + protected GUIButtonControl btnRecent = null; + [SkinControlAttribute(36)] + protected GUIButtonControl btnSearchTag = null; + [SkinControlAttribute(37)] + protected GUIButtonControl btnSearchTxt = null; + [SkinControlAttribute(38)] + protected GUIButtonControl btnSearchGrp = null; + [SkinControlAttribute(4)] + protected GUIButtonControl btnPicasa = null; + [SkinControlAttribute(41)] + protected GUIButtonControl btnPicasaPhotos = null; + [SkinControlAttribute(5)] protected GUIButtonControl btnSlide = null; + [SkinControlAttribute(6)] + protected GUIButtonControl btnClearCache = null; + [SkinControlAttribute(7)] + protected GUIButtonControl btnSettings = null; [SkinControlAttribute(50)] protected GUIFacadeControl facadeView = null; + GUISlideShow _SlideShow; private State _CurrentState = State.home; protected View currentView = View.List; protected List<MyPhoto> CurrentPhotoList; @@ -98,12 +130,18 @@ protected MyAlbum CurrentAlbum; protected bool _imagesDone = true; protected bool _stopImgDownload = false; + protected bool _onSlideShow = false; + protected string _imageDirectory = @"C:\Temp\"; + protected NameValueCollection _photosToDownload; + protected NameValueCollection _AlbumCoversToDownload; public enum State { home = 0, albums = 1, photos = 2, - album_photos = 3 + album_photos = 3, + //showpicture=4, + //slideshow=5 } public enum View { @@ -112,75 +150,48 @@ LargeIcons = 2, FilmStrip = 3 } - public string PluginName() { return "Online Photos"; - } - - // Returns the description of the plugin is shown in the plugin menu - + } public string Description() { return "Flickr and Google Photo Plugin"; } - - // Returns the author of the plugin which is shown in the plugin menu - public string Author() { return "GregMac45"; - } - - // show the setup dialog - + } public void ShowPlugin() { //MessageBox.Show("Nothing to configure, this is just an example"); } - - // Indicates whether plugin can be enabled/disabled - public bool CanEnable() { return true; - } - - // get ID of windowplugin belonging to this setup - public int GetWindowId() { return GetID; } - - // Indicates if plugin is enabled by default; - public bool DefaultEnabled() { - return true; - } - - // indicates if a plugin has its own setup screen - public bool HasSetup() { - return false; - } public override int GetID { @@ -192,7 +203,6 @@ { } } - public override bool Init() { LoadSettings(); @@ -217,6 +227,7 @@ } protected override void OnPageLoad() { + Log.Info("in OnPageLoad"); if (_CurrentState == State.home) { //_log.Info("onPageLoad state home"); @@ -224,43 +235,68 @@ DisplayHome(); //DisplaySites(); } - else if (_CurrentState == State.photos) + else if (_CurrentState == State.photos || _CurrentState == State.album_photos) { + Log.Info("OnPageLoad with state ={0} calling DisplayCurrentPhotos with false",_CurrentState); DisplayCurrentPhotos(false); } + currentView = View.Icons; ChangeFacadeView(); + _onSlideShow = false; + if (_imagesDone == false) + { + Log.Info("OnPageLoad with state ={0} and imageDone = false calling GetImages(_photosToDownload)",_CurrentState); + if (_CurrentState == State.album_photos || _CurrentState == State.photos) + { + getImages(_photosToDownload); + } + } - base.OnPageLoad(); } + public override bool OnMessage(GUIMessage message) + { + return base.OnMessage(message); + } public override void OnAction(Action action) { + if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU) { + Log.Info("in Action previous menu"); if (_CurrentState == State.album_photos) { + _CurrentState = State.albums; + Log.Info(" AP - Sending request to stop img download"); + _stopImgDownload = true; + System.Threading.Thread.Sleep(25); DisplayCurrentAlbums(); - _CurrentState = State.albums; + + return; } else if (_CurrentState == State.albums || _CurrentState == State.photos) { + _CurrentState = State.home; + Log.Info(" P - Sending request to stop img download"); + _stopImgDownload = true; + System.Threading.Thread.Sleep(25); DisplayHome(); - _CurrentState = State.home; + return; } - _stopImgDownload = true; + + } base.OnAction(action); - } + } protected override void OnPageDestroy(int new_windowId) { base.OnPageDestroy(new_windowId); - } - + } protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType) { if (control == btnViewAs) @@ -270,10 +306,13 @@ else if (control == btnSlide) { OnSlideShow(); - } + }else if(control == btnClearCache){ + ClearCache(); + } else if (control == facadeView && _CurrentState == State.home) { String SelectedSiteId = facadeView.SelectedListItem.Path; + String userInput = "" ; switch (SelectedSiteId) { case "1": @@ -285,21 +324,19 @@ _CurrentState = State.photos; break; case "3": - string q = ""; - if (GetUserInputString(ref q)) + + if (GetUserInputString(ref userInput)) { - DisplayFlickrPhotosWithTags(q); + DisplayFlickrPhotosWithTags(userInput); _CurrentState = State.photos; } break; - case "4": - string text = ""; - if (GetUserInputString(ref text)) + case "4": + if (GetUserInputString(ref userInput)) { - - DisplayFlickrPhotosWithText(text); + DisplayFlickrPhotosWithText(userInput); _CurrentState = State.photos; } @@ -310,11 +347,10 @@ break; - case "6": - string gtext = ""; - if (GetUserInputString(ref gtext)) + case "6": + if (GetUserInputString(ref userInput)) { - DisplayFlickrGroupsWithText(gtext); + DisplayFlickrGroupsWithText(userInput); _CurrentState = State.photos; } break; @@ -338,7 +374,7 @@ } else if (control == facadeView && (_CurrentState == State.photos || _CurrentState== State.album_photos)) { - OnShowPicture(facadeView.SelectedListItem.ThumbnailImage); + OnShowPicture(facadeView.SelectedListItem.Path); } } public void DisplayInterestingFlickrPhotos() @@ -400,7 +436,7 @@ facadeView.Clear(); GUIListItem item; int i = 0; - List<String> ImageList = new List<string>(); + _photosToDownload = new NameValueCollection(); foreach (MyPhoto photo in CurrentPhotoList) { item = new GUIListItem(photo.Title); @@ -412,8 +448,8 @@ item.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); - ImageList.Add(photo.mediumUrl); - Log.Info("setting photo to url " + photo.mediumUrl); + _photosToDownload.Add(photo.ThumbName,photo.mediumUrl); + //Log.Info("setting photo to url " + photo.mediumUrl); }else{ item.RetrieveArt = true; item.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); @@ -424,18 +460,7 @@ } if(refresh){ - BackgroundWorker worker = new BackgroundWorker(); - - worker.DoWork += new DoWorkEventHandler(downloadImages); - worker.RunWorkerAsync(ImageList); - - using (WaitCursor cursor = new WaitCursor()) - { - while (_imagesDone == false) - { - GUIWindowManager.Process(); - } - } + getImages(_photosToDownload); } } @@ -444,7 +469,7 @@ facadeView.Clear(); GUIListItem item; int i = 0; - List<String> ImageList = new List<string>(); + _AlbumCoversToDownload = new NameValueCollection(); foreach (MyAlbum album in CurrentAlbumList) { item = new GUIListItem(album.Title); @@ -454,30 +479,20 @@ item.RetrieveArt = false; item.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); item.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(item_OnItemSelected); - ImageList.Add(album.coverThumbnailUrl); + _AlbumCoversToDownload.Add(album.ThumbName,album.coverThumbnailUrl); Log.Info("album thumbnail for {0} is {1}",album.Title,album.coverThumbnailUrl); facadeView.Add(item); GUIWindowManager.Process(); i++; } - BackgroundWorker worker = new BackgroundWorker(); - - worker.DoWork += new DoWorkEventHandler(downloadImages); - worker.RunWorkerAsync(ImageList); - - using (WaitCursor cursor = new WaitCursor()) - { - while (_imagesDone == false) - { - GUIWindowManager.Process(); - } - } + getImages(_AlbumCoversToDownload); } private void DisplayAlbumPhotos(){ CurrentPhotoList = MyPicasa.getAlbumPhotos(CurrentAlbum.id); DisplayCurrentPhotos(); } + /* private String GetThumbnail(String lsUrl) { string lsThumb = MediaPortal.Util.Utils.GetThumb(lsUrl); @@ -506,33 +521,73 @@ //facadeView[liIdx].IconImageBig = ""; } } + */ + protected void getImages(NameValueCollection imageList){ + Log.Info("Getting images"); + BackgroundWorker worker = new BackgroundWorker(); + + worker.DoWork += new DoWorkEventHandler(downloadImages); + worker.RunWorkerAsync(imageList); + + using (WaitCursor cursor = new WaitCursor()) + { + while (_imagesDone == false) + { + GUIWindowManager.Process(); + } + } + } public void downloadImages(object sender, DoWorkEventArgs e) { + Log.Info("Downloading images"); _imagesDone = false; _stopImgDownload = false; - List<String> imageList = (List<String>)e.Argument; + //List<String> imageList = (List<String>)e.Argument; + NameValueCollection imgNameUrlList= (NameValueCollection) e.Argument; WebClient client = new WebClient(); - int i=0; - String imageLocation; - foreach (String url in imageList) + + string imageLocation; + string thumbnailLocation; + string url; + string name; + for(int i=0;i<imgNameUrlList.Count;i++) { + url = imgNameUrlList.Get(i); + name = imgNameUrlList.GetKey(i); + if(_stopImgDownload){ + Log.Info("Received Request to stop Download"); break; } + Log.Info("downloading image :"+url); + /* if(inPhotoState() ){ imageLocation = "C:\\Temp\\" + CurrentPhotoList[i].ThumbName + ".jpg"; }else{ imageLocation = "C:\\Temp\\" + CurrentAlbumList[i].ThumbName + ".jpg"; } + */ + imageLocation = "C:\\Temp\\" + name+ "L.jpg"; + thumbnailLocation = "C:\\Temp\\" + name+ ".jpg"; if(System.IO.File.Exists(imageLocation) == false){ client.DownloadFile(url, imageLocation); + if(System.IO.File.Exists(thumbnailLocation) == false){ + //int iRotate = dbs.GetRotation(imageLocation); + MediaPortal.Util.Picture.CreateThumbnail(imageLocation, thumbnailLocation, (int)Thumbs.ThumbResolution, (int)Thumbs.ThumbResolution, 0); + System.Threading.Thread.Sleep(25); + } + if(_onSlideShow){ + _SlideShow.Add(imageLocation); + } } + facadeView[i].Path = imageLocation; facadeView[i].RetrieveArt = true; facadeView[i].RefreshCoverArt(); - i++; + //i++; } + Log.Info("Setting imagesDone to true"); _imagesDone = true; } public bool inPhotoState(){ @@ -541,20 +596,18 @@ void OnRetrieveCoverArt(GUIListItem item) { if(inPhotoState() ){ - item.ThumbnailImage = "C:\\Temp\\" + CurrentPhotoList[item.ItemId].ThumbName + ".jpg"; + item.ThumbnailImage = "C:\\Temp\\" + CurrentPhotoList[item.ItemId].ThumbName + ".jpg"; }else{ - item.ThumbnailImage = "C:\\Temp\\" + CurrentAlbumList[item.ItemId].ThumbName + ".jpg"; + item.ThumbnailImage = "C:\\Temp\\" + CurrentAlbumList[item.ItemId].ThumbName + ".jpg"; } } - private void item_OnItemSelected(GUIListItem item, GUIControl parent) { GUIFilmstripControl filmstrip = parent as GUIFilmstripControl; if (filmstrip == null) return; - filmstrip.InfoImageFileName = item.ThumbnailImage; + filmstrip.InfoImageFileName = item.Path; } - private void ChangeFacadeView() { @@ -688,7 +741,12 @@ { //facadeView.Clear(); GUIControl.ClearControl(GetID, facadeView.GetID); - + hideAllButtons(); + btnClearCache.Visible = true; + btnFlickr.Visible = true; + btnPicasa.Visible = true; + btnSettings.Visible = true; + /* GUIListItem loListItem; //foreach (Site loSite in moSiteList.Values) //{ @@ -740,10 +798,30 @@ loListItem.IsFolder = true; MediaPortal.Util.Utils.SetDefaultIcons(loListItem); facadeView.Add(loListItem); - + */ + //} //GUIPropertyManager.SetProperty("#itemcount", facadeView.Count-1 + ""); } + protected void hideAllButtons() { + btnClearCache.Visible = false; + btnFlickr.Visible = false; + btnFlickrFav.Visible = false; + btnFlickrPhotos.Visible = false; + btnFlickrSets.Visible = false; + btnInterest.Visible = false; + btnPicasa.Visible = false; + btnPicasaPhotos.Visible = false; + btnRecent.Visible = false; + btnSearchGrp.Visible = false; + btnSearchTag.Visible = false; + btnSearchTxt.Visible = false; + btnSettings.Visible = false; + btnSlide.Visible = false; + btnViewAs.Visible = false; + + } + /* private void LoadFlickrCategories() { GUIControl.ClearControl(GetID, facadeView.GetID); @@ -774,19 +852,29 @@ } + * */ void OnSlideShow() { OnSlideShow(0); - } - + } void OnSlideShow(int iStartItem) { - - GUISlideShow SlideShow = (GUISlideShow)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW); - if (SlideShow == null) + bool doSlide = true; + if(_imagesDone==false){ + GUIDialogYesNo notify = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO); + notify.SetLine(1,"Photos are still downloading."); + notify.SetLine(2,"Select Yes to slide the downloaded photos."); + notify.DoModal(GetID); + doSlide = notify.IsConfirmed; + } + if(doSlide == false){ return; + } + _SlideShow = (GUISlideShow)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW); + if (_SlideShow == null) + return; - SlideShow.Reset(); + _SlideShow.Reset(); if ((iStartItem < 0) || (iStartItem > CurrentPhotoList.Count)) iStartItem = 0; @@ -794,9 +882,9 @@ do { GUIListItem item = facadeView[i]; - if (!item.IsFolder && !item.IsRemote) + if (!item.IsFolder && !item.IsRemote && item.RetrieveArt) { - SlideShow.Add(facadeView[i].ThumbnailImage); + _SlideShow.Add(facadeView[i].Path); } i++; @@ -807,26 +895,45 @@ } while (i != iStartItem); - if (SlideShow.Count > 0) + if (_SlideShow.Count > 0) { - SlideShow.StartSlideShow(); + GUIWindowManager.Callbacks+= new GUIWindowManager.OnCallBackHandler(OnCallBack); + _SlideShow.StartSlideShow(); + _onSlideShow = true; + //GUIWindowManager.Receivers+= new GUIWindowManager.SendMessageHandler(OnSendMessage ); + //Action.ActionType. GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW); } } + public void OnCallBack(){ + /* + Log.Info("received call back with onSlideshow set to {0}",_onSlideShow); + if(_imagesDone==false){ + getImages(_photosToDownload); + } + * */ + } void OnShowPicture(string strFile) { - GUISlideShow SlideShow = (GUISlideShow)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW); - if (SlideShow == null) + _SlideShow = (GUISlideShow)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW); + if (_SlideShow == null) return; - SlideShow.Reset(); - SlideShow.Add(strFile); + _SlideShow.Reset(); + _SlideShow.Add(strFile); GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW); // SlideShow.Select(strFile); } + protected void ClearCache(){ + String [] strFiles = System.IO.Directory.GetFiles(_imageDirectory,"Thumbs*.jpg"); + foreach(String path in strFiles){ + System.IO.File.Delete(path); + } + + } public void TestSlideShow(String user){ List<MyPhoto> photoList = MyFlickr.getInterestingPhotos(); GUISlideShow SlideShow = (GUISlideShow)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW); Modified: trunk/plugins/OnlinePhotos/OnlinePhotos.csproj =================================================================== --- trunk/plugins/OnlinePhotos/OnlinePhotos.csproj 2007-05-04 17:23:57 UTC (rev 376) +++ trunk/plugins/OnlinePhotos/OnlinePhotos.csproj 2007-05-05 00:39:12 UTC (rev 377) @@ -33,6 +33,9 @@ <PlatformTarget>AnyCPU</PlatformTarget> <FileAlignment>4096</FileAlignment> </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <OutputPath>..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Plugins\Windows\</OutputPath> + </PropertyGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> <ItemGroup> <Reference Include="Core"> @@ -55,6 +58,8 @@ <SpecificVersion>False</SpecificVersion> </Reference> <Reference Include="System" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Drawing.Design" /> <Reference Include="System.Xml" /> <Reference Include="Utils"> <HintPath>..\..\MediaPortal\Utils\bin\Release\Utils.DLL</HintPath> Modified: trunk/plugins/OnlinePhotos/OnlinePhotos.suo =================================================================== (Binary files differ) Modified: trunk/plugins/OnlinePhotos/myonlinephotos.xml =================================================================== --- trunk/plugins/OnlinePhotos/myonlinephotos.xml 2007-05-04 17:23:57 UTC (rev 376) +++ trunk/plugins/OnlinePhotos/myonlinephotos.xml 2007-05-05 00:39:12 UTC (rev 377) @@ -25,11 +25,124 @@ </control> <control> <type>button</type> - <description>slideshow button</description> + <description>Flickr</description> <id>3</id> <onright>50</onright> + <label>Flickr</label> + </control> + <control> + <type>button</type> + <description>Picasa</description> + <id>4</id> + <onright>50</onright> + <label>Picasa</label> + </control> + <control> + <type>button</type> + <description>slideshow button</description> + <id>5</id> + <onright>50</onright> <label>Slideshow</label> </control> + <control> + <type>button</type> + <description>cache button</description> + <id>6</id> + <onright>50</onright> + <label>Clear Cache</label> + </control> + <control> + <type>button</type> + <description>cache button</description> + <id>7</id> + <onright>50</onright> + <label>Settings</label> + </control> + </control> + <control> + <description>group element</description> + <type>group</type> + <animation effect="fade" time="250">WindowOpen</animation> + <animation effect="fade" time="500">WindowClose</animation> + <animation effect="slide" time="250" start="-300,0">WindowOpen</animation> + <animation effect="slide" time="500" end="0,-300">WindowClose</animation> + <posX>60</posX> + <posY>97</posY> + <layout>StackLayout</layout> + <control> + <type>button</type> + <description>Flickr</description> + <id>31</id> + <onright>50</onright> + <label>My Photos</label> + </control> + <control> + <type>button</type> + <description>Flickr</description> + <id>32</id> + <onright>50</onright> + <label>My Photo Sets</label> + </control> + <control> + <type>button</type> + <description>Flickr</description> + <id>33</id> + <onright>50</onright> + <label>My Favorites</label> + </control> + <control> + <type>button</type> + <description>Flickr</description> + <id>34</id> + <onright>50</onright> + <label>Interesting Photos</label> + </control> + <control> + <type>button</type> + <description>Flickr</description> + <id>35</id> + <onright>50</onright> + <label>Recent Photos</label> + </control> + <control> + <type>button</type> + <description>Flickr</description> + <id>36</id> + <onright>50</onright> + <label>Search By Tag</label> + </control> + <control> + <type>button</type> + <description>Flickr</description> + <id>37</id> + <onright>50</onright> + <label>Search by Text</label> + </control> + <control> + <type>button</type> + <description>Flickr</description> + <id>38</id> + <onright>50</onright> + <label>Search Groups</label> </control> - </controls> + </control> + <control> + <description>group element</description> + <type>group</type> + <animation effect="fade" time="250">WindowOpen</animation> + <animation effect="fade" time="500">WindowClose</animation> + <animation effect="slide" time="250" start="-300,0">WindowOpen</animation> + <animation effect="slide" time="500" end="0,-300">WindowClose</animation> + <posX>60</posX> + <posY>97</posY> + <layout>StackLayout</layout> + <control> + <type>button</type> + <description>Flickr</description> + <id>41</id> + <onright>50</onright> + <label>My Photos</label> + </control> + </control> + </controls> </window> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gre...@us...> - 2007-05-07 02:00:12
|
Revision: 383 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=383&view=rev Author: gregmac45 Date: 2007-05-06 19:00:09 -0700 (Sun, 06 May 2007) Log Message: ----------- Fixed GUI, AddFixed GUI, Added Settings, Added Flickr photo sets, Fixed various Bugs Modified Paths: -------------- trunk/plugins/OnlinePhotos/Flickr.cs trunk/plugins/OnlinePhotos/MyClass.cs trunk/plugins/OnlinePhotos/myonlinephotos.xml Modified: trunk/plugins/OnlinePhotos/Flickr.cs =================================================================== --- trunk/plugins/OnlinePhotos/Flickr.cs 2007-05-06 18:24:35 UTC (rev 382) +++ trunk/plugins/OnlinePhotos/Flickr.cs 2007-05-07 02:00:09 UTC (rev 383) @@ -145,6 +145,9 @@ private static List<MyPhoto> loadMyPhotoList(Photo[] photoArray) { Photos photos = new Photos(); + if (photoArray == null) + return new List<MyPhoto>(); + foreach(Photo photo in photoArray) { photos.PhotoCollection.Add(photo); Modified: trunk/plugins/OnlinePhotos/MyClass.cs =================================================================== --- trunk/plugins/OnlinePhotos/MyClass.cs 2007-05-06 18:24:35 UTC (rev 382) +++ trunk/plugins/OnlinePhotos/MyClass.cs 2007-05-07 02:00:09 UTC (rev 383) @@ -13,6 +13,7 @@ using MediaPortal.GUI.Library; using MediaPortal.Dialogs; using MediaPortal.GUI.Pictures; +using MediaPortal.Configuration; using System.Collections.Generic; using System.Collections.Specialized; using System.Xml; @@ -25,73 +26,80 @@ namespace OnlinePhotos { - public class MyPhoto - { - private String title; - public String Title - { - get - { - return title; - } - set - { - title = value; - - } - } - - public String id; - public String thumbnailUrl; - public String largeUrl; - public String mediumUrl; - public String smallUrl; - private String thumbName; - public String ThumbName{ - get{ - if(String.IsNullOrEmpty(thumbName)){ - thumbName = Utils.GetFilename(Utils.GetThumb(title))+id; - } - return thumbName; - } - } - } - public class MyAlbum - { - public string id; - private string title; - public string coverThumbnailUrl; - private String thumbName; - public List<MyPhoto> photoCollection = new List<MyPhoto>(); - public String Title - { - get - { - return title; - } - set - { - title = value; - //ThumbName = "alb"+Utils.GetFilename(Utils.GetThumb(value)); - } - } - public String ThumbName{ - get{ - if(String.IsNullOrEmpty(thumbName)){ - thumbName = Utils.GetFilename(Utils.GetThumb(title))+id; - } - return thumbName; - } - } - } + public class MyPhoto + { + private String title; + public String Title + { + get + { + return title; + } + set + { + title = value; - /// <summary> - /// Description of MyClass. - /// </summary> - public class MyOnlinePhotos : GUIWindow, ISetupForm - { - [SkinControlAttribute(2)] - protected GUIButtonControl btnViewAs = null; + } + } + + public String id; + public String thumbnailUrl; + public String largeUrl; + public String mediumUrl; + public String smallUrl; + private String thumbName; + public String ThumbName + { + get + { + if (String.IsNullOrEmpty(thumbName)) + { + thumbName = Utils.GetFilename(Utils.GetThumb(title)) + id; + } + return thumbName; + } + } + } + public class MyAlbum + { + public string id; + private string title; + public string coverThumbnailUrl; + private String thumbName; + public List<MyPhoto> photoCollection = new List<MyPhoto>(); + public String Title + { + get + { + return title; + } + set + { + title = value; + //ThumbName = "alb"+Utils.GetFilename(Utils.GetThumb(value)); + } + } + public String ThumbName + { + get + { + if (String.IsNullOrEmpty(thumbName)) + { + thumbName = Utils.GetFilename(Utils.GetThumb(title)) + id; + } + return thumbName; + } + } + } + + /// <summary> + /// Description of MyClass. + /// </summary> + public class MyOnlinePhotos : GUIWindow, ISetupForm + { + + [SkinControlAttribute(2)] + protected GUIButtonControl btnViewAs = null; [SkinControlAttribute(3)] protected GUIButtonControl btnFlickr = null; [SkinControlAttribute(31)] @@ -112,698 +120,750 @@ protected GUIButtonControl btnSearchGrp = null; [SkinControlAttribute(4)] protected GUIButtonControl btnPicasa = null; - [SkinControlAttribute(41)] - protected GUIButtonControl btnPicasaPhotos = null; - [SkinControlAttribute(5)] - protected GUIButtonControl btnSlide = null; + //[SkinControlAttribute(41)] + //protected GUIButtonControl btnPicasaPhotos = null; + [SkinControlAttribute(5)] + protected GUIButtonControl btnSlide = null; [SkinControlAttribute(6)] - protected GUIButtonControl btnClearCache = null; + protected GUIButtonControl btnClearCache = null; [SkinControlAttribute(7)] protected GUIButtonControl btnSettings = null; - [SkinControlAttribute(50)] - protected GUIFacadeControl facadeView = null; - GUISlideShow _SlideShow; - private State _CurrentState = State.home; - protected View currentView = View.List; - protected List<MyPhoto> CurrentPhotoList; - protected List<MyAlbum> CurrentAlbumList; - protected MyAlbum CurrentAlbum; - protected bool _imagesDone = true; - protected bool _stopImgDownload = false; - protected bool _onSlideShow = false; - protected string _imageDirectory = @"C:\Temp\"; - protected NameValueCollection _photosToDownload; - protected NameValueCollection _AlbumCoversToDownload; - public enum State - { - home = 0, - albums = 1, - photos = 2, - album_photos = 3, - //showpicture=4, - //slideshow=5 - } - public enum View - { - List = 0, - Icons = 1, - LargeIcons = 2, - FilmStrip = 3 - } - public string PluginName() - { + [SkinControlAttribute(8)] + protected GUIButtonControl btnBack = null; + [SkinControlAttribute(50)] + protected GUIFacadeControl facadeView = null; - return "Online Photos"; + #region Member variables + GUISlideShow _SlideShow; + private State _CurrentState = State.HOME; + protected View currentView = View.LIST; + protected View photoView = View.LARGE_ICONS; + protected List<MyPhoto> CurrentPhotoList; + protected List<MyAlbum> CurrentAlbumList; + protected MyAlbum CurrentAlbum; + protected string _CurrentFlickrUser = ""; + protected string _CurrentPicasaUser = ""; + protected bool _imagesDone = true; + protected bool _stopImgDownload = false; + protected bool _onSlideShow = false; + protected int _SelectedAlbumIdx = -1; + protected int _SelectedPhotoIdx = -1; + //protected string _imageDirectory = Config.GetSubFolder(Config.Dir.Thumbs, @"OnlinePhotos"); + protected string _imageDirectory = String.Empty; + protected NameValueCollection _photosToDownload; + protected NameValueCollection _AlbumCoversToDownload; + #endregion + #region Enums + public enum State + { + HOME, + FLICKR_HOME, + FLICKR_SETS, + FLICKR_SET_PHOTOS, + FLICKR_PHOTOS, + //PICASA_HOME, + PICASA_ALBUMS, + PICASA_PHOTOS + } + public enum View + { + LIST =1, + ICONS=2, + LARGE_ICONS=3, + FILM_STRIP=4 + } + #endregion + public string PluginName() + { - } - public string Description() - { + return "Online Photos"; - return "Flickr and Google Photo Plugin"; + } + public string Description() + { - } - public string Author() - { + return "Flickr and Google Photo Plugin"; - return "GregMac45"; + } + public string Author() + { - } - public void ShowPlugin() - { + return "GregMac45"; - //MessageBox.Show("Nothing to configure, this is just an example"); + } + public void ShowPlugin() + { - } - public bool CanEnable() - { + //MessageBox.Show("Nothing to configure, this is just an example"); - return true; - } - public int GetWindowId() - { + } + public bool CanEnable() + { - return GetID; + return true; + } + public int GetWindowId() + { - } - public bool DefaultEnabled() - { - return true; - } - public bool HasSetup() - { - return false; - } - public override int GetID - { - get - { - return 5757; - } - set - { - } - } - public override bool Init() - { - LoadSettings(); - return Load(GUIGraphicsContext.Skin + @"\myonlinephotos.xml"); + return GetID; - } - public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage) - { - strButtonText = PluginName(); + } + public bool DefaultEnabled() + { + return true; + } + public bool HasSetup() + { + return false; + } + public override int GetID + { + get + { + return 5757; + } + set + { + } + } + public override bool Init() + { + _imageDirectory = Config.GetSubFolder(Config.Dir.Thumbs, @"OnlinePhotos"); + if (Directory.Exists(_imageDirectory) == false) + { + try + { + Directory.CreateDirectory(_imageDirectory); + } + catch (Exception) + { + //Log.Error("Unable to create thumb directory {0}", _imageDirectory); + _imageDirectory = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache); + } + } + _imageDirectory += "/"; + Log.Info("OnlinePhotos thumb Dir: {0}", _imageDirectory); + LoadSettings(); + return Load(GUIGraphicsContext.Skin + @"\myonlinephotos.xml"); - strButtonImage = String.Empty; + } + public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage) + { + strButtonText = PluginName(); - strButtonImageFocus = String.Empty; + strButtonImage = String.Empty; - strPictureImage = String.Empty; + strButtonImageFocus = String.Empty; - return true; - } - public bool ShowDefaultHome() - { - return true; - } - protected override void OnPageLoad() - { - Log.Info("in OnPageLoad"); - if (_CurrentState == State.home) - { - //_log.Info("onPageLoad state home"); - GUIPropertyManager.SetProperty("#header.label", "Online Photos"); - DisplayHome(); - //DisplaySites(); - } - else if (_CurrentState == State.photos || _CurrentState == State.album_photos) - { - Log.Info("OnPageLoad with state ={0} calling DisplayCurrentPhotos with false",_CurrentState); - DisplayCurrentPhotos(false); - } - - currentView = View.Icons; - ChangeFacadeView(); - _onSlideShow = false; - if (_imagesDone == false) + strPictureImage = String.Empty; + + return true; + } + public bool ShowDefaultHome() + { + return true; + } + protected override void OnPageLoad() + { + Log.Info("in OnPageLoad"); + base.OnPageLoad(); + switch (_CurrentState) { - Log.Info("OnPageLoad with state ={0} and imageDone = false calling GetImages(_photosToDownload)",_CurrentState); - if (_CurrentState == State.album_photos || _CurrentState == State.photos) - { - getImages(_photosToDownload); - } + case State.HOME: + GUIPropertyManager.SetProperty("#header.label", "Online Photos"); + SetStateHome(); + break; + case State.FLICKR_PHOTOS: + GUIPropertyManager.SetProperty("#header.label", "FLICKR"); + SetStateFlickrPhotos(); + DisplayCurrentPhotos(!_imagesDone); + if (_SelectedPhotoIdx > -1) + { + GUIControl.FocusControl(GetID, facadeView.GetID); + GUIControl.SelectItemControl(GetID, facadeView.GetID, _SelectedPhotoIdx); + } + break; + case State.FLICKR_SET_PHOTOS: + GUIPropertyManager.SetProperty("#header.label", "FLICKR"); + SetStateFlickrSetPhotos(); + DisplayCurrentPhotos(!_imagesDone); + if (_SelectedPhotoIdx > -1) + { + GUIControl.FocusControl(GetID, facadeView.GetID); + GUIControl.SelectItemControl(GetID, facadeView.GetID, _SelectedPhotoIdx); + } + break; + case State.PICASA_PHOTOS: + GUIPropertyManager.SetProperty("#header.label", "PICASA"); + SetStatePicasaPhotos(); + DisplayCurrentPhotos(!_imagesDone); + if (_SelectedPhotoIdx > -1) + { + GUIControl.FocusControl(GetID, facadeView.GetID); + GUIControl.SelectItemControl(GetID, facadeView.GetID, _SelectedPhotoIdx); + } + break; } - - base.OnPageLoad(); - } - public override bool OnMessage(GUIMessage message) - { - return base.OnMessage(message); - } - public override void OnAction(Action action) - { - - if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU) - { - Log.Info("in Action previous menu"); - if (_CurrentState == State.album_photos) - { - _CurrentState = State.albums; - Log.Info(" AP - Sending request to stop img download"); + + _onSlideShow = false; + + + } + public override bool OnMessage(GUIMessage message) + { + return base.OnMessage(message); + } + public override void OnAction(Action action) + { + + if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU) + { + OnPreviousWindow(); + return; + } + base.OnAction(action); + } + protected override void OnPreviousWindow() + { + Log.Info("Current state = {0}", _CurrentState); + switch (_CurrentState) + { + case State.FLICKR_PHOTOS: _stopImgDownload = true; System.Threading.Thread.Sleep(25); - DisplayCurrentAlbums(); - - - return; - } - else if (_CurrentState == State.albums || _CurrentState == State.photos) - { - _CurrentState = State.home; - Log.Info(" P - Sending request to stop img download"); + GUIControl.ClearControl(GetID, facadeView.GetID); + SetStateFlickrHome(); + //DisplayCurrentAlbums(); + return; + case State.FLICKR_SETS: _stopImgDownload = true; System.Threading.Thread.Sleep(25); - DisplayHome(); - - return; - } - - - - } - base.OnAction(action); - } - protected override void OnPageDestroy(int new_windowId) - { + GUIControl.ClearControl(GetID, facadeView.GetID);; + SetStateFlickrHome(); + return; + case State.FLICKR_SET_PHOTOS: + _stopImgDownload = true; + System.Threading.Thread.Sleep(25); + SetStateFlickrSets(); + DisplayCurrentAlbums(); + if (_SelectedAlbumIdx > -1) + { + GUIControl.FocusControl(GetID, facadeView.GetID); + GUIControl.SelectItemControl(GetID, facadeView.GetID, _SelectedAlbumIdx); + } + return; + case State.PICASA_ALBUMS: + _stopImgDownload = true; + System.Threading.Thread.Sleep(25); + GUIControl.ClearControl(GetID, facadeView.GetID);; + SetStateHome(); + return; + case State.FLICKR_HOME: + //case State.PICASA_HOME: + SetStateHome(); + return; - base.OnPageDestroy(new_windowId); - } - protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType) - { - if (control == btnViewAs) - { - ChangeFacadeView(); - } - else if (control == btnSlide) - { - OnSlideShow(); - }else if(control == btnClearCache){ - ClearCache(); + case State.PICASA_PHOTOS: + _stopImgDownload = true; + System.Threading.Thread.Sleep(25); + SetStatePicasaAlbums(); + DisplayCurrentAlbums(); + if (_SelectedAlbumIdx > -1) + { + GUIControl.FocusControl(GetID, facadeView.GetID); + GUIControl.SelectItemControl(GetID, facadeView.GetID, _SelectedAlbumIdx); + } + return; + default: + base.OnPreviousWindow(); + break; } - else if (control == facadeView && _CurrentState == State.home) - { - String SelectedSiteId = facadeView.SelectedListItem.Path; - String userInput = "" ; - switch (SelectedSiteId) - { - case "1": - DisplayInterestingFlickrPhotos(); - _CurrentState = State.photos; - break; - case "2": - DisplayRecentFlickrPhotos(); - _CurrentState = State.photos; - break; - case "3": - - if (GetUserInputString(ref userInput)) - { - DisplayFlickrPhotosWithTags(userInput); - _CurrentState = State.photos; - - } - break; - case "4": - if (GetUserInputString(ref userInput)) - { - DisplayFlickrPhotosWithText(userInput); - _CurrentState = State.photos; + + } + protected override void OnPageDestroy(int new_windowId) + { + SaveSettings(); + base.OnPageDestroy(new_windowId); + } + protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType) + { + String userInput = ""; + if (control == btnClearCache) ClearCache(); + else if (control == btnViewAs) ChangeFacadeView(); + else if (control == btnClearCache) ClearCache(); + else if (control == btnSettings) OnSettings(); + else if (control == btnSlide) OnSlideShow(); + else if (control == facadeView) OnClick(); + else if (control == btnBack) OnPreviousWindow(); + else if (control == btnFlickr) + { + SetStateFlickrHome(); + } + else if (control == btnInterest) + { + DisplayInterestingFlickrPhotos(); + SetStateFlickrPhotos(); + } + else if (control == btnRecent) + { + SetStateFlickrPhotos(); + DisplayRecentFlickrPhotos(); + + } - } - break; - case "5": - DisplayFlickrUserPhotos("gregmac45"); - _CurrentState = State.photos; + else if (control == btnSearchTag) + { + if (GetUserInputString(ref userInput)) + { - - break; - case "6": - if (GetUserInputString(ref userInput)) - { - DisplayFlickrGroupsWithText(userInput); - _CurrentState = State.photos; - } - break; - case "7": - DisplayFlickrUserFavoritePhotos("gregmac45"); - _CurrentState = State.photos; - break; - case "8": - DisplayPicasaAlbums("gregmac45"); - _CurrentState = State.albums; - break; - } - } - else if (control == facadeView && _CurrentState == State.albums) - { - _stopImgDownload = true; - CurrentAlbum = CurrentAlbumList[facadeView.SelectedListItemIndex]; - DisplayAlbumPhotos(); - - _CurrentState = State.album_photos; - } - else if (control == facadeView && (_CurrentState == State.photos || _CurrentState== State.album_photos)) - { - OnShowPicture(facadeView.SelectedListItem.Path); - } - } - public void DisplayInterestingFlickrPhotos() - { - CurrentPhotoList = - MyFlickr.getInterestingPhotos(); - DisplayCurrentPhotos(); - } - public void DisplayRecentFlickrPhotos() - { - CurrentPhotoList = MyFlickr.getRecentPhotos(); - DisplayCurrentPhotos(); - } - public void DisplayFlickrPhotosWithTags(String tags) - { - CurrentPhotoList = MyFlickr.getPhotosByTag(tags); - DisplayCurrentPhotos(); - } - public void DisplayFlickrPhotosWithText(String text) - { - CurrentPhotoList = MyFlickr.getPhotosByText(text); - DisplayCurrentPhotos(); - } - public void DisplayFlickrGroupsWithText(String text) - { - CurrentAlbumList = MyFlickr.getGroupsByText(text); - DisplayCurrentAlbums(); - } - public void DisplayFlickrUserPhotos(String user) - { - CurrentPhotoList = MyFlickr.getUserPhotos(user); - DisplayCurrentPhotos(); - } - public void DisplayFlickrUserFavoritePhotos(String user) - { - CurrentPhotoList = MyFlickr.getUserFavoritePhotos(user); - DisplayCurrentPhotos(); - } - public void DisplayPicasaAlbums(String user) - { - CurrentAlbumList = MyPicasa.getUserAlbums(user); - DisplayCurrentAlbums(); - } - private bool GetUserInputString(ref string sString) - { - VirtualKeyboard keyBoard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD); - keyBoard.Reset(); - keyBoard.IsSearchKeyboard = true; - keyBoard.Text = sString; - keyBoard.DoModal(GetID); // show it... - if (keyBoard.IsConfirmed) sString = keyBoard.Text; - return keyBoard.IsConfirmed; - } - public void DisplayCurrentPhotos(){ - DisplayCurrentPhotos(true); - } - public void DisplayCurrentPhotos(bool refresh) - { - facadeView.Clear(); - GUIListItem item; - int i = 0; - _photosToDownload = new NameValueCollection(); - foreach (MyPhoto photo in CurrentPhotoList) - { - item = new GUIListItem(photo.Title); - item.Path = photo.mediumUrl; - item.ItemId = i; - item.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(item_OnItemSelected); - if(refresh){ - item.RetrieveArt = false; - item.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); - - - _photosToDownload.Add(photo.ThumbName,photo.mediumUrl); - //Log.Info("setting photo to url " + photo.mediumUrl); - }else{ - item.RetrieveArt = true; - item.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); - } - facadeView.Add(item); - //GUIWindowManager.Process(); - i++; + SetStateFlickrPhotos(); + DisplayFlickrPhotosWithTags(userInput); + - } - if(refresh){ - getImages(_photosToDownload); - } + } + } + else if (control == btnSearchTxt) + { + if (GetUserInputString(ref userInput)) + { + SetStateFlickrPhotos(); + DisplayFlickrPhotosWithText(userInput); + - } - public void DisplayCurrentAlbums() - { - facadeView.Clear(); - GUIListItem item; - int i = 0; - _AlbumCoversToDownload = new NameValueCollection(); - foreach (MyAlbum album in CurrentAlbumList) - { - item = new GUIListItem(album.Title); - item.Path = album.id; - item.ItemId = i; - //item.IsFolder = true; - item.RetrieveArt = false; - item.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); - item.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(item_OnItemSelected); - _AlbumCoversToDownload.Add(album.ThumbName,album.coverThumbnailUrl); - Log.Info("album thumbnail for {0} is {1}",album.Title,album.coverThumbnailUrl); - facadeView.Add(item); - GUIWindowManager.Process(); - i++; + } + } + else if (control == btnFlickrSets) + { + SetStateFlickrSets(); + DisplayFlickrUserSets(_CurrentFlickrUser); + + } + else if (control == btnFlickrPhotos) + { + SetStateFlickrPhotos(); + DisplayFlickrUserPhotos(_CurrentFlickrUser); + + } - } - getImages(_AlbumCoversToDownload); - } - private void DisplayAlbumPhotos(){ - CurrentPhotoList = MyPicasa.getAlbumPhotos(CurrentAlbum.id); - DisplayCurrentPhotos(); - } - /* - private String GetThumbnail(String lsUrl) - { - string lsThumb = MediaPortal.Util.Utils.GetThumb(lsUrl); - lsThumb = System.IO.Path.GetFileName(lsThumb); - string lsThumbsDir = "C:\\Temp\\"; - if (System.IO.Directory.Exists(lsThumbsDir) == false) - { - System.IO.Directory.CreateDirectory(lsThumbsDir); - } - lsThumb = lsThumbsDir + lsThumb; - //Log.Info(lsThumb); - if (System.IO.File.Exists(lsThumb) == false) - { - String lsFilename = System.IO.Path.GetFileName(lsThumb); - //moLog.Info("Filename will be {0}", lsFilename); - MediaPortal.Util.Utils.DownLoadImage(lsUrl, lsThumb); - } - if (System.IO.File.Exists(lsThumb)) - { - //facadeView[liIdx].IconImageBig = lsThumb; - return lsThumb; - } - else - { - return ""; - //facadeView[liIdx].IconImageBig = ""; - } - } - */ - protected void getImages(NameValueCollection imageList){ + + else if (control == btnSearchGrp) + { + if (GetUserInputString(ref userInput)) + { + SetStateFlickrPhotos(); + DisplayFlickrGroupsWithText(userInput); + + } + } + else if (control == btnFlickrFav) + { + SetStateFlickrPhotos(); + DisplayFlickrUserFavoritePhotos(_CurrentFlickrUser); + + } + else if (control == btnPicasa) + { + SetStatePicasaAlbums(); + DisplayPicasaAlbums(_CurrentPicasaUser); + } + } + #region Flickr Api calls + public void DisplayInterestingFlickrPhotos() + { + CurrentPhotoList = + MyFlickr.getInterestingPhotos(); + DisplayCurrentPhotos(); + } + public void DisplayRecentFlickrPhotos() + { + CurrentPhotoList = MyFlickr.getRecentPhotos(); + DisplayCurrentPhotos(); + } + public void DisplayFlickrPhotosWithTags(String tags) + { + CurrentPhotoList = MyFlickr.getPhotosByTag(tags); + DisplayCurrentPhotos(); + } + public void DisplayFlickrPhotosWithText(String text) + { + CurrentPhotoList = MyFlickr.getPhotosByText(text); + DisplayCurrentPhotos(); + } + public void DisplayFlickrGroupsWithText(String text) + { + CurrentAlbumList = MyFlickr.getGroupsByText(text); + DisplayCurrentAlbums(); + } + public void DisplayFlickrUserPhotos(String user) + { + CurrentPhotoList = MyFlickr.getUserPhotos(user); + DisplayCurrentPhotos(); + } + public void DisplayFlickrUserSets(String user) + { + CurrentAlbumList = MyFlickr.getUserPhotoSets(user); + DisplayCurrentAlbums(); + } + + public void DisplayFlickrUserFavoritePhotos(String user) + { + CurrentPhotoList = MyFlickr.getUserFavoritePhotos(user); + DisplayCurrentPhotos(); + } + #endregion + public void DisplayPicasaAlbums(String user) + { + CurrentAlbumList = MyPicasa.getUserAlbums(user); + DisplayCurrentAlbums(); + } + private bool GetUserInputString(ref string sString) + { + VirtualKeyboard keyBoard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD); + keyBoard.Reset(); + keyBoard.IsSearchKeyboard = true; + keyBoard.Text = sString; + keyBoard.DoModal(GetID); // show it... + if (keyBoard.IsConfirmed) sString = keyBoard.Text; + return keyBoard.IsConfirmed; + } + #region general Display album/photos + public void DisplayCurrentPhotos() + { + DisplayCurrentPhotos(true); + } + public void DisplayCurrentPhotos(bool refresh) + { + GUIControl.ClearControl(GetID, facadeView.GetID);; + GUIListItem item; + int i = 0; + _photosToDownload = new NameValueCollection(); + foreach (MyPhoto photo in CurrentPhotoList) + { + item = new GUIListItem(photo.Title); + + item.ItemId = i; + item.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(item_OnItemSelected); + if (refresh) + { + item.Path = photo.mediumUrl; + item.RetrieveArt = false; + item.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); + + + _photosToDownload.Add(photo.ThumbName, photo.mediumUrl); + //Log.Info("setting photo to url " + photo.mediumUrl); + } + else + { + item.Path = _imageDirectory + photo.ThumbName + "L.jpg"; + item.RetrieveArt = true; + item.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); + } + facadeView.Add(item); + //GUIWindowManager.Process(); + i++; + + } + if (refresh) + { + getImages(_photosToDownload); + } + + } + public void DisplayCurrentAlbums() + { + GUIControl.ClearControl(GetID, facadeView.GetID);; + GUIListItem item; + int i = 0; + _AlbumCoversToDownload = new NameValueCollection(); + foreach (MyAlbum album in CurrentAlbumList) + { + item = new GUIListItem(album.Title); + item.Path = album.id; + item.ItemId = i; + //item.IsFolder = true; + item.RetrieveArt = false; + item.OnRetrieveArt += new MediaPortal.GUI.Library.GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt); + item.OnItemSelected += new MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(item_OnItemSelected); + _AlbumCoversToDownload.Add(album.ThumbName, album.coverThumbnailUrl); + Log.Info("album thumbnail for {0} is {1}", album.Title, album.coverThumbnailUrl); + facadeView.Add(item); + GUIWindowManager.Process(); + i++; + + } + getImages(_AlbumCoversToDownload); + } + private void DisplayAlbumPhotos() + { + CurrentPhotoList = MyPicasa.getAlbumPhotos(CurrentAlbum.id); + DisplayCurrentPhotos(); + } + protected void DisplayFlickrSetPhotos() + { + CurrentPhotoList = MyFlickr.getPhotoSetPhotos(CurrentAlbum.id); + DisplayCurrentPhotos(); + } + #endregion + #region image donwload + protected void getImages(NameValueCollection imageList) + { Log.Info("Getting images"); BackgroundWorker worker = new BackgroundWorker(); - worker.DoWork += new DoWorkEventHandler(downloadImages); - worker.RunWorkerAsync(imageList); + worker.DoWork += new DoWorkEventHandler(downloadImages); + worker.RunWorkerAsync(imageList); - using (WaitCursor cursor = new WaitCursor()) - { - while (_imagesDone == false) - { - GUIWindowManager.Process(); - } - } - } - public void downloadImages(object sender, DoWorkEventArgs e) - { + using (WaitCursor cursor = new WaitCursor()) + { + while (_imagesDone == false) + { + GUIWindowManager.Process(); + } + } + } + public void downloadImages(object sender, DoWorkEventArgs e) + { + //Log.Info("Using thumb directory:{0}", _imageDirectory); Log.Info("Downloading images"); - _imagesDone = false; - _stopImgDownload = false; - //List<String> imageList = (List<String>)e.Argument; - NameValueCollection imgNameUrlList= (NameValueCollection) e.Argument; - WebClient client = new WebClient(); - - string imageLocation; - string thumbnailLocation; - string url; - string name; - for(int i=0;i<imgNameUrlList.Count;i++) - { - url = imgNameUrlList.Get(i); - name = imgNameUrlList.GetKey(i); - - if(_stopImgDownload){ - Log.Info("Received Request to stop Download"); - break; - } - Log.Info("downloading image :"+url); - /* - if(inPhotoState() ){ - imageLocation = "C:\\Temp\\" + CurrentPhotoList[i].ThumbName + ".jpg"; - }else{ - imageLocation = "C:\\Temp\\" + CurrentAlbumList[i].ThumbName + ".jpg"; - } - */ - imageLocation = "C:\\Temp\\" + name+ "L.jpg"; - thumbnailLocation = "C:\\Temp\\" + name+ ".jpg"; - if(System.IO.File.Exists(imageLocation) == false){ - client.DownloadFile(url, imageLocation); - if(System.IO.File.Exists(thumbnailLocation) == false){ - //int iRotate = dbs.GetRotation(imageLocation); - MediaPortal.Util.Picture.CreateThumbnail(imageLocation, thumbnailLocation, (int)Thumbs.ThumbResolution, (int)Thumbs.ThumbResolution, 0); - System.Threading.Thread.Sleep(25); - } - if(_onSlideShow){ - _SlideShow.Add(imageLocation); - } - } - facadeView[i].Path = imageLocation; - facadeView[i].RetrieveArt = true; - facadeView[i].RefreshCoverArt(); - //i++; - - - } - Log.Info("Setting imagesDone to true"); - _imagesDone = true; - } - public bool inPhotoState(){ - return _CurrentState == State.album_photos || _CurrentState == State.photos; - } - void OnRetrieveCoverArt(GUIListItem item) - { - if(inPhotoState() ){ - item.ThumbnailImage = "C:\\Temp\\" + CurrentPhotoList[item.ItemId].ThumbName + ".jpg"; - }else{ - item.ThumbnailImage = "C:\\Temp\\" + CurrentAlbumList[item.ItemId].ThumbName + ".jpg"; - } - } - private void item_OnItemSelected(GUIListItem item, GUIControl parent) - { - GUIFilmstripControl filmstrip = parent as GUIFilmstripControl; - if (filmstrip == null) - return; - filmstrip.InfoImageFileName = item.Path; - } - private void ChangeFacadeView() - { - - - switch (currentView) - { - case View.List: - currentView = View.Icons; - facadeView.View = GUIFacadeControl.ViewMode.SmallIcons; - break; - case View.Icons: - currentView = View.LargeIcons; - facadeView.View = GUIFacadeControl.ViewMode.LargeIcons; - break; - case View.LargeIcons: - currentView = View.FilmStrip; - facadeView.View = GUIFacadeControl.ViewMode.Filmstrip; - break; - case View.FilmStrip: - currentView = View.List; - facadeView.View = GUIFacadeControl.ViewMode.List; - break; - } - GUIControl.FocusControl(GetID, facadeView.GetID); + _imagesDone = false; + _stopImgDownload = false; + //List<String> imageList = (List<String>)e.Argument; + NameValueCollection imgNameUrlList = (NameValueCollection)e.Argument; + WebClient client = new WebClient(); - string strLine = String.Empty; - View view = currentView; - switch (view) - { - case View.List: - strLine = GUILocalizeStrings.Get(101); - break; - case View.Icons: - strLine = GUILocalizeStrings.Get(100); - break; - case View.LargeIcons: - strLine = GUILocalizeStrings.Get(417); - break; - case View.FilmStrip: - strLine = GUILocalizeStrings.Get(733); - break; - } - GUIControl.SetControlLabel(GetID, btnViewAs.GetID, strLine); + string imageLocation; + string thumbnailLocation; + string url; + string name; + for (int i = 0; i < imgNameUrlList.Count; i++) + { + url = imgNameUrlList.Get(i); + name = imgNameUrlList.GetKey(i); - } - private void LoadSettings() - { - XmlDocument doc = new XmlDocument(); - try - { - doc.Load("OnlinePhotoSettings.xml"); - /* - XmlNode filter = doc.SelectSingleNode("//settings/filter"); - String lsFilter = filter.InnerText; - msFilterArray = lsFilter.Split(new char[] { ',' }); - if (msFilterArray.Length == 1 && msFilterArray[0] == "") + if (_stopImgDownload) { - msFilterArray = null; + Log.Info("Received Request to stop Download"); + break; } - XmlNode thumbNode = doc.SelectSingleNode("//settings/thumbLocation"); - msThumbLocation = thumbNode.InnerText; + Log.Info("downloading image :" + url); + + imageLocation = _imageDirectory + name + "L.jpg"; + thumbnailLocation = _imageDirectory + name + ".jpg"; + if (System.IO.File.Exists(imageLocation) == false) + { + client.DownloadFile(url, imageLocation); + if (System.IO.File.Exists(thumbnailLocation) == false) + { + //int iRotate = dbs.GetRotation(imageLocation); + MediaPortal.Util.Picture.CreateThumbnail(imageLocation, thumbnailLocation, (int)Thumbs.ThumbResolution, (int)Thumbs.ThumbResolution, 0); + System.Threading.Thread.Sleep(25); + } + if (_onSlideShow) + { + _SlideShow.Add(imageLocation); + } + } + facadeView[i].Path = imageLocation; + facadeView[i].RetrieveArt = true; + facadeView[i].RefreshCoverArt(); + //i++; - //lsFilterArray - //Log.Write("filter value {0}",filter.InnerText); - XmlNode root = doc.SelectSingleNode("//settings/sites/site"); - XmlNodeList nodeList; - nodeList = root.SelectNodes("//settings/sites/site"); - List<Site> loSiteList = new List<Site>(); - Site loSite; - XmlNodeList RssNodeList; - RssLink loRssData; - bool lbDonwloadDirSet = false; - foreach (XmlNode chileNode in nodeList) + } + Log.Info("Setting imagesDone to true"); + _imagesDone = true; + } + #endregion + protected void OnClick() + { + Log.Info("processing OnClick() with state={0} and selected index = {1}", _CurrentState, facadeView.SelectedListItemIndex); + + if (_CurrentState == State.PICASA_ALBUMS || _CurrentState == State.FLICKR_SETS) + { + + _stopImgDownload = true; + CurrentAlbum = CurrentAlbumList[facadeView.SelectedListItemIndex]; + _SelectedAlbumIdx = facadeView.SelectedListItemIndex; + if (_CurrentState == State.FLICKR_SETS) { - loSite = new Site(); + SetStateFlickrSetPhotos(); + DisplayFlickrSetPhotos(); - XmlNode node = chileNode.SelectSingleNode("name"); - loSite.name = node.InnerText; + } + else + { + SetStatePicasaPhotos(); + DisplayAlbumPhotos(); - node = chileNode.SelectSingleNode("id"); - loSite.id = node.InnerText; + } + } + else if (inPhotoState()) + { + _SelectedPhotoIdx = facadeView.SelectedListItemIndex; + OnShowPicture(facadeView.SelectedListItem.Path); + } + } + protected void OnSettings() + { + GUIDialogMenu dlgSel = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); + dlgSel.Reset(); + if (dlgSel != null) + { + dlgSel.Add("Cancel"); + String username = _CurrentFlickrUser; + if (String.IsNullOrEmpty(username)) + { + username = "Not Set!"; + } - node = chileNode.SelectSingleNode("user"); - if (node != null) - loSite.username = node.InnerText; + dlgSel.Add("Change Flickr username:" + username); + username = _CurrentPicasaUser; + if (String.IsNullOrEmpty(username)) + { + username = "Not Set!"; + } - node = chileNode.SelectSingleNode("password"); - if (node != null) - loSite.password = node.InnerText; + dlgSel.Add("Change Picasa username:" + username); - node = chileNode.SelectSingleNode("confirmAge"); - if (node != null) - loSite.confirmAge = node.InnerText == "yes"; - //Console.WriteLine("site Node:{0}", loSite.ToString()); - RssNodeList = chileNode.SelectNodes("rss"); - foreach (XmlNode RssNode in RssNodeList) + dlgSel.SetHeading("OnlinePhotos Settings"); + dlgSel.DoModal(GetID); + int liSelectedIdx = dlgSel.SelectedId; + if (liSelectedIdx == 2) + { + GetUserInputString(ref _CurrentFlickrUser); + } + if (liSelectedIdx == 3) + { + GetUserInputString(ref _CurrentPicasaUser); + if (String.IsNullOrEmpty(_CurrentPicasaUser)) { - loRssData = new RssLink(); - //node = chileNode.SelectSingleNode("d"); - - loRssData.name = RssNode.Attributes["name"].InnerText; - try - { - loRssData.isDynamic = RssNode.Attributes["dynamic"].InnerText.Equals("yes"); - Log.Info("Found a dynamic category for site {0}", loSite.name); - } - catch (Exception) { } - loRssData.url = RssNode.InnerText; - if (lbDonwloadDirSet == false && loSite.id == "99") - { - msDownloadDir = loRssData.url; - lbDonwloadDirSet = true; - } - //Console.WriteLine("rss Node:{0}", loRssData.ToString()); - loSite.RssList.Add(loRssData.name, loRssData); + btnPicasa.Disabled = true; } - moSiteList.Add(loSite.id, loSite); + else + { + btnPicasa.Disabled = false; + } } - * */ - } + } + } + public bool inPhotoState() + { + return _CurrentState == State.FLICKR_PHOTOS || _CurrentState == State.PICASA_PHOTOS || _CurrentState == State.FLICKR_SET_PHOTOS; + } + void OnRetrieveCoverArt(GUIListItem item) + { + if (inPhotoState()) + { + item.ThumbnailImage = _imageDirectory + CurrentPhotoList[item.ItemId].ThumbName + ".jpg"; + } + else + { + item.ThumbnailImage = _imageDirectory + CurrentAlbumList[item.ItemId].ThumbName + ".jpg"; + } + } + private void item_OnItemSelected(GUIListItem item, GUIControl parent) + { + GUIFilmstripControl filmstrip = parent as GUIFilmstripControl; + if (filmstrip == null) + return; + filmstrip.InfoImageFileName = item.Path; + } + private void ChangeFacadeView() + { - catch (Exception e) - { - //moLog.Error(e); - Log.Error(e); - } - } - private void DisplayHome() - { - //facadeView.Clear(); - GUIControl.ClearControl(GetID, facadeView.GetID); + + switch (currentView) + { + case View.LIST: + currentView = View.ICONS; + facadeView.View = GUIFacadeControl.ViewMode.SmallIcons; + break; + case View.ICONS: + currentView = View.LARGE_ICONS; + facadeView.View = GUIFacadeControl.ViewMode.LargeIcons; + break; + case View.LARGE_ICONS: + currentView = View.FILM_STRIP; + facadeView.View = GUIFacadeControl.ViewMode.Filmstrip; + break; + case View.FILM_STRIP: + currentView = View.LIST; + facadeView.View = GUIFacadeControl.ViewMode.List; + break; + } + GUIControl.FocusControl(GetID, facadeView.GetID); + + string strLine = String.Empty; + View view = currentView; + switch (view) + { + case View.LIST: + strLine = GUILocalizeStrings.Get(101); + break; + case View.ICONS: + strLine = GUILocalizeStrings.Get(100); + break; + case View.LARGE_ICONS: + strLine = GUILocalizeStrings.Get(417); + break; + case View.FILM_STRIP: + strLine = GUILocalizeStrings.Get(733); + break; + } + GUIControl.SetControlLabel(GetID, btnViewAs.GetID, strLine); + if (_CurrentState != State.HOME && _CurrentState != State.FLICKR_HOME) + { + photoView = currentView; + } + + + } + private void LoadSettings() + { + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + _CurrentFlickrUser = xmlreader.GetValueAsString("pictures", "flickr_user", ""); + _CurrentPicasaUser = xmlreader.GetValueAsString("pictures", "picasa_user", ""); + photoView = (View)xmlreader.GetValueAsInt("pictures", "onlinephotos_view", (int)View.LIST); + } + } + protected void SaveSettings() + { + using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + xmlwriter.SetValue("pictures", "onlinephotos_view", (int)photoView); + xmlwriter.SetValue("pictures", "picasa_user", _CurrentPicasaUser); + xmlwriter.SetValue("pictures", "flickr_user", _CurrentFlickrUser); + } + } + #region state management + private void SetStateHome() + { + _CurrentState = State.HOME; + GUIControl.ClearControl(GetID, facadeView.GetID);; + currentView = View.FILM_STRIP; + ChangeFacadeView(); hideAllButtons(); btnClearCache.Visible = true; btnFlickr.Visible = true; btnPicasa.Visible = true; + if (String.IsNullOrEmpty(_CurrentPicasaUser)) + { + btnPicasa.Disabled = true; + } + else + { + btnPicasa.Disabled = false; + } btnSettings.Visible = true; - /* - GUIListItem loListItem; - //foreach (Site loSite in moSiteList.Values) - //{ - loListItem = new GUIListItem("Flickr - Interesting Photos"); - loListItem.Path = "1"; - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - facadeView.Add(loListItem); - - loListItem = new GUIListItem("Flickr - Recent Photos"); - loListItem.Path = "2"; - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - facadeView.Add(loListItem); - - - loListItem = new GUIListItem("Flickr - Search by tag"); - loListItem.Path = "3"; - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - facadeView.Add(loListItem); - - loListItem = new GUIListItem("Flickr - Search by text"); - loListItem.Path = "4"; - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - facadeView.Add(loListItem); - - loListItem = new GUIListItem("Flickr - My Photos"); - loListItem.Path = "5"; - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - facadeView.Add(loListItem); - - loListItem = new GUIListItem("Flickr - My Favorites"); - loListItem.Path = "7"; - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - facadeView.Add(loListItem); - - loListItem = new GUIListItem("Flickr - Search Groups"); - loListItem.Path = "6"; - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - facadeView.Add(loListItem); - - loListItem = new GUIListItem("Picasa - My Photos"); - loListItem.Path = "8"; - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - facadeView.Add(loListItem); - */ - - //} - //GUIPropertyManager.SetProperty("#itemcount", facadeView.Count-1 + ""); - } - protected void hideAllButtons() { + GUIControl.FocusControl(GetID, btnFlickr.GetID); + + } + protected void hideAllButtons() + { btnClearCache.Visible = false; btnFlickr.Visible = false; btnFlickrFav.Visible = false; @@ -811,7 +871,7 @@ btnFlickrSets.Visible = false; btnInterest.Visible = false; btnPicasa.Visible = false; - btnPicasaPhotos.Visible = false; + //btnPicasaPhotos.Visible = false; btnRecent.Visible = false; btnSearchGrp.Visible = false; btnSearchTag.Visible = false; @@ -819,138 +879,209 @@ btnSettings.Visible = false; btnSlide.Visible = false; btnViewAs.Visible = false; + btnBack.Visible = false; + } + protected void SetStateFlickrHome() + { + _CurrentState = State.FLICKR_HOME; + hideAllButtons(); + GUIControl.ClearControl(GetID, facadeView.GetID);; + currentView = View.FILM_STRIP; + ChangeFacadeView(); + btnFlickrFav.Visible = true; + btnFlickrPhotos.Visible = true; + btnFlickrSets.Visible = true; + if (String.IsNullOrEmpty(_CurrentFlickrUser)) + { + btnFlickrFav.Disabled = true; + btnFlickrPhotos.Disabled = true; + btnFlickrSets.Disabled = true; + } + else + { + btnFlickrFav.Disabled = false; + btnFlickrPhotos.Disabled = false; + btnFlickrSets.Disabled = false; + } + btnInterest.Visible = true; + btnRecent.Visible = true; + btnSearchGrp.Visible = true; + btnSearchTag.Visible = true; + btnSearchTxt.Visible = true; + btnBack.Visible = true; + GUIControl.FocusControl(GetID, btnFlickrPhotos.GetID); + } + protected void SetStateFlickrSets() + { + _CurrentState = State.FLICKR_SETS; + if (photoView == View.LIST) + { + currentView = View.FILM_STRIP; + }else{ + currentView = (View)(int)photoView - 1; + } + ChangeFacadeView(); + hideAllButtons(); + btnViewAs.Visible = true; + btnSlide.Visible = true; + btnBack.Visible = true; + this.LooseFocus(); + GUIControl.FocusControl(GetID, btnBack.GetID); + } + protected void SetStateFlickrSetPhotos() + { + _CurrentState = State.FLICKR_SET_PHOTOS; + if (photoView == View.LIST) + { + currentView = View.FILM_STRIP; + }else{ + currentView = (View)(int)photoView - 1; + } + ChangeFacadeView(); + hideAllButtons(); + btnViewAs.Visible = true; + btnSlide.Visible = true; + btnBack.Visible = true; + this.LooseFocus(); + GUIControl.FocusControl(GetID, btnBack.GetID); + } + protected void SetStateFlickrPhotos() + { + _CurrentState = State.FLICKR_PHOTOS; + if (photoView == View.LIST) + { + currentView = View.FILM_STRIP; + }else{ + currentView = (View)(int)photoView - 1; + } + ChangeFacadeView(); + hideAllButtons(); + btnViewAs.Visible = true; + btnSlide.Visible = true; + btnBack.Visible = true; + GUIControl.FocusControl(GetID, btnBack.GetID); + } /* - private void LoadFlickrCategories() - { - GUIControl.ClearControl(GetID, facadeView.GetID); + protected void SetStatePicasaHome() + { + hideAllButtons(); + btnPicasaPhotos.Visible = true; + _CurrentState = State.PICASA_HOME; + } + * */ + protected void SetStatePicasaAlbums() + { + _CurrentState = State.PICASA_ALBUMS; + if (photoView == View.LIST) + { + currentView = View.FILM_STRIP; + }else{ + currentView = (View)(int)photoView - 1; + } + ChangeFacadeView(); + hideAllButtons(); + btnViewAs.Visible = true; + btnSlide.Visible = true; + btnBack.Visible = true; + GUIControl.FocusControl(GetID, btnBack.GetID); + } + protected void SetStatePicasaPhotos() + { + _CurrentState = State.PICASA_PHOTOS; + if (photoView == View.LIST) + { + currentView = View.FILM_STRIP; + }else{ + currentView = (View)(int)photoView - 1; + } + ChangeFacadeView(); + hideAllButtons(); + btnViewAs.Visible = true; + btnSlide.Visible = true; + btnBack.Visible = true; + GUIControl.FocusControl(GetID, btnBack.GetID); + } + #endregion + #region slideshow methods + void OnSlideShow() + { + OnSlideShow(0); + } + void OnSlideShow(int iStartItem) + { + bool doSlide = true; + if (_imagesDone == false) + { + GUIDialogYesNo notify = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO); + notify.SetLine(1, "Photos are still downloading."); + notify.SetLine(2, "Select Yes to slide the downloaded photos."); + notify.DoModal(GetID); + doSlide = notify.IsConfirmed; + } + if (doSlide == false) + { + return; + } + _SlideShow = (GUISlideShow)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW); + if (_SlideShow == null) + return; - GUIListItem loListItem; - loListItem = new GUIListItem(".."); - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - facadeView.Add(loListItem); + _SlideShow.Reset(); - loListItem = new GUIListItem("Interesting Photos"); - loListItem.Path = "1"; - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - facadeView.Add(loListItem); + if ((iStartItem < 0) || (iStartItem > CurrentPhotoList.Count)) + iStartItem = 0; + int i = iStartItem; + do + { + GUIListItem item = facadeView[i]; + if (!item.IsFolder && !item.IsRemote && item.RetrieveArt) + { + _SlideShow.Add(facadeView[i].Path); + } - loListItem = new GUIListItem("Recent Photos"); - loListItem.Path = "2"; - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - facadeView.Add(loListItem); + i++; + if (i >= CurrentPhotoList.Count) + { + i = 0; + } + } + while (i != iStartItem); - loListItem = new GUIListItem("My Photos"); - loListItem.Path = "3"; - loListItem.IsFolder = true; - MediaPortal.Util.Utils.SetDefaultIcons(loListItem); - facadeView.Add(loListItem); + if (_SlideShow.Count > 0) + { + //GUIWindowManager.Callbacks+= new GUIWindowManager.OnCallBackHandler(OnCallBack); + _SlideShow.StartSlideShow(); + _onSlideShow = true; + //GUIWindowManager.Receivers+= new GUIWindowManager.SendMessageHandler(OnSendMessage ); + //Action.ActionType. + GUIWindowManager.ActivateWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW); + } + } + void OnShowPicture(string strFile) + { + _SlideShow = (GUISlideShow)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_SLIDESHOW); + if (_SlideShow == null) + return; - } - * */ - void OnSlideShow() - { - OnSlideShow(0); - ... [truncated message content] |