/// <summary>
        /// Prompt user to choose a file from a list.
        /// </summary>
        /// <param name="fileList">A list of files to be picked.</param>
        /// <returns>
        /// The picked file index.
        /// Or -1 if Cancel button is clicked.
        /// </returns>
        public static int PromptUser(IEnumerable <string> fileList)
        {
            var dialog = new PickFileWindow(fileList);

            dialog.ShowModal();
            return(dialog.ViewModel.Result);
        }
 public PickFileWindowViewModel(PickFileWindow owner, IEnumerable <string> fileList)
 {
     _owner = owner.ThrowIfNull(nameof(owner));
     if (fileList?.Count() < 2)
     {
         throw new ArgumentException($"{nameof(fileList)} is null or count is less than 2.");
     }
     _fileList         = fileList;
     SelectedIndex     = 0;
     Result            = -1;
     SelectFileCommand = new ProtectedCommand(OnSelectFileCommand);
 }