Exemple #1
0
        public void Run()
        {
            model     = new FileTransferModel();
            view      = new FileTransferView();
            presenter = new FileTransferPresenter(model, view);

            DialogResult result = view.ShowDialog();

            if (result == DialogResult.Cancel)
            {
                Application.Exit();
            }
        }
Exemple #2
0
        public void RunCombinedView()
        {
            Form form = new Form();

            SessionData session = new SessionData
            {
                SessionId   = "Test/SessionId",
                SessionName = "Test SessionName",
                Username    = ScpConfig.UserName,
                Password    = ScpConfig.Password,
                Host        = ScpConfig.KnownHost,
                Port        = 22
            };

            FileTransferPresenter fileTransferPresenter = new FileTransferPresenter(ScpConfig.DefaultOptions);

            FileTransferView fileTransferView = new FileTransferView(fileTransferPresenter)
            {
                Dock = DockStyle.Bottom
            };
            BrowserView localBrowserView = new BrowserView(
                new BrowserPresenter("Local", new LocalBrowserModel(), session, fileTransferPresenter),
                new BrowserFileInfo(new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.Desktop))))
            {
                Dock = DockStyle.Fill
            };

            BrowserView remoteBrowserView = new BrowserView(
                new BrowserPresenter("Remote", new RemoteBrowserModel(ScpConfig.DefaultOptions), session,
                                     fileTransferPresenter),
                RemoteBrowserModel.NewDirectory("/home/" + ScpConfig.UserName))
            {
                Dock = DockStyle.Fill
            };

            SplitContainer browserPanel = new SplitContainer()
            {
                Dock             = DockStyle.Fill,
                SplitterDistance = 75,
            };

            browserPanel.Panel1.Controls.Add(localBrowserView);
            browserPanel.Panel2.Controls.Add(remoteBrowserView);

            form.Controls.Add(browserPanel);
            form.Controls.Add(fileTransferView);
            form.Size = new Size(1024, 768);
            form.Show();
        }