예제 #1
0
        void UpdateView()
        {
            ImageProjectVModel vm = this.ViewModel;

            VsTrace("UpdateView");
            if (vm != null)
            {
                if ((vm.CurrentMedia == null) || (vm.CurrentMedia.MediaType == MediaTypes.Image))
                {
                    OnMediaOff();
                    EnsureReleaseMedia();
                    this.Visibility = Visibility.Collapsed;
                }
                else
                {
                    EnsureReleaseMedia();
                    this._player.Source       = null;
                    this._player.Source       = new Uri(vm.CurrentMedia.FullName, UriKind.Absolute);
                    this._mediaPosition.Value = 0;
                    this._player.Play();
                    OnMediaOn();
                    this._player.Volume = this._volume.Value;
                    this.Visibility     = Visibility.Visible;
                }
            }
        }
예제 #2
0
        ///// <summary>
        ///// Initializes a new instance of the <see cref="ProjectActionsVModel"/> class.
        ///// </summary>
        //public ProjectActionsVModel()
        //    : this("ProjectActionsVModel") {
        //}

        /// <summary>
        /// Initializes a new instance of the <see cref="ProjectActionsVModel"/> class.
        /// </summary>
        /// <param name="title">The title.</param>
        public ProjectActionsVModel(ImageProjectVModel parent, string title = "Actions")
        {
            this.Title  = title;
            this.Parent = parent;
            Init();
            this.InitCommands();
        }
예제 #3
0
        private void _scaleK_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            ImageProjectVModel pvm = this._view.DataContext as ImageProjectVModel;

            if (pvm != null)
            {
                pvm.Scale.SetDefaultPos();
            }
        }
예제 #4
0
        ///<summary>Execute New Project Command</summary>
        void DoNewProjectCmd(object prm = null)
        {
            ImageProjectVModel vm = new ImageProjectVModel()
            {
                Entity = new MediaProject()
            };

            this.AddDefaultSettings(vm.Entity);
            this.EnsureWorkspace(null, () => vm);
        }
예제 #5
0
        /// <summary>
        /// Sets the view model.
        /// </summary>
        /// <param name="viewModel">The view model.</param>
        public void SetViewModel(ViewModelBase viewModel)
        {
            this._view.DataContext = viewModel;
            ImageProjectVModel vm = viewModel as ImageProjectVModel;

            if (vm != null)
            {
                vm.GetHighlightedItems = this.GetSelectedMedia;
            }
        }
예제 #6
0
        protected override void OnClosed(EventArgs e)
        {
            base.OnClosed(e);
            ImageProjectVModel pvm = this._view.DataContext as ImageProjectVModel;

            if (pvm != null)
            {
                pvm.PopoutView = null;
            }
        }
예제 #7
0
 private void _picPreview_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if ((e.ChangedButton == MouseButton.Left) && (e.ClickCount == 2))
     {
         ImageProjectVModel pvm = this._view.DataContext as ImageProjectVModel;
         if (pvm != null)
         {
             pvm.OpenMediaCmd.ExecuteIfCan();
         }
     }
 }
예제 #8
0
        private void _media_Drop(object sender, DragEventArgs e)
        {
            ImageProjectVModel vm = this._view.DataContext as ImageProjectVModel;

            if (vm != null)
            {
                if (e.Data.GetDataPresent(DataFormats.FileDrop))
                {
                    string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
                    vm.ProcessDroppedFiles(files);
                }
            }
        }
예제 #9
0
        void ExecuteCurrentMediaItem()
        {
            var mf = this._media.SelectedItem as MediaFile;

            if (mf != null)
            {
                ImageProjectVModel vm = this._view.DataContext as ImageProjectVModel;
                if (vm != null)
                {
                    vm.OpenMediaCmd.ExecuteIfCan(mf);
                }
            }
        }
예제 #10
0
        void OpenFile(string sourceFileName)
        {
            if (sourceFileName != null)
            {
                string ext = System.IO.Path.GetExtension(sourceFileName).ToLower();
                switch (ext)
                {
                case ".xmv":
                    VideoProjectVModel vvm = new VideoProjectVModel();
                    this.EnsureWorkspace(null, () => vvm);
                    vvm.LoadProject(sourceFileName);
                    break;

                default:
                    ImageProjectVModel vm = new ImageProjectVModel();
                    this.EnsureWorkspace(null, () => vm);
                    vm.LoadProject(sourceFileName);
                    break;
                }
            }
        }