O'Reilly logo

Learning Microsoft Cognitive Services - Second Edition by Leif Larsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Wiring up the execution in the ViewModel

With the VideoOperations class completed, it is time to wire up the actions in our ViewModel.

Earlier, we created the ICommand objects. Let us start by looking at the BrowseVideo function:

    private void BrowseVideo(object obj) 
    { 
        Microsoft.Win32.OpenFileDialog openDialog = new Microsoft.Win32.OpenFileDialog(); 
        openDialog.Filter = "Video files (*.mp4, *.mov, *.wmv)|*.mp4;*.mov;*.wmv"; 
 
        bool? result = openDialog.ShowDialog(); 
        if (!(bool)result) return; 
 
        _filePath = openDialog.FileName; 
        _videoExtension = Path.GetExtension(_filePath); 
    } 

None of this code should be new, as we have done the same in previous chapters. We create an OpenFileDialog, with only allowed video files filtered. The allowed video files ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required