public void Reorder(IList source, int count) { ArrayListDataSet arrayListDataSet = null; if (source != null) { arrayListDataSet = new ArrayListDataSet(); arrayListDataSet.CopyFrom(source); int newIndex; for (int itemIndex = 0; itemIndex < arrayListDataSet.Count; itemIndex = newIndex + 1) { newIndex = itemIndex; for (int index = itemIndex + 1; index < arrayListDataSet.Count; ++index) { if (this.Comparer.Compare(arrayListDataSet[itemIndex], arrayListDataSet[index]) == 0) { ++newIndex; if (newIndex != index) { arrayListDataSet.Move(index, newIndex); } } } } } if (this.Source is ArrayListDataSet) { ((ModelItem)this.Source).Dispose(); } this.SetSource(arrayListDataSet, count); }
//I don't think this is used any more, but I need to check public VideoItems(string query, int maxItems = 24, int startItem = 0, bool search = false) { m_Choice = new Choice(); List = new ArrayListDataSet(); string data; //if (search) //{ // data = AmazonVideoRequest.searchPrime(query, maxItems, startItem); //} //else //{ // data = AmazonVideoRequest.getVideoItemsWithQuery(query, maxItems, startItem); //} data = AmazonVideoRequest.ExecuteQuery(query); JsonTextReader reader = new JsonTextReader(new StringReader(data)); JObject titles = JObject.Parse(data); foreach (JObject node in titles["message"]["body"]["titles"]) { List.Add(new VideoItem(node)); } m_Choice.Options = List; }
//private void SetupStartMenu() //{ // this.helper = new StartMenuHelper(); // this.helper.Changed += new ChangedEventHandler(helper_Changed); // this.LoadArray(); //} private void LoadArray() { this.startMenuArray = new ArrayListDataSet(); foreach (StartMenuItem entryPoint in helper.StartMenuItems) { StartMenuCommand cmd = new StartMenuCommand(this, this.helper, entryPoint); cmd.Description = entryPoint.Title; cmd.Invoked += delegate(object Sender, EventArgs Args) { if (Sender is StartMenuCommand) { string strDelete = string.Format("Are you sure you want to delete {0}?", ((StartMenuCommand)Sender).Name); DialogResult res = OMLApplication.Current.MediaCenterEnvironment.Dialog(strDelete, "DELETE ITEM", DialogButtons.Yes | DialogButtons.No, -1, true); if (res == DialogResult.Yes) { this.helper.DeleteStartMenuItem(((StartMenuCommand)Sender).EntryPoint); } } }; this.startMenuArray.Add(cmd); Guid entryPointGuid = new Guid(entryPoint.ItemId); bool isregistered = AddInHost.Current.ApplicationContext.IsEntryPointRegistered(entryPointGuid); } FirePropertyChanged("StartMenuArray"); }
public void GetNetworkListDone(bool success) { if (this.WirelessUnblockPage()) { return; } WlanProfileList networkList = this.wirelessGetNetworkListHelper.NetworkList; ArrayListDataSet arrayListDataSet = new ArrayListDataSet(); if (success && networkList != null) { foreach (WlanProfile profile in networkList) { arrayListDataSet.Add(new WlanCommand(profile)); } } if (!success) { if (string.IsNullOrEmpty(this.wirelessDeviceErrorDescription)) { this.wirelessDeviceErrorDescription = this.wirelessGetNetworkListHelper.Error; } if (this.wirelessDeviceErrorCode == HRESULT._S_OK) { this.wirelessDeviceErrorCode = this.wirelessGetNetworkListHelper.Hr; } } this.WirelessNetworksList = arrayListDataSet; }
private void updateDiscArray() { ArrayListDataSet discArray = new ArrayListDataSet(); if (OMLApplication.Current.MediaChangers.HasMediaChangers) { foreach (DiscDataEx disc in OMLApplication.Current.MediaChangers.KnownDiscs) { DiscCommand discItem = new DiscCommand(this); discItem.Description = disc.VolumeLabel; discItem.Disc = disc; if (!string.IsNullOrEmpty(disc.Title)) { discItem.Description = disc.Title; } discItem.Invoked += delegate(object discSender, EventArgs discArgs) { if (discSender is DiscCommand) { ((DiscCommand)discSender).Disc.Eject(); } }; discArray.Add(discItem); } } this.DiscArray = discArray; }
/// <summary> /// Construct a DownloadsPage object. This is carried out by the Application /// because the downloads page is global and not owned by any single /// Experience. /// NOTE: This is public to enable debug markup access. /// </summary> public DownloadsPage CreateDownloadsPage() { DownloadsPage page = new DownloadsPage(); page.Description = Z.Resources.Downloads; // // Create one filter for each experience and one global "All" // filter that indicates all experiences. // ArrayListDataSet filters = new ArrayListDataSet(page); filters.Add(new DownloadFilter(page, "All", ActiveDownloads)); foreach (ApplicationExperience experience in experiences) { filters.Add(CreateDownloadPageFilter(page, experience)); } Choice filtersChoice = new Choice(page, null, filters); // Default to having "All" as the current filter filtersChoice.ChosenIndex = 0; page.Filters = filtersChoice; return(page); }
public AboutSettings() { System.Resources.ResourceManager RM = new System.Resources.ResourceManager("Library.Resources", System.Reflection.Assembly.GetExecutingAssembly()); string creditsString = (string)RM.GetObject("Credits"); byte[] byteArray = Encoding.ASCII.GetBytes(creditsString); MemoryStream stream = new MemoryStream(byteArray); //XmlTextReader reader = new XmlTextReader(stream); XmlDocument xDoc = new XmlDocument(); xDoc.Load(stream); XPathNavigator nav = xDoc.CreateNavigator(); XPathNodeIterator it = nav.Select("Credits/Developers/Person"); this.CreditsText = "DEVELOPMENT TEAM:"; while (it.MoveNext()) { this.CreditsText += "\n" + it.Current.Value; } this.CreditsText += "\n\n"; it = nav.Select("Credits/Contributors/Person"); this.CreditsText += "COMPANIES AND INDIVIDUALS:"; while (it.MoveNext()) { this.CreditsText += "\n" + it.Current.Value; } this.CreditsText += "\n\n"; it = nav.Select("Credits/Special/Person"); this.CreditsText += "SPECIAL THANKS:"; while (it.MoveNext()) { this.CreditsText += "\n" + it.Current.Value; } string version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); this.AboutText = "Open Media Library (replace with image)\n\nVersion: " + version + " (Revision: " + OMLApplication.Current.RevisionNumber + ")"; this.AboutText += "\nCopyright © 2008, GNU General Public License v3"; this.radioCommands = new Choice(this); ArrayListDataSet radioSet = new ArrayListDataSet(); Command aboutCmd = new Command(this); aboutCmd.Description = "About"; radioSet.Add(aboutCmd); Command creditsCmd = new Command(this); creditsCmd.Description = "Credits"; radioSet.Add(creditsCmd); //this.CreditsText = "this is a credit"; this.radioCommands.Options = radioSet; this.radioCommands.ChosenChanged += new EventHandler(radioCommands_ChosenChanged); }
public EnormoList(ArrayListDataSet internalSet) { this.internalArray = internalSet; VisualReleaseBehavior = ReleaseBehavior.KeepReference; EnableSlowDataRequests = false; this.StoreQueryResults = true; this.Count = internalArray.Count; }
public BuddyViewer(HistoryOrientedPageSession session, AddInHost host) { this.session = session; this.host = host; _status = RunningStatus.Stopped; _jobslist = new ArrayListDataSet(this); MCEBuddyConf.GlobalMCEConfig = new MCEBuddyConf(); // Initialize with default parameters for now, we will get the config file from the server and then re-initialize (don't use null as it keeps accessing win.ini) - this is never written to a file (just a memory object) }
public PrimeFinder() { _status = RunningStatus.Stopped; _primes = new ArrayListDataSet(this); _stopwatch = new Stopwatch(); DetermineInitialCandidate(); }
private CDAccess() { this._CDs = new ArrayListDataSet(); if (!s_phase2Complete) { return; } this.Initialize(); }
public Category(string sName, string sQuery, Category oParent, int iIndex) { Name = sName; mQuery = sQuery; Parent = oParent; Index = iIndex; m_Choice = new Choice(); List = new ArrayListDataSet(); }
public Category() { Name = ""; mQuery = ""; Index = 0; mSetFocus = false; m_Choice = new Choice(); List = new ArrayListDataSet(); }
public AboutSettings() { System.Resources.ResourceManager RM = new System.Resources.ResourceManager("Library.Resources",System.Reflection.Assembly.GetExecutingAssembly()); string creditsString = (string)RM.GetObject("Credits"); byte[] byteArray = Encoding.ASCII.GetBytes(creditsString); MemoryStream stream = new MemoryStream(byteArray); //XmlTextReader reader = new XmlTextReader(stream); XmlDocument xDoc = new XmlDocument(); xDoc.Load(stream); XPathNavigator nav = xDoc.CreateNavigator(); XPathNodeIterator it = nav.Select("Credits/Developers/Person"); this.CreditsText = "DEVELOPMENT TEAM:"; while (it.MoveNext()) { this.CreditsText += "\n" + it.Current.Value; } this.CreditsText += "\n\n"; it = nav.Select("Credits/Contributors/Person"); this.CreditsText += "COMPANIES AND INDIVIDUALS:"; while (it.MoveNext()) { this.CreditsText += "\n" + it.Current.Value; } this.CreditsText += "\n\n"; it = nav.Select("Credits/Special/Person"); this.CreditsText += "SPECIAL THANKS:"; while (it.MoveNext()) { this.CreditsText += "\n" + it.Current.Value; } string version=Assembly.GetExecutingAssembly().GetName().Version.ToString(); this.AboutText = "Open Media Library (replace with image)\n\nVersion: " + version + " (Revision: " + OMLApplication.Current.RevisionNumber+")"; this.AboutText += "\nCopyright © 2008, GNU General Public License v3"; this.radioCommands = new Choice(this); ArrayListDataSet radioSet = new ArrayListDataSet(); Command aboutCmd=new Command(this); aboutCmd.Description="About"; radioSet.Add(aboutCmd); Command creditsCmd = new Command(this); creditsCmd.Description = "Credits"; radioSet.Add(creditsCmd); //this.CreditsText = "this is a credit"; this.radioCommands.Options = radioSet; this.radioCommands.ChosenChanged += new EventHandler(radioCommands_ChosenChanged); }
public VideoItems() { m_Choice = new Choice(); List = new ArrayListDataSet(); string junk = "test"; //workaround to add list without crashing //this is a known issue - if you bind an empty list to a choice, it crashes. List.Add(junk); m_Choice.Options = List; List.Clear(); }
public Application(HistoryOrientedPageSession session, AddInHost host) { this.session = session; this.host = host; _myData = new ArrayListDataSet(); var list = GetFeedList(); foreach (var radio in list) { _myData.Add(radio); } }
/// <summary> /// Creat the filters on the gallery. /// </summary> private void CreateShowGalleryFilters(GalleryPage page) { // // Put together a list of filters on the content. // ArrayListDataSet list = new ArrayListDataSet(page); // Create the unfiltered "All" filter ModelItem filterAll = new Filter(page, Z.Resources.TV_Filter_All, -1); list.Add(filterAll); // Get the rest of the filters out of the genre list. DataTable tbl_TV_Genre = dataSet.Tables["tbl_TV_Genre"]; foreach (DataRow genreData in tbl_TV_Genre.Rows) { string genreName = (string)genreData["TV_Genre"]; int genreId = (int)genreData["TV_Genre_ID"]; ModelItem filter = new Filter(page, genreName, genreId); list.Add(filter); } // FUTURE: There's information in the data table for us to implement // a "featured" filter. Its implementation would go here. Choice filters = new Choice(page, null, list); filters.Chosen = filterAll; // // Hook up the "filter changed" event so that we can apply the // active filter to our gallery. // // As soon as this Filters list is set, we will get an OnActiveFilterChanged // event which will cause us to populate the gallery. // page.ActiveFilterChanged += delegate(object sender, EventArgs e) { GalleryPage galleryPage = (GalleryPage)sender; Filter activeFilter = (Filter)galleryPage.Filters.Chosen; FilterContent(galleryPage, activeFilter.FilterId); }; page.Filters = filters; }
public ArrayListDataSet GetTrailersForUrl(string url) { try { WebClient client = new WebClient(); Stream strm = client.OpenRead(url); StreamReader sr = new StreamReader(strm); string strXml = sr.ReadToEnd(); XmlDocument xDoc = new XmlDocument(); xDoc.LoadXml(strXml); ArrayListDataSet trailers = ParseDocument(xDoc); return(trailers); } catch { } return(null); }
// // Called to dispose this model item - call Stop // to make sure our background search exits. // protected override void Dispose(bool fDispose) { base.Dispose(fDispose); if (fDispose) { Stop(); if (_pipeProxy != null) { _pipeProxy = null; } if (_jobslist != null) { _jobslist.Dispose(); _jobslist = null; } _exit = true; } }
/// <summary> /// Construct a SearchPage object. This is carried out by the Application /// because the search page is global and not owned by any single /// Experience. /// NOTE: This is public to enable debug markup access. /// </summary> public SearchPage CreateSearchPage() { SearchPage page = new SearchPage(); page.Description = Z.Resources.Search; page.Content = new VirtualList(); // // Create one on/off filter for each experience. // ArrayListDataSet filters = new ArrayListDataSet(page); foreach (ApplicationExperience experience in experiences) { filters.Add(CreateSearchPageFilter(page, experience)); } page.Filters = filters; return(page); }
private ArrayListDataSet ParseDocument(XmlDocument xDoc) { ArrayListDataSet trailers = new ArrayListDataSet(); XPathNavigator nav = xDoc.CreateNavigator(); if (nav.MoveToChild("records", "")) { XPathNodeIterator nIter = nav.SelectChildren("movieinfo", ""); nav.MoveToFirstChild(); XPathNavigator localNav = nav.CreateNavigator(); nav.MoveToParent(); for (int i = 0; i < nIter.Count; i++) { AppleTrailer currentTrailer = new AppleTrailer(); if (localNav.MoveToChild("info", "")) { currentTrailer.Copyright = GetChildNodesValue(localNav, "copyright"); currentTrailer.description = GetChildNodesValue(localNav, "description"); currentTrailer.Director = GetChildNodesValue(localNav, "director"); currentTrailer.Postdate = GetChildNodesValue(localNav, "postdate"); currentTrailer.Rating = GetChildNodesValue(localNav, "rating"); currentTrailer.ReleaseDate = GetChildNodesValue(localNav, "releasedate"); currentTrailer.Runtime = GetChildNodesValue(localNav, "runtime"); currentTrailer.Studio = GetChildNodesValue(localNav, "studio"); currentTrailer.Title = GetChildNodesValue(localNav, "title"); localNav.MoveToParent(); } if (localNav.MoveToChild("cast", "")) { XPathNodeIterator castIter = localNav.SelectChildren("name", ""); if (localNav.MoveToFirstChild()) { XPathNavigator castNav = localNav.CreateNavigator(); for (int j = 0; j < castIter.Count; j++) { currentTrailer.Actors.Add(castNav.Value); castNav.MoveToNext("name", ""); } localNav.MoveToParent(); } localNav.MoveToParent(); } if (localNav.MoveToChild("genre", "")) { XPathNodeIterator genreIter = localNav.SelectChildren("name", ""); if (localNav.MoveToFirstChild()) { XPathNavigator genreNav = localNav.CreateNavigator(); for (int k = 0; k < genreIter.Count; k++) { currentTrailer.Genres.Add(genreNav.Value); genreNav.MoveToNext("name", ""); } localNav.MoveToParent(); } localNav.MoveToParent(); } if (localNav.MoveToChild("poster", "")) { if (localNav.MoveToChild("location", "")) { currentTrailer.PosterUrl = localNav.Value; localNav.MoveToParent(); } if (localNav.MoveToChild("xlarge", "")) { currentTrailer.XLargePosterUrl = localNav.Value; localNav.MoveToParent(); } localNav.MoveToParent(); } if (localNav.MoveToChild("preview", "")) { if (localNav.MoveToChild(XPathNodeType.Element)) { currentTrailer.TrailerUrl = localNav.Value; currentTrailer.Filesize = localNav.GetAttribute("filesize", ""); localNav.MoveToParent(); } localNav.MoveToParent(); } trailers.Add(currentTrailer); localNav.MoveToNext(); } } return(trailers); }
private void SetupFilters() { //"Genres", //"Directors", //"Actors", //"Runtime", //"Country", //"Parental Rating", //"Tags", //"User Rating", //"Year", //"Date Added", //"Format", //"Trailers" this.filtersArray = new ArrayListDataSet(); this._showFilterUnwatched.Chosen = OMLSettings.ShowFilterUnwatched; this._showFilterUnwatched.Description = "Unwatched"; this.filtersArray.Add(this._showFilterUnwatched); this._showFilterActors.Chosen = OMLSettings.ShowFilterActors; this._showFilterActors.Description = "Actors"; this.filtersArray.Add(this._showFilterActors); this._showFilterCountry.Chosen = OMLSettings.ShowFilterCountry; this._showFilterCountry.Description = "Country"; this.filtersArray.Add(this._showFilterCountry); this._showFilterDateAdded.Chosen = OMLSettings.ShowFilterDateAdded; this._showFilterDateAdded.Description = "Date Added"; this.filtersArray.Add(this._showFilterDateAdded); this._showFilterDirectors.Chosen = OMLSettings.ShowFilterDirectors; this._showFilterDirectors.Description = "Directors"; this.filtersArray.Add(this._showFilterDirectors); this._showFilterFormat.Chosen = OMLSettings.ShowFilterFormat; this._showFilterFormat.Description = "Format"; this.filtersArray.Add(this._showFilterFormat); this._showFilterGenres.Chosen = OMLSettings.ShowFilterGenres; this._showFilterGenres.Description = "Genres"; this.filtersArray.Add(this._showFilterGenres); this._showFilterParentalRating.Chosen = OMLSettings.ShowFilterParentalRating; this._showFilterParentalRating.Description = "Parental Rating"; this.filtersArray.Add(this._showFilterParentalRating); this._showFilterRuntime.Chosen = OMLSettings.ShowFilterRuntime; this._showFilterRuntime.Description = "Runtime"; this.filtersArray.Add(this._showFilterRuntime); this._showFilterTags.Chosen = OMLSettings.ShowFilterTags; this._showFilterTags.Description = "Tags"; this.filtersArray.Add(this._showFilterTags); this._showFilterUserRating.Chosen = OMLSettings.ShowFilterUserRating; this._showFilterUserRating.Description = "User Rating"; this.filtersArray.Add(this._showFilterUserRating); this._showFilterYear.Chosen = OMLSettings.ShowFilterYear; this._showFilterYear.Description = "Year"; this.filtersArray.Add(this._showFilterYear); //this._showFilterTrailers.Chosen = OMLSettings.ShowFilterTrailers; //this._showFilterTrailers.Description = "Trailers"; //this.filtersArray.Add(this._showFilterTrailers); }
private void updateDiscArray() { ArrayListDataSet discArray = new ArrayListDataSet(); if (OMLApplication.Current.MediaChangers.HasMediaChangers) { foreach (DiscDataEx disc in OMLApplication.Current.MediaChangers.KnownDiscs) { DiscCommand discItem = new DiscCommand(this); discItem.Description = disc.VolumeLabel; discItem.Disc = disc; if (!string.IsNullOrEmpty(disc.Title)) discItem.Description = disc.Title; discItem.Invoked += delegate(object discSender, EventArgs discArgs) { if (discSender is DiscCommand) { ((DiscCommand)discSender).Disc.Eject(); } }; discArray.Add(discItem); } } this.DiscArray = discArray; }
public MediaChangerManagerPage() { this.managerCommands = new ArrayListDataSet(this); //save command Command rescanCmd = new Command(); rescanCmd.Description = "Rescan Discs"; rescanCmd.Invoked += new EventHandler(rescanCmd_Invoked); this.managerCommands.Add(rescanCmd); this.sortCommands = new Choice(this); ArrayListDataSet sortSet = new ArrayListDataSet(); Command sortByName=new Command(this); sortByName.Description="Sort by Name"; sortSet.Add(sortByName); Command sortByType = new Command(this); sortByType.Description = "Sort by Type"; sortSet.Add(sortByType); this.sortCommands.Options = sortSet; this.SortCommands.ChosenChanged += new EventHandler(SortCommands_ChosenChanged); this.enableMediaChangers = new BooleanChoice(this, "Enable support for media changers"); this.enableMediaChangers.Value = Properties.Settings.Default.MediaChangersEnabled; this.detectMediaChangers = new BooleanChoice(this, "Detect new discs added to your changer"); this.detectMediaChangers.Value = Properties.Settings.Default.MediaChangersDetect; this.retrieveMetaData = new BooleanChoice(this, "Retrieve MetaData from Microsoft"); this.retrieveMetaData.Value = Properties.Settings.Default.MediaChangersRetrieveMetaData; this.manageChangers = new Command(this); this.manageChangers.Description = "Manage Discs"; this.manageChangers.Invoked += delegate(object changerSender, EventArgs changerArgs) { Dictionary<string, object> manageProperties = new Dictionary<string, object>(); manageProperties["Page"] = this; manageProperties["Application"] = Library.OMLApplication.Current; Library.OMLApplication.Current.Session.GoToPage("resx://Library/Library.Resources/V3_MediaChangerManagerPage", manageProperties); }; this.commands = new ArrayListDataSet(this); //save command Command saveCmd = new Command(); saveCmd.Description = "Save"; saveCmd.Invoked += new EventHandler(saveCmd_Invoked); this.commands.Add(saveCmd); //cancel command Command cancelCmd = new Command(); cancelCmd.Description = "Cancel"; cancelCmd.Invoked += new EventHandler(cancelCmd_Invoked); this.commands.Add(cancelCmd); this.discArray = new ArrayListDataSet(); if (OMLApplication.Current.MediaChangers.HasMediaChangers) { foreach (DiscDataEx disc in OMLApplication.Current.MediaChangers.KnownDiscs) { DiscCommand discItem = new DiscCommand(this); discItem.Description = disc.VolumeLabel; discItem.Disc = disc; if (!string.IsNullOrEmpty(disc.Title)) discItem.Description = disc.Title; discItem.Invoked += delegate(object discSender, EventArgs discArgs) { if(discSender is DiscCommand) { this.IsBusy = true; Microsoft.MediaCenter.UI.Application.DeferredInvokeOnWorkerThread(beginEject, endEject, (object)discSender); //((DiscCommand)discSender).Disc.Eject(); //this.updateDiscArray(); } }; this.discArray.Add(discItem); } } this.DiscManagerSort = DiscManagerSortType.Name; this.SortList(); //for (int i = 0; i < 20; ++i) //{ // Command c = new Command(this); // c.Description = string.Format("This is a very long description of a Test Disc {0}", i.ToString()); // this.discArray.Add(c); //} this.DetermineShowErrorMessage(); }
public MediaChangerManagerPage() { this.managerCommands = new ArrayListDataSet(this); //save command Command rescanCmd = new Command(); rescanCmd.Description = "Rescan Discs"; rescanCmd.Invoked += new EventHandler(rescanCmd_Invoked); this.managerCommands.Add(rescanCmd); this.sortCommands = new Choice(this); ArrayListDataSet sortSet = new ArrayListDataSet(); Command sortByName = new Command(this); sortByName.Description = "Sort by Name"; sortSet.Add(sortByName); Command sortByType = new Command(this); sortByType.Description = "Sort by Type"; sortSet.Add(sortByType); this.sortCommands.Options = sortSet; this.SortCommands.ChosenChanged += new EventHandler(SortCommands_ChosenChanged); this.enableMediaChangers = new BooleanChoice(this, "Enable support for media changers"); this.enableMediaChangers.Value = Properties.Settings.Default.MediaChangersEnabled; this.detectMediaChangers = new BooleanChoice(this, "Detect new discs added to your changer"); this.detectMediaChangers.Value = Properties.Settings.Default.MediaChangersDetect; this.retrieveMetaData = new BooleanChoice(this, "Retrieve MetaData from Microsoft"); this.retrieveMetaData.Value = Properties.Settings.Default.MediaChangersRetrieveMetaData; this.manageChangers = new Command(this); this.manageChangers.Description = "Manage Discs"; this.manageChangers.Invoked += delegate(object changerSender, EventArgs changerArgs) { Dictionary <string, object> manageProperties = new Dictionary <string, object>(); manageProperties["Page"] = this; manageProperties["Application"] = Library.OMLApplication.Current; Library.OMLApplication.Current.Session.GoToPage("resx://Library/Library.Resources/V3_MediaChangerManagerPage", manageProperties); }; this.commands = new ArrayListDataSet(this); //save command Command saveCmd = new Command(); saveCmd.Description = "Save"; saveCmd.Invoked += new EventHandler(saveCmd_Invoked); this.commands.Add(saveCmd); //cancel command Command cancelCmd = new Command(); cancelCmd.Description = "Cancel"; cancelCmd.Invoked += new EventHandler(cancelCmd_Invoked); this.commands.Add(cancelCmd); this.discArray = new ArrayListDataSet(); if (OMLApplication.Current.MediaChangers.HasMediaChangers) { foreach (DiscDataEx disc in OMLApplication.Current.MediaChangers.KnownDiscs) { DiscCommand discItem = new DiscCommand(this); discItem.Description = disc.VolumeLabel; discItem.Disc = disc; if (!string.IsNullOrEmpty(disc.Title)) { discItem.Description = disc.Title; } discItem.Invoked += delegate(object discSender, EventArgs discArgs) { if (discSender is DiscCommand) { this.IsBusy = true; Microsoft.MediaCenter.UI.Application.DeferredInvokeOnWorkerThread(beginEject, endEject, (object)discSender); //((DiscCommand)discSender).Disc.Eject(); //this.updateDiscArray(); } }; this.discArray.Add(discItem); } } this.DiscManagerSort = DiscManagerSortType.Name; this.SortList(); //for (int i = 0; i < 20; ++i) //{ // Command c = new Command(this); // c.Description = string.Format("This is a very long description of a Test Disc {0}", i.ToString()); // this.discArray.Add(c); //} this.DetermineShowErrorMessage(); }
/// <summary> /// Gets an amount of tracks from the current track list. The result is received through an asynchronous callback. /// </summary> /// <param name="startIndex">The start index of the current track list.</param> /// <param name="count">The track count (0 for all tracks).</param> /// <param name="callback">The callback when the track data arrives.</param> /// <exception cref="System.ArgumentOutOfRangeException"/> /// <exception cref="System.ArgumentNullException"/> /// <exception cref="System.IndexOutOfRangeException"/> /// <seealso cref="TrackListChanged"/> /// <seealso cref="MAX_TRACKS"/> public void GetTracks(int startIndex, int count, TrackListCallback callback) { if (startIndex < 0) throw new ArgumentOutOfRangeException("startIndex", startIndex, "The start index must be >= 0!"); if (count < 0) throw new ArgumentOutOfRangeException("count", count, "Count must be >= 0!"); if (callback == null) throw new ArgumentNullException("callback"); if (!IsReady || !TransportControls.Instance.HasPlaylist) return; Application.DeferredInvoke(new DeferredInvokeHandler(delegate(object sender) { // Make a local copy of the playlist to avoid race conditions ArrayListDataSet playlist = new ArrayListDataSet(); playlist.CopyFrom(TransportControls.Instance.CurrentPlaylist); if (playlist == null) return; if (count == 0) count = playlist.Count - startIndex; if (count > ZuneApi.MAX_TRACKS) count = ZuneApi.MAX_TRACKS; if (startIndex + count > playlist.Count) throw new IndexOutOfRangeException("Start index (" + startIndex + ") + count (" + count + ") must be <= TrackCount (" + playlist.Count + ")!"); Track[] tracks = new Track[count]; for (int i = 0; i < count; i++) { int playlistIndex = i + startIndex; object playlistItem = playlist[playlistIndex]; if (playlistItem is PlaybackTrack) tracks[i] = new Track((PlaybackTrack)playlistItem, playlistIndex); else tracks[i] = new Track(); } callback(tracks); }), DeferredInvokePriority.Low); // low priority to save performance }
public void Init(Settings settings) { _settings = settings; _ChoiceGalleryAdvancedSettingsItems = new Choice(); ArrayListDataSet aryListDS = new ArrayListDataSet(); aryListDS.Add(new SettingsItem(0, _settings.DimUnselectedCovers, "Dim Unselected Covers", false)); aryListDS.Add(new SettingsItem(0, _settings.UseOnScreenAlpha, "Show Alpha Jump Bar", false)); aryListDS.Add(new SettingsItem(0, _settings.ShowMovieDetails, "Show Movie Details", false)); aryListDS.Add(new SettingsItem(0, _settings.ShowWatchedIcon, "Show Watched Icon", false)); aryListDS.Add(new SettingsItem(0, _settings.UseOriginalCoverArt, "Use Original Cover Art(may slow browsing)", true)); aryListDS.Add(new SettingsItem(1, _settings.CoverArtRows, "Cover Art Rows:", false)); aryListDS.Add(new SettingsItem(1, _settings.CoverArtSpacing, "Cover Art Spacing:", true)); aryListDS.Add(new SettingsItem(1, _settings.MainPageBackDropInterval, "Random Backdrop Interval:", false)); aryListDS.Add(new SettingsItem(3, _settings.MainPageBackDropAlpha, "Backdrop Opacity:", true)); _ChoiceGalleryAdvancedSettingsItems.Options = aryListDS; _ChoiceGalleryViewSettingsItems = new Choice(); ArrayListDataSet aryListDS2 = new ArrayListDataSet(); aryListDS2.Add(new SettingsItem(2, _settings.MovieView, "Movie Gallery View:", false)); aryListDS2.Add(new SettingsItem(2, _settings.MovieSort, "Movie Sort:", false)); aryListDS2.Add(new SettingsItem(2, _settings.StartPage, "Start Page:", false)); _ChoiceGalleryViewSettingsItems.Options = aryListDS2; _ChoiceFilterOptions = new Choice(); ArrayListDataSet aryListDS3 = new ArrayListDataSet(); aryListDS3.Add(new CheckBox(_settings.ShowFilterActors, "Actors")); aryListDS3.Add(new CheckBox(_settings.ShowFilterCountry, "Country")); aryListDS3.Add(new CheckBox(_settings.ShowFilterDateAdded, "Date Added")); aryListDS3.Add(new CheckBox(_settings.ShowFilterDirectors, "Directors")); aryListDS3.Add(new CheckBox(_settings.ShowFilterGenres, "Genres")); aryListDS3.Add(new CheckBox(_settings.ShowFilterParentalRating, "Parental Rating")); aryListDS3.Add(new CheckBox(_settings.ShowFilterYear, "Release Year")); aryListDS3.Add(new CheckBox(_settings.ShowFilterRuntime, "Runtime")); aryListDS3.Add(new CheckBox(_settings.ShowFilterTags, "Tags")); aryListDS3.Add(new CheckBox(_settings.ShowFilterTrailers, "Trailers")); aryListDS3.Add(new CheckBox(_settings.ShowFilterUserRating, "User Rating")); aryListDS3.Add(new CheckBox(_settings.ShowFilterUnwatched, "Unwatched")); aryListDS3.Add(new CheckBox(_settings.ShowFilterFormat, "Video Format")); _ChoiceFilterOptions.Options = aryListDS3; _ChoiceExtenderSettingsItems = new Choice(); ArrayListDataSet aryListDS4 = new ArrayListDataSet(); aryListDS4.Add(new SettingsItem(4, _settings.ImpersonationUsername, "Impersonation Username:"******"Impersonation Password:"******"Number Of Seconds To Delay:", true)); aryListDS4.Add(new SettingsItem(0, _settings.TranscodeAVIFiles, "Transcode AVI Files", false)); aryListDS4.Add(new SettingsItem(0, _settings.TranscodeMKVFiles, "Transcode MKV Files", false)); aryListDS4.Add(new SettingsItem(0, _settings.TranscodeOGMFiles, "Transcode OGM Files", false)); aryListDS4.Add(new SettingsItem(0, _settings.PreserveAudioOnTranscode, "Preserve audio format on transcode of non DVD files", false)); aryListDS4.Add(new SettingsItem(0, _settings.DebugTranscoding, "Transcode ALL DVDs (DEBUG Only)", false)); _ChoiceExtenderSettingsItems.Options = aryListDS4; }
public WeatherModel() { if (Configuration.Instance.IsValid() == true) { _weatherApiKey = Configuration.Instance.ApiKey; _weatherLocationCode = Configuration.Instance.LocationCode; _weatherUnit = Configuration.Instance.WeatherUnit.GetValueOrDefault(WeatherUnit.Imperial); _weatherClockTimeFormat = Configuration.Instance.ClockTimeFormat.GetValueOrDefault(ClockTimeFormat.Hours12); _weatherRefreshRateInMinutes = Configuration.Instance.RefreshRateInMinutes.GetValueOrDefault(10); _weatherLanguage = Configuration.Instance.Language.GetValueOrDefault(Language.EN); } // set the correct language for the UI thread System.Threading.Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(Enum.GetName(typeof(Language), Configuration.Instance.Language)); _weatherFileName = String.Format(Configuration.Instance.WeatherFileNamePattern, _weatherLocationCode, _weatherLanguage); _weatherFileName = _weatherFileName.Replace(":", "."); // small cleanup is needed for zmw location codes _weatherFileLocation = Path.Combine(Configuration.Instance.ConfigFileFolder, _weatherFileName); _weatherApiAddress = String.Format(Configuration.Instance.ApiUrlPattern, _weatherApiKey, _weatherLanguage, _weatherLocationCode); _xmlWeatherData = new XmlDocument(); _dailyForecast = new ArrayListDataSet(); _hourlyForecast = new ArrayListDataSet(); _uiRefreshNeeded = true; _isLoaded = false; // refresh timer if (_weatherRefreshTimer == null) { _weatherRefreshTimer = new Timer(this); _weatherRefreshTimer.Interval = 10000; // 10 seconds interval _weatherRefreshTimer.Tick += delegate { LoadWeatherData(); }; } }
public void Launch(AddInHost host) { WriteDebugMessage("Launch"); this.host = host; if (host != null && host.ApplicationContext != null) { WriteDebugMessage("Set SingleInstance = True"); host.ApplicationContext.SingleInstance = true; } // List out the capabilities to the debug window. Dictionary <string, object> capabilities = host.MediaCenterEnvironment.Capabilities; try { foreach (KeyValuePair <string, object> kvp in capabilities) { WriteDebugMessage(String.Format("{0}{1} = {2}", "Capability: ", kvp.Key, kvp.Value)); } } catch (Exception ex) { WriteExceptionDebugMessage(ex); } session = new HistoryOrientedPageSession(); Categories = new ArrayListDataSet(); Samples = new ArrayListDataSet(); publicDocumentsPath = GetPath(KnownFolder.PublicDocuments); SetInstallationFolder(); SetPaths(); SetLocalContent(); SetDataFile(); LoadDataAndCategories(); Dictionary <string, object> props = new Dictionary <string, object>(); props.Add("Session", session); props.Add("Categories", Categories); props.Add("Sampler", this); automationfile = publicDocumentsPath + @"\" + samplerAutomationFile; KeepCurrentOnBackstack = true; // Look to see if we have a file which tells us to load a specific example. // If so, go there. switch (id) { case "{7f1e2adf-5006-44fb-8f3d-095e635ab443}": // Launched from Extras Library (More Programs) WriteDebugMessage("Launched from Extras Library"); if (NavigateFromAutomationFile()) { break; } // Else failed to navigate to sample, so fall through for default navigate // Go to the default page for the application. session.GoToPage("resx://Sampler/Sampler.Resources/Default", props); WriteDebugMessage("GoToDefaultPage"); break; case "{7b42c522-ac1e-4eff-b60b-0e01208551cc}": WriteDebugMessage("Launched from More With This.Audio.Album"); LaunchMoreWithThis(props, "resx://Sampler/Sampler.Resources/ObjectModelMediaCenterAddInHostMediaContextAlbum"); break; case "{5f51f6cd-7bd9-48d2-a016-c8dd7b1e82c3}": WriteDebugMessage("Launched from More With This.Audio.Artist"); LaunchMoreWithThis(props, "resx://Sampler/Sampler.Resources/ObjectModelMediaCenterAddInHostMediaContextArtist"); break; case "{084c6878-b10b-4453-a707-8025fc2cad77}": WriteDebugMessage("Launched from More With This.Audio.Genre"); LaunchMoreWithThis(props, "resx://Sampler/Sampler.Resources/ObjectModelMediaCenterAddInHostMediaContextGenre"); break; case "{e90d1b82-2d5d-4916-8022-52b5c994aa1b}": WriteDebugMessage("Launched from More With This.Audio.Playlist"); LaunchMoreWithThis(props, "resx://Sampler/Sampler.Resources/ObjectModelMediaCenterAddInHostMediaContextPlaylist"); break; case "{f06c05c0-7f5a-471a-8560-a35fa243b72e}": WriteDebugMessage("Launched from More With This.Audio.Song"); LaunchMoreWithThis(props, "resx://Sampler/Sampler.Resources/ObjectModelMediaCenterAddInHostMediaContextSong"); break; case "{37cc3cf8-c2b9-4da0-aa95-2aac0f37d393}": WriteDebugMessage("Launched from More With This.Picture"); LaunchMoreWithThis(props, "resx://Sampler/Sampler.Resources/ObjectModelMediaCenterAddInHostMediaContextPicture"); break; case "{9608152f-4996-4928-9a34-8115d893971e}": WriteDebugMessage("Launched from More With This.Video"); LaunchMoreWithThis(props, "resx://Sampler/Sampler.Resources/ObjectModelMediaCenterAddInHostMediaContextVideo"); break; case "{fb69d092-51c7-4a6d-8f87-5b12d1d88c42}": WriteDebugMessage("Launched from More With This.DVD"); LaunchMoreWithThis(props, "resx://Sampler/Sampler.Resources/ObjectModelMediaCenterAddInHostMediaContextDVD"); break; case "{33c6fd2f-a538-4604-8242-ce57e6724427}": WriteDebugMessage("Launched from More With This.TV"); LaunchMoreWithThis(props, "resx://Sampler/Sampler.Resources/ObjectModelMediaCenterAddInHostMediaContextTV"); break; } SetupWatcher(); WriteDebugMessage("Launch Complete"); }
public void Test() { RemoteResourceUri RRU = new RemoteResourceUri(); RRU.Uri = new Uri("http://www.cellartracker.com/api_read.asp"); Dictionary <string, string> Querys = new Dictionary <string, string>(); Querys.Add("user", "gt1485a"); Querys.Add("password", "Darwin1"); Querys.Add("API", "list"); Querys.Add("Format", "XML"); Querys.Add("Page", "1"); Querys.Add("Records", "2"); RRU.QueryPairs = Querys; XRR = new XmlRemoteResource(); XRR.PropertyChanged += new PropertyChangedEventHandler(XRR_PropertyChanged); XRR.RequestUri = RRU; XmlRemoteValueList Wines = new XmlRemoteValueList(); Wines.Source = "//row"; XmlRemoteValue Vintage = new XmlRemoteValue(); Vintage.Source = "//row/Vintage"; XmlRemoteValue Wine = new XmlRemoteValue(); Wine.Source = "//row/Wine"; XmlRemoteValue Type = new XmlRemoteValue(); Type.Source = "//row/Type"; ArrayList D = new ArrayList(); D.Add(Type); D.Add(Vintage); D.Add(Wine); Wines.Mappings = D; // <Mappings> // <da:XmlRemoteValueList Name="Wines" RepeatedType="PropertySet" Source="//row"> // <Mappings> // <da:XmlRemoteValue Property="Entries.#Wine" Source="//row/Wine"/> // <da:XmlRemoteValue Property="Entries.#Vintage" Source="//row/Vintage"/> // <da:XmlRemoteValue Property="Entries.#Type" Source="//row/Type"/> // </Mappings> // </da:XmlRemoteValueList> //</Mappings> PropertySet PS = new PropertySet(); PS.Entries.Add("Wines", Wines); XRR.Mappings = PS; XRR.GetDataFromResource(); ArrayListDataSet F = new ArrayListDataSet(); F.Add(new EditableText()); }
public void Init(Settings settings) { _settings = settings; _ChoiceGalleryAdvancedSettingsItems = new Choice(); ArrayListDataSet aryListDS = new ArrayListDataSet(); aryListDS.Add(new SettingsItem(0, _settings.DimUnselectedCovers, "Dim Unselected Covers",false)); aryListDS.Add(new SettingsItem(0, _settings.UseOnScreenAlpha, "Show Alpha Jump Bar", false)); aryListDS.Add(new SettingsItem(0, _settings.ShowMovieDetails, "Show Movie Details", false)); aryListDS.Add(new SettingsItem(0, _settings.ShowWatchedIcon, "Show Watched Icon", false)); aryListDS.Add(new SettingsItem(0, _settings.UseOriginalCoverArt, "Use Original Cover Art(may slow browsing)", true)); aryListDS.Add(new SettingsItem(1, _settings.CoverArtRows, "Cover Art Rows:", false)); aryListDS.Add(new SettingsItem(1, _settings.CoverArtSpacing, "Cover Art Spacing:", true)); aryListDS.Add(new SettingsItem(1, _settings.MainPageBackDropInterval, "Random Backdrop Interval:", false)); aryListDS.Add(new SettingsItem(3, _settings.MainPageBackDropAlpha, "Backdrop Opacity:", true)); _ChoiceGalleryAdvancedSettingsItems.Options = aryListDS; _ChoiceGalleryViewSettingsItems = new Choice(); ArrayListDataSet aryListDS2 = new ArrayListDataSet(); aryListDS2.Add(new SettingsItem(2, _settings.MovieView, "Movie Gallery View:", false)); aryListDS2.Add(new SettingsItem(2, _settings.MovieSort, "Movie Sort:", false)); aryListDS2.Add(new SettingsItem(2, _settings.StartPage, "Start Page:", false)); _ChoiceGalleryViewSettingsItems.Options = aryListDS2; _ChoiceFilterOptions=new Choice(); ArrayListDataSet aryListDS3=new ArrayListDataSet(); aryListDS3.Add(new CheckBox(_settings.ShowFilterActors, "Actors")); aryListDS3.Add(new CheckBox(_settings.ShowFilterCountry, "Country")); aryListDS3.Add(new CheckBox(_settings.ShowFilterDateAdded, "Date Added")); aryListDS3.Add(new CheckBox(_settings.ShowFilterDirectors, "Directors")); aryListDS3.Add(new CheckBox(_settings.ShowFilterGenres, "Genres")); aryListDS3.Add(new CheckBox(_settings.ShowFilterParentalRating, "Parental Rating")); aryListDS3.Add(new CheckBox(_settings.ShowFilterYear, "Release Year")); aryListDS3.Add(new CheckBox(_settings.ShowFilterRuntime, "Runtime")); aryListDS3.Add(new CheckBox(_settings.ShowFilterTags, "Tags")); aryListDS3.Add(new CheckBox(_settings.ShowFilterTrailers, "Trailers")); aryListDS3.Add(new CheckBox(_settings.ShowFilterUserRating, "User Rating")); aryListDS3.Add(new CheckBox(_settings.ShowFilterUnwatched, "Unwatched")); aryListDS3.Add(new CheckBox(_settings.ShowFilterFormat, "Video Format")); _ChoiceFilterOptions.Options = aryListDS3; _ChoiceExtenderSettingsItems = new Choice(); ArrayListDataSet aryListDS4 = new ArrayListDataSet(); aryListDS4.Add(new SettingsItem(4, _settings.ImpersonationUsername, "Impersonation Username:"******"Impersonation Password:"******"Number Of Seconds To Delay:", true)); aryListDS4.Add(new SettingsItem(0, _settings.TranscodeAVIFiles, "Transcode AVI Files", false)); aryListDS4.Add(new SettingsItem(0, _settings.TranscodeMKVFiles, "Transcode MKV Files", false)); aryListDS4.Add(new SettingsItem(0, _settings.TranscodeOGMFiles, "Transcode OGM Files", false)); aryListDS4.Add(new SettingsItem(0, _settings.PreserveAudioOnTranscode, "Preserve audio format on transcode of non DVD files", false)); aryListDS4.Add(new SettingsItem(0, _settings.DebugTranscoding, "Transcode ALL DVDs (DEBUG Only)", false)); _ChoiceExtenderSettingsItems.Options = aryListDS4; }
private ArrayListDataSet ParseDocument(XmlDocument xDoc) { ArrayListDataSet trailers = new ArrayListDataSet(); XPathNavigator nav = xDoc.CreateNavigator(); if (nav.MoveToChild("records", "")) { XPathNodeIterator nIter = nav.SelectChildren("movieinfo", ""); nav.MoveToFirstChild(); XPathNavigator localNav = nav.CreateNavigator(); nav.MoveToParent(); for (int i = 0; i < nIter.Count; i++) { AppleTrailer currentTrailer = new AppleTrailer(); if (localNav.MoveToChild("info", "")) { currentTrailer.Copyright = GetChildNodesValue(localNav, "copyright"); currentTrailer.description = GetChildNodesValue(localNav, "description"); currentTrailer.Director = GetChildNodesValue(localNav, "director"); currentTrailer.Postdate = GetChildNodesValue(localNav, "postdate"); currentTrailer.Rating = GetChildNodesValue(localNav, "rating"); currentTrailer.ReleaseDate = GetChildNodesValue(localNav, "releasedate"); currentTrailer.Runtime = GetChildNodesValue(localNav, "runtime"); currentTrailer.Studio = GetChildNodesValue(localNav, "studio"); currentTrailer.Title = GetChildNodesValue(localNav, "title"); localNav.MoveToParent(); } if (localNav.MoveToChild("cast", "")) { XPathNodeIterator castIter = localNav.SelectChildren("name", ""); if (localNav.MoveToFirstChild()) { XPathNavigator castNav = localNav.CreateNavigator(); for (int j = 0; j < castIter.Count; j++) { currentTrailer.Actors.Add(castNav.Value); castNav.MoveToNext("name", ""); } localNav.MoveToParent(); } localNav.MoveToParent(); } if (localNav.MoveToChild("genre", "")) { XPathNodeIterator genreIter = localNav.SelectChildren("name", ""); if (localNav.MoveToFirstChild()) { XPathNavigator genreNav = localNav.CreateNavigator(); for (int k = 0; k < genreIter.Count; k++) { currentTrailer.Genres.Add(genreNav.Value); genreNav.MoveToNext("name", ""); } localNav.MoveToParent(); } localNav.MoveToParent(); } if (localNav.MoveToChild("poster", "")) { if (localNav.MoveToChild("location", "")) { currentTrailer.PosterUrl = localNav.Value; localNav.MoveToParent(); } if (localNav.MoveToChild("xlarge", "")) { currentTrailer.XLargePosterUrl = localNav.Value; localNav.MoveToParent(); } localNav.MoveToParent(); } if (localNav.MoveToChild("preview", "")) { if (localNav.MoveToChild(XPathNodeType.Element)) { currentTrailer.TrailerUrl = localNav.Value; currentTrailer.Filesize = localNav.GetAttribute("filesize", ""); localNav.MoveToParent(); } localNav.MoveToParent(); } trailers.Add(currentTrailer); localNav.MoveToNext(); } } return trailers; }