Пример #1
0
 /// <summary>
 /// Adds the reference.
 /// </summary>
 /// <param name='sender'>
 /// Sender.
 /// </param>
 /// <param name='args'>
 /// Arguments.
 /// </param>
 /// <exception cref='FileNotFoundException'>
 /// Is thrown when a file path argument specifies a file that does not exist.
 /// </exception>
 protected void AddReference(object sender, EventArgs args)
 {
     FileChooserDialog fDlg = new FileChooserDialog("Select Assembly", GtkDialog as Window, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept);
     fDlg.Modal = true;
     fDlg.DestroyWithParent = true;
     fDlg.Close += (s, e) => {
         fDlg.Respond(ResponseType.Cancel); };
     if (fDlg.Run() == (int)ResponseType.Accept)
     {
         string path = fDlg.Filename;
         if (!File.Exists(path))
             throw new FileNotFoundException("Could not open assembly to add to project preferences", path);
         if (!updatedReferencePaths.Contains(path))
             updatedReferencePaths.Add(path);
         RefreshReferencePathsNodeView();
     }
     fDlg.Destroy();
 }