Esempio n. 1
0
        /// <snd what='file' id='10' part='13'>...</snd>
        private void OnSndEvent(PeerSocket peer, XmlRequest xml)
        {
            Gtk.Application.Invoke(delegate {
                string what = (string)xml.Attributes["what"];

                switch (what)
                {
                case "file":
                    ulong id = ulong.Parse((string)xml.Attributes["id"]);
                    DownloadManager.GetFilePart(peer, id, xml);
                    break;

                case "file-list":
                    UserInfo userInfo         = peer.Info as UserInfo;
                    FolderViewer folderViewer = notebookViewer.LookupPage(userInfo);
                    folderViewer.Fill((string)xml.Attributes["path"], xml.BodyText);
                    break;
                }
            });
        }
        public void OnSndEvent(PeerSocket peer, XmlRequest xml)
        {
            Gtk.Application.Invoke(delegate {
                string what = (string)xml.Attributes["what"];

                if (what == "folder-list")
                {
                    UserInfo userInfo         = peer.Info as UserInfo;
                    FolderViewer folderViewer = notebookViewer.LookupPage(userInfo);
                    folderViewer.Fill((string)xml.Attributes["path"], xml.BodyText);
                }
                else if (what == "file")
                {
                    try {
                        DownloadManager.GetFilePart(peer, xml);
                    } catch (Exception e) {
                        Glue.Dialogs.MessageError("Download File Part", e.Message);
                    }
                }
            });
        }