private void Click_Transfers(object sender, EventArgs e) { foreach (ListInstanceItem item in ListInstances.SelectedItems) { TransferView.Show(item.Core.Network); } }
public void Transfer_Test() { var consoleMock = new Mock <IShell>(); consoleMock.SetupSequence(c => c.ReadLine()) .Returns("1111") .Returns("2222") .Returns("2000"); var repoMock = new Mock <IRepository>(); var senderAccMock = new Mock <IAccount>(); var receiverAccMock = new Mock <IAccount>(); var factoryMock = new Mock <IAccountFactory>(); var trasferMock = new Mock <ITransferService>(); repoMock.Setup(r => r.GetAccount(1111, factoryMock.Object)).Returns(senderAccMock.Object); repoMock.Setup(r => r.GetAccount(2222, factoryMock.Object)).Returns(receiverAccMock.Object); trasferMock.Setup(t => t.Transfer(senderAccMock.Object, receiverAccMock.Object, 2000)); var transferView = new TransferView("fool", consoleMock.Object, repoMock.Object, factoryMock.Object, trasferMock.Object); transferView.Show(); repoMock.VerifyAll(); trasferMock.VerifyAll(); }
private void SharedFiles_MouseClick(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Right) { return; } if (SharedFiles.SelectedItems.Count == 0) { return; } ShareItem item = SharedFiles.SelectedItems[0] as ShareItem; if (item == null) { return; } ContextMenuStripEx menu = new ContextMenuStripEx(); if (item.Share.Public) { menu.Items.Add(new ToolStripMenuItem("Make Private", null, new EventHandler(Menu_MakePrivate))); } else { menu.Items.Add(new ToolStripMenuItem("Make Public", null, new EventHandler(Menu_MakePublic))); } menu.Items.Add(new ToolStripMenuItem("Copy File Link", null, new EventHandler(Menu_CopyFileLink))); menu.Items.Add("-"); if (File.Exists(Sharing.GetFilePath(item.Share))) { menu.Items.Add(new ToolStripMenuItem("Open", null, (s, ea) => SharedFiles.SelectedItems.ForEach(i => Sharing.OpenFile(UserID, ((ShareItem)i).Share)))); if (item.Share.SystemPath != null) { menu.Items.Add(new ToolStripMenuItem("Open Containing Folder", null, (s, ea) => Utilities.OpenFolder(Path.GetDirectoryName(item.Share.SystemPath)))); } } else { menu.Items.Add(new ToolStripMenuItem("Try Download", null, (s, ea) => SharedFiles.SelectedItems.ForEach(i => Sharing.DownloadFile(UserID, ((ShareItem)i).Share)))); } if (item.Share.TransferActive) { menu.Items.Add(new ToolStripMenuItem("Transfer Details", null, (s, ea) => TransferView.Show(Core.Network))); } if (Local && item.Share.ClientID == Core.Network.Local.ClientID) { menu.Items.Add(new ToolStripMenuItem("Rename", null, new EventHandler(Menu_Rename))); menu.Items.Add("-"); menu.Items.Add(new ToolStripMenuItem("Remove", null, new EventHandler(Menu_Remove))); } if (menu.Items.Count > 0) { menu.Show(SharedFiles, e.Location); } }