コード例 #1
0
ファイル: ConnectionsPage.cs プロジェクト: tabrath/meshwork
        private void ConnectionListInformationFunc(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            ITransport transport = (ITransport)model.GetValue(iter, 0);

            if (transport.Operation is LocalNodeConnection)
            {
                LocalNodeConnection connection = (LocalNodeConnection)transport.Operation;
                if (connection.NodeRemote != null)
                {
                    (cell as CellRendererText).Text = String.Format("{0} on {1}, {2}, {3} ms",
                                                                    connection.NodeRemote.NickName,
                                                                    transport.Network.NetworkName,
                                                                    connection.ConnectionState.ToString(),
                                                                    connection.Latency.ToString());
                }
                else
                {
                    (cell as CellRendererText).Text = String.Empty;
                }
            }
            else if (transport.Operation is FileTransferOperation)
            {
                FileTransferOperation operation = (FileTransferOperation)transport.Operation;
                (cell as CellRendererText).Text = String.Format("{0} on {1}", operation.Peer.Node.NickName, operation.Transfer.File.Name);
            }
            else
            {
                (cell as CellRendererText).Text = String.Empty;
            }

            SetConnectionListCellBackground((CellRendererText)cell, transport);
        }
コード例 #2
0
        public void PerformFileTransferOperation(FileTransfer fileTransfer, FileTransferOperation operation)
        {
            CheckDisposed();

            if (fileTransfer == null)
            {
                throw new ArgumentNullException(nameof(fileTransfer));
            }

            CheckConnected();

            string tag = operation.ToString().ToLower() + "_file_transfer";

            XElement request = new XElement(tag,
                                            new XElement("project_url", fileTransfer.ProjectUrl),
                                            new XElement("filename", fileTransfer.Name));

            CheckResponse(PerformRpc(request));
        }