/// <summary> /// Shows the <see cref="OpenFileDialog"/>. /// </summary> /// <param name="ownerViewModel"> /// A view model that represents the owner window of the dialog. /// </param> /// <param name="settings">The settings for the open file dialog.</param> /// <returns> /// If the user clicks the OK button of the dialog that is displayed, true is returned; /// otherwise false. /// </returns> public bool?ShowOpenFileDialog( INotifyPropertyChanged ownerViewModel, OpenFileDialogSettings settings) { if (ownerViewModel == null) { throw new ArgumentNullException("ownerViewModel"); } if (settings == null) { throw new ArgumentNullException("settings"); } var dialog = new OpenFileDialogWrapper(settings); return(dialog.ShowDialog(FindOwnerWindow(ownerViewModel))); }
/// <summary> /// Shows the <see cref="OpenFileDialog"/>. /// </summary> /// <param name="ownerViewModel"> /// A view model that represents the owner window of the dialog. /// </param> /// <param name="settings">The settings for the open file dialog.</param> /// <returns> /// If the user clicks the OK button of the dialog that is displayed, true is returned; /// otherwise false. /// </returns> /// <exception cref="ViewNotRegisteredException"> /// No view is registered with specified owner view model as data context. /// </exception> public bool?ShowOpenFileDialog( INotifyPropertyChanged ownerViewModel, OpenFileDialogSettings settings) { if (ownerViewModel == null) { throw new ArgumentNullException(nameof(ownerViewModel)); } if (settings == null) { throw new ArgumentNullException(nameof(settings)); } Logger.Write($"Title: {settings.Title}"); var dialog = new OpenFileDialogWrapper(settings); return(dialog.ShowDialog(FindOwnerWindow(ownerViewModel))); }
/// <summary> /// Показать окно открытия файла. /// </summary> /// <param name="ownerViewModel">Родительский презентер.</param> /// <param name="settings">Настройки диалога.</param> /// <returns>true, в случае получения результата, иначе false.</returns> public bool?ShowOpenFileDialog(IWindow ownerViewModel, OpenFileDialogSettings settings) { if (ownerViewModel == null) { throw new ArgumentNullException(nameof(ownerViewModel)); } if (settings == null) { throw new ArgumentNullException(nameof(settings)); } var ownerWindow = WindowManager.Instance.FindWindowByViewModel(ownerViewModel); if (ownerWindow == null) { throw new ArgumentException("Could not found window associated with current view model", nameof(ownerViewModel)); } var wrapper = new OpenFileDialogWrapper(settings); return(wrapper.ShowDialog(ownerWindow)); }