code help
FlickrViewer/.vs/FlickrViewer/v14/.suo
FlickrViewer/.vs/FlickrViewer/v15/.suo
FlickrViewer/.vs/FlickrViewer/v15/Server/sqlite3/db.lock
FlickrViewer/.vs/FlickrViewer/v15/Server/sqlite3/storage.ide
FlickrViewer/.vs/FlickrViewer/v15/Server/sqlite3/storage.ide-shm
FlickrViewer/.vs/FlickrViewer/v15/Server/sqlite3/storage.ide-wal
FlickrViewer/.vs/FlickrViewer/v16/.suo
FlickrViewer/.vs/FlickrViewer/v16/Server/sqlite3/db.lock
FlickrViewer/.vs/FlickrViewer/v16/Server/sqlite3/storage.ide
FlickrViewer/FlickrViewer.sln
Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Express 2012 for Windows Desktop Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlickrViewer", "FlickrViewer\FlickrViewer.csproj", "{A8060012-E14D-4E12-808B-019DF2169F1C}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {A8060012-E14D-4E12-808B-019DF2169F1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A8060012-E14D-4E12-808B-019DF2169F1C}.Debug|Any CPU.Build.0 = Debug|Any CPU {A8060012-E14D-4E12-808B-019DF2169F1C}.Release|Any CPU.ActiveCfg = Release|Any CPU {A8060012-E14D-4E12-808B-019DF2169F1C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal
FlickrViewer/FlickrViewer.v11.suo
FlickrViewer/FlickrViewer.v12.suo
FlickrViewer/FlickrViewer/App.config
FlickrViewer/FlickrViewer/bin/Debug/FlickrViewer.exe
FlickrViewer/FlickrViewer/bin/Debug/FlickrViewer.exe.config
FlickrViewer/FlickrViewer/bin/Debug/FlickrViewer.pdb
FlickrViewer/FlickrViewer/bin/Debug/FlickrViewer.vshost.exe
FlickrViewer/FlickrViewer/bin/Debug/FlickrViewer.vshost.exe.config
FlickrViewer/FlickrViewer/bin/Debug/FlickrViewer.vshost.exe.manifest
FlickrViewer/FlickrViewer/FickrViewerForm.cs
// Fig. 28.4: FickrViewerForm.cs // FlickrViewer allows users to search for photos (code-behind). using System; using System.Drawing; using System.IO; using System.Linq; using System.Net; using System.Threading.Tasks; using System.Windows.Forms; using System.Xml.Linq; namespace FlickrViewer { public partial class FickrViewerForm : Form { // Use your Flickr API key here--you can get one at: // http://www.flickr.com/services/apps/create/apply private const string KEY = "df21b3fe175370cffd5f256e032fb1bb"; // object used to invoke Flickr web service private WebClient flickrClient = new WebClient(); Task<string> flickrTask = null; // Task<string> that queries Flickr public FickrViewerForm() { InitializeComponent(); } // end constructor // initiate asynchronous Flickr search query; // display results when query completes private async void searchButton_Click( object sender, EventArgs e ) { // if flickrTask already running, prompt user if ( flickrTask != null && flickrTask.Status != TaskStatus.RanToCompletion ) { var result = MessageBox.Show( "Cancel the current Flickr search?", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question ); // determine whether user wants to cancel prior search if ( result == DialogResult.No ) return; else flickrClient.CancelAsync(); // cancel current search } // end if // Flickr's web service URL for searches var flickrURL = string.Format( "http://api.flickr.com/services" + "/rest/?method=flickr.photos.search&api_key={0}&tags={1}" + "&tag_mode=all&per_page=500&privacy_filter=1", KEY, inputTextBox.Text.Replace( " ", "," ) ); imagesListBox.DataSource = null; // remove prior data source imagesListBox.Items.Clear(); // clear imagesListBox pictureBox.Image = null; // clear pictureBox imagesListBox.Items.Add( "Loading..." ); // display Loading... try { // invoke Flickr web service to search Flick with user's tags flickrTask = flickrClient.DownloadStringTaskAsync( flickrURL ); // await flickrTask then parse results with XDocument and LINQ XDocument flickrXML = XDocument.Parse( await flickrTask ); // gather information on all photos var flickrPhotos = from photo in flickrXML.Descendants( "photo" ) let id = photo.Attribute( "id" ).Value let title = photo.Attribute( "title" ).Value let secret = photo.Attribute( "secret" ).Value let server = photo.Attribute( "server" ).Value let farm = photo.Attribute( "farm" ).Value select new FlickrResult { Title = title, URL = string.Format( "http://farm{0}.staticflickr.com/{1}/{2}_{3}.jpg", farm, server, id, secret ) }; imagesListBox.Items.Clear(); // clear imagesListBox imagesListBox.DataSource = flickrPhotos.ToList(); imagesListBox.DisplayMember = "Title"; // if there were no matching results if ( imagesListBox.Items.Count == 0 ) imagesListBox.Items.Add( "No matches" ); } // end try catch ( WebException ) { // check whether Task failed if ( flickrTask.Status == TaskStatus.Faulted ) MessageBox.Show( "Unable to get results from Flickr", "Flickr Error", MessageBoxButtons.OK, MessageBoxIcon.Error ); imagesListBox.Items.Clear(); // clear imagesListBox imagesListBox.Items.Add( "Error occurred" ); } // end catch } // end method searchButton_Click // display selected image private async void imagesListBox_SelectedIndexChanged( object sender, EventArgs e ) { if ( imagesListBox.SelectedItem != null ) { string selectedURL = ( ( FlickrResult ) imagesListBox.SelectedItem ).URL; // use WebClient to get selected image's bytes asynchronously WebClient imageClient = new WebClient(); byte[] imageBytes = await imageClient.DownloadDataTaskAsync( selectedURL ); // display downloaded image in pictureBox MemoryStream memoryStream = new MemoryStream( imageBytes ); pictureBox.Image = Image.FromStream( memoryStream ); } // end if } // end method imagesListBox_SelectedIndexChanged } // end class FlickrViewerForm } // end namespace FlickrViewer /************************************************************************** * (C) Copyright 1992-2014 by Deitel & Associates, Inc. and * * Pearson Education, Inc. All Rights Reserved. * * * * DISCLAIMER: The authors and publisher of this book have used their * * best efforts in preparing the book. These efforts include the * * development, research, and testing of the theories and programs * * to determine their effectiveness. The authors and publisher make * * no warranty of any kind, expressed or implied, with regard to these * * programs or to the documentation contained in these books. The authors * * and publisher shall not be liable in any event for incidental or * * consequential damages in connection with, or arising out of, the * * furnishing, performance, or use of these programs. * **************************************************************************/
FlickrViewer/FlickrViewer/FickrViewerForm.Designer.cs
namespace FlickrViewer { partial class FickrViewerForm { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose( bool disposing ) { if ( disposing && ( components != null ) ) { components.Dispose(); } base.Dispose( disposing ); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.label1 = new System.Windows.Forms.Label(); this.inputTextBox = new System.Windows.Forms.TextBox(); this.pictureBox = new System.Windows.Forms.PictureBox(); this.searchButton = new System.Windows.Forms.Button(); this.imagesListBox = new System.Windows.Forms.ListBox(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(12, 16); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(145, 13); this.label1.TabIndex = 0; this.label1.Text = "Enter Flickr search tags here:"; // // inputTextBox // this.inputTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.inputTextBox.Location = new System.Drawing.Point(163, 13); this.inputTextBox.Name = "inputTextBox"; this.inputTextBox.Size = new System.Drawing.Size(428, 20); this.inputTextBox.TabIndex = 1; // // pictureBox // this.pictureBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.pictureBox.Location = new System.Drawing.Point(163, 40); this.pictureBox.Name = "pictureBox"; this.pictureBox.Size = new System.Drawing.Size(503, 524); this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pictureBox.TabIndex = 3; this.pictureBox.TabStop = false; // // searchButton // this.searchButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.searchButton.Location = new System.Drawing.Point(597, 11); this.searchButton.Name = "searchButton"; this.searchButton.Size = new System.Drawing.Size(70, 23); this.searchButton.TabIndex = 4; this.searchButton.Text = "Search"; this.searchButton.UseVisualStyleBackColor = true; this.searchButton.Click += new System.EventHandler(this.searchButton_Click); // // imagesListBox // this.imagesListBox.FormattingEnabled = true; this.imagesListBox.Location = new System.Drawing.Point(15, 40); this.imagesListBox.Name = "imagesListBox"; this.imagesListBox.Size = new System.Drawing.Size(142, 524); this.imagesListBox.TabIndex = 5; this.imagesListBox.SelectedIndexChanged += new System.EventHandler(this.imagesListBox_SelectedIndexChanged); // // FickrViewerForm // this.AcceptButton = this.searchButton; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(679, 574); this.Controls.Add(this.imagesListBox); this.Controls.Add(this.searchButton); this.Controls.Add(this.pictureBox); this.Controls.Add(this.inputTextBox); this.Controls.Add(this.label1); this.Name = "FickrViewerForm"; this.Text = "Flickr Viewer"; ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox inputTextBox; private System.Windows.Forms.PictureBox pictureBox; private System.Windows.Forms.Button searchButton; private System.Windows.Forms.ListBox imagesListBox; } }
FlickrViewer/FlickrViewer/FickrViewerForm.resx
text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
FlickrViewer/FlickrViewer/FlickrResult.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace FlickrViewer { class FlickrResult { public string Title { get; set; } public string URL { get; set; } } }
FlickrViewer/FlickrViewer/FlickrViewer.csproj
Debug AnyCPU {A8060012-E14D-4E12-808B-019DF2169F1C} WinExe Properties FlickrViewer FlickrViewer v4.5 512 AnyCPU true full false bin\Debug\ DEBUG;TRACE prompt 4 AnyCPU pdbonly true bin\Release\ TRACE prompt 4 Form FlickrViewerForm.cs FlickrViewerForm.cs ResXFileCodeGenerator Resources.Designer.cs Designer True Resources.resx SettingsSingleFileGenerator Settings.Designer.cs True Settings.settings True
FlickrViewer/FlickrViewer/FlickrViewerForm.cs
// Invoking a web service asynchronously with class WebClient using System; using System.Drawing; using System.IO; using System.Linq; using System.Net; using System.Threading.Tasks; using System.Windows.Forms; using System.Xml.Linq; namespace FlickrViewer { public partial class FlickrViewerForm : Form { // Use your Flickr API key here--you can get one at: // http://www.flickr.com/services/apps/create/apply private const string KEY = "f9fcedefed1c9bfa51b4d6d50bb8cd42"; // object used to invoke Flickr web service private WebClient flickrClient = new WebClient(); Task<string> flickrTask = null; // Task<string> that queries Flickr public FlickrViewerForm() { InitializeComponent(); } // end constructor // initiate asynchronous Flickr search query; // display results when query completes private async void searchButton_Click( object sender, EventArgs e ) { // if flickrTask already running, prompt user if ( flickrTask != null && flickrTask.Status != TaskStatus.RanToCompletion ) { var result = MessageBox.Show( "Cancel the current Flickr search?", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question ); // determine whether user wants to cancel prior search if ( result == DialogResult.No ) return; else flickrClient.CancelAsync(); // cancel current search } // end if // Flickr's web service URL for searches var flickrURL = string.Format( "https://api.flickr.com/services" + "/rest/?method=flickr.photos.search&api_key={0}&tags={1}" + "&tag_mode=all&per_page=500&privacy_filter=1", KEY, inputTextBox.Text.Replace( " ", "," ) ); imagesListBox.DataSource = null; // remove prior data source imagesListBox.Items.Clear(); // clear imagesListBox pictureBox.Image = null; // clear pictureBox imagesListBox.Items.Add( "Loading..." ); // display Loading... try { // invoke Flickr web service to search Flick with user's tags flickrTask = flickrClient.DownloadStringTaskAsync( _____________________ ); // await flickrTask then parse results with XDocument and LINQ XDocument flickrXML = XDocument.Parse( await ______________ ); // gather information on all photos var flickrPhotos = from photo in flickrXML.Descendants( "photo" ) let id = photo.Attribute( "___________" ).Value let title = photo.Attribute( "_______" ).Value let secret = photo.Attribute( "secret" ).Value let server = photo.Attribute( "server" ).Value let farm = photo.Attribute( "farm" ).Value select new FlickrResult { Title = title, URL = string.Format( "http://farm{0}.staticflickr.com/{1}/{2}_{3}.jpg", farm, _________, id, secret ) }; imagesListBox.Items.Clear(); // clear imagesListBox // set ListBox properties only if results were found if ( flickrPhotos.Any() ) { imagesListBox.DataSource = __________________.ToList(); imagesListBox.DisplayMember = "Title"; } // end if else // no matches were found imagesListBox.Items.Add( "No matches" ); } // end try catch ( WebException ) { // check whether Task failed if ( flickrTask.Status == TaskStatus.Faulted ) MessageBox.Show( "Unable to get results from Flickr", "Flickr Error", MessageBoxButtons.OK, MessageBoxIcon.Error ); imagesListBox.Items.Clear(); // clear imagesListBox imagesListBox.Items.Add( "Error occurred" ); } // end catch } // end method searchButton_Click // display selected image private async void imagesListBox_SelectedIndexChanged( object sender, EventArgs e ) { if ( imagesListBox.SelectedItem != null ) { string selectedURL = ( ( FlickrResult ) imagesListBox.SelectedItem ).URL; // use WebClient to get selected image's bytes asynchronously WebClient imageClient = new WebClient(); byte[] imageBytes = await imageClient.DownloadDataTaskAsync( __________________ ); // display downloaded image in pictureBox MemoryStream memoryStream = new MemoryStream( imageBytes ); pictureBox.Image = Image.FromStream( memoryStream ); } // end if } // end method imagesListBox_SelectedIndexChanged } // end class FlickrViewerForm } // end namespace FlickrViewer
FlickrViewer/FlickrViewer/FlickrViewerForm.Designer.cs
namespace FlickrViewer { partial class FlickrViewerForm { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose( bool disposing ) { if ( disposing && ( components != null ) ) { components.Dispose(); } base.Dispose( disposing ); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.label1 = new System.Windows.Forms.Label(); this.inputTextBox = new System.Windows.Forms.TextBox(); this.pictureBox = new System.Windows.Forms.PictureBox(); this.searchButton = new System.Windows.Forms.Button(); this.imagesListBox = new System.Windows.Forms.ListBox(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(12, 16); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(145, 13); this.label1.TabIndex = 0; this.label1.Text = "Enter Flickr search tags here:"; // // inputTextBox // this.inputTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.inputTextBox.Location = new System.Drawing.Point(163, 13); this.inputTextBox.Name = "inputTextBox"; this.inputTextBox.Size = new System.Drawing.Size(428, 20); this.inputTextBox.TabIndex = 1; // // pictureBox // this.pictureBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.pictureBox.Location = new System.Drawing.Point(163, 40); this.pictureBox.Name = "pictureBox"; this.pictureBox.Size = new System.Drawing.Size(503, 524); this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pictureBox.TabIndex = 3; this.pictureBox.TabStop = false; // // searchButton // this.searchButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.searchButton.Location = new System.Drawing.Point(597, 11); this.searchButton.Name = "searchButton"; this.searchButton.Size = new System.Drawing.Size(70, 23); this.searchButton.TabIndex = 4; this.searchButton.Text = "Search"; this.searchButton.UseVisualStyleBackColor = true; this.searchButton.Click += new System.EventHandler(this.searchButton_Click); // // imagesListBox // this.imagesListBox.FormattingEnabled = true; this.imagesListBox.Location = new System.Drawing.Point(15, 40); this.imagesListBox.Name = "imagesListBox"; this.imagesListBox.Size = new System.Drawing.Size(142, 524); this.imagesListBox.TabIndex = 5; this.imagesListBox.SelectedIndexChanged += new System.EventHandler(this.imagesListBox_SelectedIndexChanged); // // FickrViewerForm // this.AcceptButton = this.searchButton; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(679, 574); this.Controls.Add(this.imagesListBox); this.Controls.Add(this.searchButton); this.Controls.Add(this.pictureBox); this.Controls.Add(this.inputTextBox); this.Controls.Add(this.label1); this.Name = "FickrViewerForm"; this.Text = "Flickr Viewer"; ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox inputTextBox; private System.Windows.Forms.PictureBox pictureBox; private System.Windows.Forms.Button searchButton; private System.Windows.Forms.ListBox imagesListBox; } }
FlickrViewer/FlickrViewer/FlickrViewerForm.resx
text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
FlickrViewer/FlickrViewer/obj/Debug/CoreCompileInputs.cache
1acbe311dee9f95ace9d7c8912e62046a55cc3f3
FlickrViewer/FlickrViewer/obj/Debug/DesignTimeResolveAssemblyReferences.cache
FlickrViewer/FlickrViewer/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
FlickrViewer/FlickrViewer/obj/Debug/FlickrViewer.csproj.CoreCompileInputs.cache
cf3353d7be94f4ef4a3358e5c07e26941346f032
FlickrViewer/FlickrViewer/obj/Debug/FlickrViewer.csproj.FileListAbsolute.txt
C:\books\2012\VCSHARP2012HTP\examples\ch28\FlickrViewer\FlickrViewer\bin\Debug\FlickrViewer.exe.config C:\books\2012\VCSHARP2012HTP\examples\ch28\FlickrViewer\FlickrViewer\bin\Debug\FlickrViewer.exe C:\books\2012\VCSHARP2012HTP\examples\ch28\FlickrViewer\FlickrViewer\bin\Debug\FlickrViewer.pdb C:\books\2012\VCSHARP2012HTP\examples\ch28\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.FickrViewerForm.resources C:\books\2012\VCSHARP2012HTP\examples\ch28\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.Properties.Resources.resources C:\books\2012\VCSHARP2012HTP\examples\ch28\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.csproj.GenerateResource.Cache C:\books\2012\VCSHARP2012HTP\examples\ch28\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.exe C:\books\2012\VCSHARP2012HTP\examples\ch28\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.pdb C:\books\2012\VCSHARP2012HTP\examples\ch28\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.csprojResolveAssemblyReference.cache C:\Users\pnguyen\Downloads\ch28asyn\ch28asyn\FlickrViewer\FlickrViewer\bin\Debug\FlickrViewer.exe.config C:\Users\pnguyen\Downloads\ch28asyn\ch28asyn\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.exe C:\Users\pnguyen\Downloads\ch28asyn\ch28asyn\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.pdb C:\Users\pnguyen\Downloads\ch28asyn\ch28asyn\FlickrViewer\FlickrViewer\bin\Debug\FlickrViewer.exe C:\Users\pnguyen\Downloads\ch28asyn\ch28asyn\FlickrViewer\FlickrViewer\bin\Debug\FlickrViewer.pdb C:\Users\pnguyen\Downloads\ch28asyn\ch28asyn\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.csprojResolveAssemblyReference.cache C:\Users\pnguyen\Downloads\ch28asyn\ch28asyn\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.FlickrViewerForm.resources C:\Users\pnguyen\Downloads\ch28asyn\ch28asyn\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.Properties.Resources.resources C:\Users\pnguyen\Downloads\ch28asyn\ch28asyn\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.csproj.GenerateResource.Cache D:\cecs475sp16\FlickrViewer\FlickrViewer\bin\Debug\FlickrViewer.exe.config D:\cecs475sp16\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.exe D:\cecs475sp16\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.pdb D:\cecs475sp16\FlickrViewer\FlickrViewer\bin\Debug\FlickrViewer.exe D:\cecs475sp16\FlickrViewer\FlickrViewer\bin\Debug\FlickrViewer.pdb D:\cecs475sp16\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.csprojResolveAssemblyReference.cache D:\cecs475sp16\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.FlickrViewerForm.resources D:\cecs475sp16\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.Properties.Resources.resources D:\cecs475sp16\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.csproj.GenerateResource.Cache E:\cecs475sp16\FlickrViewer\FlickrViewer\bin\Debug\FlickrViewer.exe.config E:\cecs475sp16\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.exe E:\cecs475sp16\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.pdb E:\cecs475sp16\FlickrViewer\FlickrViewer\bin\Debug\FlickrViewer.exe E:\cecs475sp16\FlickrViewer\FlickrViewer\bin\Debug\FlickrViewer.pdb E:\cecs475sp16\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.csprojResolveAssemblyReference.cache E:\cecs475sp16\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.FlickrViewerForm.resources E:\cecs475sp16\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.Properties.Resources.resources E:\cecs475sp16\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.csproj.GenerateResource.Cache F:\cecs475sp16\FlickrViewer\FlickrViewer\bin\Debug\FlickrViewer.exe.config F:\cecs475sp16\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.exe F:\cecs475sp16\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.pdb F:\cecs475sp16\FlickrViewer\FlickrViewer\bin\Debug\FlickrViewer.exe F:\cecs475sp16\FlickrViewer\FlickrViewer\bin\Debug\FlickrViewer.pdb F:\cecs475sp16\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.csprojResolveAssemblyReference.cache F:\cecs475sp16\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.FlickrViewerForm.resources F:\cecs475sp16\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.Properties.Resources.resources F:\cecs475sp16\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.csproj.GenerateResource.Cache C:\cecs475sp18\FlickrViewer\FlickrViewer\bin\Debug\FlickrViewer.exe.config C:\cecs475sp18\FlickrViewer\FlickrViewer\bin\Debug\FlickrViewer.exe C:\cecs475sp18\FlickrViewer\FlickrViewer\bin\Debug\FlickrViewer.pdb C:\cecs475sp18\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.FlickrViewerForm.resources C:\cecs475sp18\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.Properties.Resources.resources C:\cecs475sp18\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.csproj.GenerateResource.Cache C:\cecs475sp18\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.csproj.CoreCompileInputs.cache C:\cecs475sp18\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.exe C:\cecs475sp18\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.pdb C:\cecs475sp18\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.csprojAssemblyReference.cache C:\cecs475fa18\FlickrViewer\FlickrViewer\bin\Debug\FlickrViewer.exe.config C:\cecs475fa18\FlickrViewer\FlickrViewer\bin\Debug\FlickrViewer.exe C:\cecs475fa18\FlickrViewer\FlickrViewer\bin\Debug\FlickrViewer.pdb C:\cecs475fa18\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.csprojAssemblyReference.cache C:\cecs475fa18\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.FlickrViewerForm.resources C:\cecs475fa18\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.Properties.Resources.resources C:\cecs475fa18\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.csproj.GenerateResource.cache C:\cecs475fa18\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.csproj.CoreCompileInputs.cache C:\cecs475fa18\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.exe C:\cecs475fa18\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.pdb C:\PNgyuentransfer\cecs475fa18\FlickrViewer\FlickrViewer\bin\Debug\FlickrViewer.exe.config C:\PNgyuentransfer\cecs475fa18\FlickrViewer\FlickrViewer\bin\Debug\FlickrViewer.exe C:\PNgyuentransfer\cecs475fa18\FlickrViewer\FlickrViewer\bin\Debug\FlickrViewer.pdb C:\PNgyuentransfer\cecs475fa18\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.csprojAssemblyReference.cache C:\PNgyuentransfer\cecs475fa18\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.FlickrViewerForm.resources C:\PNgyuentransfer\cecs475fa18\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.Properties.Resources.resources C:\PNgyuentransfer\cecs475fa18\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.csproj.GenerateResource.cache C:\PNgyuentransfer\cecs475fa18\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.csproj.CoreCompileInputs.cache C:\PNgyuentransfer\cecs475fa18\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.exe C:\PNgyuentransfer\cecs475fa18\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.pdb E:\PNgyuentransfer\cecs475sp20\labs\FlickrViewer\FlickrViewer\bin\Debug\FlickrViewer.exe.config E:\PNgyuentransfer\cecs475sp20\labs\FlickrViewer\FlickrViewer\bin\Debug\FlickrViewer.exe E:\PNgyuentransfer\cecs475sp20\labs\FlickrViewer\FlickrViewer\bin\Debug\FlickrViewer.pdb E:\PNgyuentransfer\cecs475sp20\labs\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.csprojAssemblyReference.cache E:\PNgyuentransfer\cecs475sp20\labs\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.FlickrViewerForm.resources E:\PNgyuentransfer\cecs475sp20\labs\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.Properties.Resources.resources E:\PNgyuentransfer\cecs475sp20\labs\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.csproj.GenerateResource.cache E:\PNgyuentransfer\cecs475sp20\labs\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.csproj.CoreCompileInputs.cache E:\PNgyuentransfer\cecs475sp20\labs\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.exe E:\PNgyuentransfer\cecs475sp20\labs\FlickrViewer\FlickrViewer\obj\Debug\FlickrViewer.pdb
FlickrViewer/FlickrViewer/obj/Debug/FlickrViewer.csproj.GenerateResource.cache
FlickrViewer/FlickrViewer/obj/Debug/FlickrViewer.csprojAssemblyReference.cache
FlickrViewer/FlickrViewer/obj/Debug/FlickrViewer.exe
FlickrViewer/FlickrViewer/obj/Debug/FlickrViewer.FickrViewerForm.resources
FlickrViewer/FlickrViewer/obj/Debug/FlickrViewer.FlickrViewerForm.resources
FlickrViewer/FlickrViewer/obj/Debug/FlickrViewer.pdb
FlickrViewer/FlickrViewer/obj/Debug/FlickrViewer.Properties.Resources.resources
FlickrViewer/FlickrViewer/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
FlickrViewer/FlickrViewer/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
FlickrViewer/FlickrViewer/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
FlickrViewer/FlickrViewer/Program.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; namespace FlickrViewer { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault( false ); Application.Run( new FlickrViewerForm() ); } } }
FlickrViewer/FlickrViewer/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle( "FlickrViewer" )] [assembly: AssemblyDescription( "" )] [assembly: AssemblyConfiguration( "" )] [assembly: AssemblyCompany( "" )] [assembly: AssemblyProduct( "FlickrViewer" )] [assembly: AssemblyCopyright( "Copyright © 2013" )] [assembly: AssemblyTrademark( "" )] [assembly: AssemblyCulture( "" )] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible( false )] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid( "1fb0253b-c670-4ef6-a7e3-4e23c063dfab" )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion( "1.0.0.0" )] [assembly: AssemblyFileVersion( "1.0.0.0" )]
FlickrViewer/FlickrViewer/Properties/Resources.Designer.cs
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.18034 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace FlickrViewer.Properties { /// <summary> /// A strongly-typed resource class, for looking up localized strings, etc. /// </summary> // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute( "System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0" )] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute( "Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode" )] internal Resources() { } /// <summary> /// Returns the cached ResourceManager instance used by this class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute( global::System.ComponentModel.EditorBrowsableState.Advanced )] internal static global::System.Resources.ResourceManager ResourceManager { get { if ( ( resourceMan == null ) ) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager( "FlickrViewer.Properties.Resources", typeof( Resources ).Assembly ); resourceMan = temp; } return resourceMan; } } /// <summary> /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute( global::System.ComponentModel.EditorBrowsableState.Advanced )] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } }
FlickrViewer/FlickrViewer/Properties/Resources.resx
text/microsoft-resx 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
FlickrViewer/FlickrViewer/Properties/Settings.Designer.cs
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.18034 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace FlickrViewer.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute( "Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0" )] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ( ( Settings ) ( global::System.Configuration.ApplicationSettingsBase.Synchronized( new Settings() ) ) ); public static Settings Default { get { return defaultInstance; } } } }
FlickrViewer/FlickrViewer/Properties/Settings.settings
instruction.pdf
Create a Flickr Viewer app that allows users to search for photos on the photo-sharing website
Flickr then browse through the result. The app uses an asynchronous method to invoke a Flickr
web service. The Flickr Viewer app allows user to search by tag for photos that users
worldwide have uploaded to Flickr. To access the Flickr web service on your computer, you
must obtain your own Flickr API key at
http://www.flickr.com/services/apps/create/apply
and use it to replace the words YOUR API KEY HERE inside the program.
You are going to invoke the Flickr web service's method flickr.photos.search. You can learn
more about this web-service method's parameters and the format of the URL for invoking the
method at
https://www.flickr.com/services/api/flickr.photos.search.html
In this program, you specify values for the following parameters:
api_key (Required)
tags
A comma-delimited list of tags. Photos with one or more of the tags listed will be
returned. You can exclude results that match a term by prepending it with a - character.
tag_mode
Either 'any' for an OR combination of tags, or 'all' for an AND combination. Defaults to
'any' if not specified.
per_page
Number of photos to return per page. If this argument is omitted, it defaults to 100. The
maximum allowed value is 500.
privacy_filter (Optional)
Return photos only matching a certain privacy level. This only applies when making an
authenticated call to view photos you own. Use value 1.
The method flickr.photos.search returns the standard photo list xml:
<photos page="2" pages="89" perpage="10" total="881">
<photo id="2636" owner="47058503995@N01"
secret="a123456" server="2" title="test_04"
ispublic="1" isfriend="0" isfamily="0" />
<photo id="2635" owner="47058503995@N01"
secret="b123456" server="2" title="test_03"
ispublic="0" isfriend="1" isfamily="1" />
<photo id="2633" owner="47058503995@N01"
secret="c123456" server="2" title="test_01"
ispublic="1" isfriend="0" isfamily="0" />
<photo id="2610" owner="12037949754@N01"
secret="d123456" server="2" title="00_tall"
ispublic="1" isfriend="0" isfamily="0" />
</photos>
REST Request Format
REST is the simplest request format to use - it's a simple HTTP GET or POST action.
The REST Endpoint URL is https://api.flickr.com/services/rest/
To request the flickr.test.echo service, invoke like this:
https://api.flickr.com/services/rest/?method=flickr.test.echo&name=value