当前位置: 首页>>代码示例>>C#>>正文


C# FileChooserDialog.SetIconFromFile方法代码示例

本文整理汇总了C#中Gtk.FileChooserDialog.SetIconFromFile方法的典型用法代码示例。如果您正苦于以下问题:C# FileChooserDialog.SetIconFromFile方法的具体用法?C# FileChooserDialog.SetIconFromFile怎么用?C# FileChooserDialog.SetIconFromFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gtk.FileChooserDialog的用法示例。


在下文中一共展示了FileChooserDialog.SetIconFromFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FireUpFileChooserForDownloading

    private void FireUpFileChooserForDownloading()
    {
        if (uploadbutton.Active) return;
          FileChooserDialog chooser = new FileChooserDialog(
          "Select a folder", null, FileChooserAction.SelectFolder,
          Stock.Open, ResponseType.Ok, Stock.Cancel, ResponseType.Cancel);

          chooser.SetIconFromFile(DeskFlickrUI.ICON_PATH);
          chooser.SetFilename(PersistentInformation.GetInstance().DownloadFoldername);
          ResponseType choice = (ResponseType) chooser.Run();
          string foldername = "";
          if (choice == ResponseType.Ok) {
           foldername = chooser.Filename;
           // Set the default path to be opened next time file chooser runs.
           PersistentInformation.GetInstance().DownloadFoldername = foldername;
          }
          chooser.Destroy();
          if (foldername.Equals("")) return;

          // Selected folder for downloading.
          ArrayList photoids = new ArrayList();
          ArrayList selectedphotos = new ArrayList();
          bool refreshview = false;
          if (treeview2.Selection.GetSelectedRows().Length > 0) {
            foreach (TreePath path in treeview2.Selection.GetSelectedRows()) {
              Photo p = new Photo(GetPhoto(path));
              TreePath childpath = filter.ConvertPathToChildPath(path);
              SelectedPhoto sel = new SelectedPhoto(p, childpath.ToString());
              selectedphotos.Add(sel);
              photoids.Add(p.Id);
            }
          }
        else if (treeview1.Selection.GetSelectedRows().Length > 0) {
          // Going through the complex way of figuring out photos for the
          // different tab modes. Easier way would be to just copy contents
          // of _photos, as it already takes care of left tree selection. However,
          // when the view is locked to 'downloads', _photos wouldn't be updated.
          // Hence the need to figure out photoids.
            TreePath path = treeview1.Selection.GetSelectedRows()[0];
            if (selectedtab == 0) { // albums
              Album album = new Album((Album) _albums[path.Indices[0]]);
              photoids = PersistentInformation.GetInstance().GetPhotoIdsForAlbum(album.SetId);
              //foldername = String.Format("{0}/{1}", foldername, album.Title);
          		  } else if (selectedtab == 1) { // tags
          		    string tag = (string) _tags[path.Indices[0]];
          		    photoids = PersistentInformation.GetInstance().GetPhotoIdsForTag(tag);
          		    //foldername = String.Format("{0}/{1}", foldername, tag);
          		  } else if (selectedtab == 2) {
          		    PersistentInformation.Entry poolentry =
          		        (PersistentInformation.Entry) _pools[path.Indices[0]];
          		    string poolid = poolentry.entry1;
          		    //string pooltitle = poolentry.entry2;
          		    photoids = PersistentInformation.GetInstance().GetPhotoidsForPool(poolid);
          		    //foldername = String.Format("{0}/{1}", foldername, pooltitle);
          		  } else if (selectedtab == 3) {
          		    PersistentInformation.Entry blog =
          		        (PersistentInformation.Entry) _blogs[path.Indices[0]];
          		    foreach (BlogEntry blogentry in
          		        PersistentInformation.GetInstance().GetEntriesForBlog(blog.entry1)) {
          		      photoids.Add(blogentry.Photoid);
          		    }
          		    //foldername = String.Format("{0}/{1}", foldername, blog.entry2);
          		  }
          		  refreshview = true;
          }
          Utils.EnsureDirectoryExists(foldername);
          foreach (string id in photoids) {
            if (PersistentInformation.GetInstance().IsDownloadEntryExists(id)) {
              PersistentInformation.GetInstance().DeleteEntryFromDownload(id);
            }
            PersistentInformation.GetInstance().InsertEntryToDownload(id, foldername);
          }
          UpdateToolBarButtons();
          if (downloadbutton.Active) RefreshDownloadPhotos();
          else if (refreshview) RefreshLeftTreeView();
          else UpdatePhotos(selectedphotos);
    }
开发者ID:joshuacox,项目名称:dfo,代码行数:77,代码来源:DeskFlickrUI.cs


注:本文中的Gtk.FileChooserDialog.SetIconFromFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。