Exemplo n.º 1
0
 /// <summary>
 /// User will be prompted to select a <see cref="DocumentBase.DocumentDescribor"/>.
 /// In case he aborts, exception will be thrown.
 /// </summary>
 /// <returns>The <see cref="DocumentBase.DocumentDescribor"/> the user selected.</returns>
 /// <exception cref="KeyNotFoundException">Thrown when user aborted the selection dialog.</exception>
 public DocumentBase.DocumentDescribor GetDocumentDescriborByPrompt()
 {
     DocumentBase.DocumentDescribor descr = null;
     Application.Current.Dispatcher.Invoke(() =>
     {
         var dlgdc     = new Dialogs.DocumentSelectorDialogDataContext();
         var dlg       = new Dialogs.DocumentSelectorDialog(dlgdc);
         var dlgResult = dlg.ShowDialog();
         if (dlgResult.HasValue && dlgResult.Value)
         {
             descr = dlgdc.SelectedItem as DocumentBase.DocumentDescribor;
         }
     });
     if (descr != null)
     {
         return(descr);
     }
     throw new KeyNotFoundException();
 }
 public DocumentSelectorDialog(DocumentSelectorDialogDataContext dc)
 {
     this.DataContext = dc;
     this.InitializeComponent();
 }