Esempio n. 1
0
        private void LoadImages()
        {
            string directoryName = "/usr/share/pixmaps/meshwork/avatars";

            if (Directory.Exists(directoryName) == true)
            {
                foreach (FileInfo file in new DirectoryInfo(directoryName).GetFiles())
                {
                    Gdk.Pixbuf pixbuf = new Gdk.Pixbuf(file.FullName);

                    if (pixbuf.Width > 80 | pixbuf.Height > 80)
                    {
                        pixbuf = pixbuf.ScaleSimple(80, 80, Gdk.InterpType.Hyper);
                    }

                    Gtk.Application.Invoke(delegate {
                        TreeIter iter = store.Insert(0);
                        store.SetValue(iter, 0, pixbuf);
                        store.SetValue(iter, 1, file.FullName);
                    });
                }
            }


            // Load gravatar... timeout after a few seconds
            Thread timeoutThread = new Thread(new ThreadStart(TimeoutGravatar));

            timeoutThread.Start();

            string hash = "b653c99616e34ee4f834da53b109ce01";

            WebClient client = new WebClient();

            try {
                byte[] data = client.DownloadData(String.Format("http://www.gravatar.com/avatar.php?gravatar_id={0}", hash));
                Application.Invoke(delegate { GotGravatarImage(data); });
            } catch (Exception ex) {
                LoggingService.LogError(ex);
                Application.Invoke(delegate { GotGravatarImage(null); });
            }
        }
Esempio n. 2
0
 private void Insert(int index, SyncPoint syncPoint)
 {
     model.SetValue(model.Insert(index), 0, syncPoint);
 }
Esempio n. 3
0
 /// <summary>Adds a subtitle to the specified position on the list.</summary>
 public void Add(Subtitle subtitle, int index)
 {
     Collection.Add(subtitle, index);
     model.SetValue(model.Insert(index), 0, subtitle);
 }