Esempio n. 1
0
 /// <summary>
 /// 从复制的ViewModel类改变值.
 /// </summary>
 public void CopyFrom(ComposePhotoViewModel source)
 {
     this.Name               = source.Name;
     this.PhotoDuration      = source.PhotoDuration;
     this.TransitionDuration = source.TransitionDuration;
     if (source.Transition != null)
     {
         this.Transition = source.Transition.Clone();
     }
     this.MediaStream = source.MediaStream;
 }
 /// <summary>
 /// 将实体类改变为ViewModel类.
 /// </summary>
 public static ComposePhotoViewModel CreateFromModel(Photo model)
 {
     ComposePhotoViewModel viewModel = new ComposePhotoViewModel()
     {
         Name = model.Name,
         MediaStream = model.ThumbnailStream,
         PhotoDuration = (int)(model.PhotoDuration.TotalSeconds)
     };
     if (model.Transition != null)
     {
         viewModel.Transition = model.Transition;
         viewModel.TransitionDuration = (int)(model.Transition.TransitionDuration.TotalSeconds);
     }
     return viewModel;
 }
Esempio n. 3
0
        /// <summary>
        /// 将实体类改变为ViewModel类.
        /// </summary>
        public static ComposePhotoViewModel CreateFromModel(Photo model)
        {
            ComposePhotoViewModel viewModel = new ComposePhotoViewModel()
            {
                Name          = model.Name,
                MediaStream   = model.ThumbnailStream,
                PhotoDuration = (int)(model.PhotoDuration.TotalSeconds)
            };

            if (model.Transition != null)
            {
                viewModel.Transition         = model.Transition;
                viewModel.TransitionDuration = (int)(model.Transition.TransitionDuration.TotalSeconds);
            }
            return(viewModel);
        }
Esempio n. 4
0
        /// <summary>
        ///  复制view model.
        /// </summary>
        /// <returns>view model备份.</returns>
        public ComposePhotoViewModel CopyTo()
        {
            ComposePhotoViewModel copy = new ComposePhotoViewModel()
            {
                Name               = this.Name,
                PhotoDuration      = this.PhotoDuration,
                TransitionDuration = this.TransitionDuration,
                MediaStream        = this.MediaStream
            };

            if (this.Transition != null)
            {
                copy.Transition = this.Transition.Clone();
            }
            return(copy);
        }
Esempio n. 5
0
        private void EditPhotoButton_Click(object sender, System.EventArgs e)
        {
            if (this.photoListBox.SelectedItem != null && this.photoListBox.SelectedItem is ComposePhotoViewModel)
            {
                this.photoListBox.IsEnabled = false;

                // 备份视图模型, 因此我们可以撤销更新操作.
                this._viewModelBackup = ((ComposePhotoViewModel)this.photoListBox.SelectedItem).CopyTo();
                this.ShowEditPanelStoryboard.Begin();
            }
        }
 /// <summary>
 /// 从复制的ViewModel类改变值.
 /// </summary>
 public void CopyFrom(ComposePhotoViewModel source)
 {
     this.Name = source.Name;
     this.PhotoDuration = source.PhotoDuration;
     this.TransitionDuration = source.TransitionDuration;
     if (source.Transition != null)
     {
         this.Transition = source.Transition.Clone();
     }
     this.MediaStream = source.MediaStream;
 }
 /// <summary>
 ///  复制view model.
 /// </summary>
 /// <returns>view model备份.</returns>
 public ComposePhotoViewModel CopyTo()
 {
     ComposePhotoViewModel copy = new ComposePhotoViewModel()
     {
         Name = this.Name,
         PhotoDuration = this.PhotoDuration,
         TransitionDuration = this.TransitionDuration,
         MediaStream = this.MediaStream
     };
     if (this.Transition != null)
     {
         copy.Transition = this.Transition.Clone();
     }
     return copy;
 }