コード例 #1
0
 /// <summary>
 /// Copy values back to this object from a cached object
 /// </summary>
 /// <param name="origianl"></param>
 public void Restore(MediaView cachedObject)
 {
     this.caption     = cachedObject.caption;
     this.description = cachedObject.description;
     this.id          = cachedObject.id;
     this.title       = cachedObject.title;
     this.myUrl       = cachedObject.myUrl;
     this.fileName    = cachedObject.fileName;
     this.updated     = cachedObject.updated;
 }
コード例 #2
0
 public MediaView(MediaView original)
 {
     this.id          = original.id;
     this.title       = original.title;
     this.caption     = original.caption;
     this.description = original.description;
     this.updated     = original.updated;
     this.myUrl       = original.myUrl;
     this.fileName    = original.fileName;
 }
コード例 #3
0
 /// <summary>
 /// Load data to the UI
 /// </summary>
 /// <param name="mediaArray"></param>
 private void LoadData(media[] mediaArray)
 {
     DataList.Clear();
     foreach (media theMedia in mediaArray)
     {
         MediaView mediaView = new MediaView(theMedia);
         WebClient wc        = new WebClient();
         wc.OpenReadCompleted += new OpenReadCompletedEventHandler(wc_OpenReadCompleted);
         wc.OpenReadAsync(new Uri(mediaView.myUrl), mediaView);
         DataList.Add(mediaView);
     }
 }
コード例 #4
0
        private void wc_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
        {
            MediaView mediaView = e.UserState as MediaView;

            mediaView.ImageStream = e.Result;
        }
コード例 #5
0
 /// <summary>
 /// 'Cancel' button is clicked
 /// </summary>
 public void CancelEdit()
 {
     Restore(cache);
     cache = null;
 }
コード例 #6
0
 /// <summary>
 /// 'Edit' button is clicked
 /// Due to binding, all UI changed will be mapped to the object, so we need make a copy of object before edit in case user wants to cancel the editing
 /// </summary>
 public void BeginEdit()
 {
     cache = new MediaView(this);
 }