📄 paulsftpcontroller.cs
字号:
namespace FTP.Controller
{
using System;
using System.Windows.Forms;
using FTP.View.DataStructures;
using FTP.View;
using FTP.Model;
public class PaulsFTPController
{
private PaulsFTPView paulsFTPView;
private PaulsFTPModel paulsFTPModel;
// The Main method
[STAThread]
public static void Main()
{
PaulsFTPController controller = new PaulsFTPController();
}
public PaulsFTPController()
{
// Create a view object;
paulsFTPView = new PaulsFTPView(this);
paulsFTPModel = new PaulsFTPModel();
// Initialise the Models delegates
paulsFTPModel.pushChangesToView = new PaulsFTPModel.PushChangesToView(paulsFTPView.processChangesFromModel);
paulsFTPModel.pullStateFromView = new PaulsFTPModel.PullStateFromView(paulsFTPView.PullStateFromPanels);
// Ensure the view gets updated from the model
paulsFTPModel.pushChanges();
// Run the application
Application.Run(paulsFTPView);
}
public void processUserGesture(UserGesture pUserGesture)
{
if (paulsFTPModel==null) return;
switch (pUserGesture.command.ToUpper())
{
case "CONNECT":
paulsFTPModel.connect();
break;
case "LIST":
paulsFTPModel.commandLIST();
break;
case "DOWNLOAD":
paulsFTPModel.commandRETR();
break;
case "UPLOADFROM":
paulsFTPModel.commandSTOR(); // Will flush its cache and perform a LIST
break;
case "MKD":
paulsFTPModel.commandMKD(); // Make the directory
paulsFTPModel.commandLIST(); // Retrieve the file list
break;
case "RMD":
paulsFTPModel.commandRMD(); // Remove the directory
paulsFTPModel.commandLIST(); // Retrieve the file list
break;
case "DELE":
paulsFTPModel.commandDELE(); // Remove the directory
paulsFTPModel.commandLIST(); // Retrieve the file list
break;
case "CWD":
paulsFTPModel.commandCWD(); // Change the directory
paulsFTPModel.commandLIST(); // Retrieve the file list
break;
case "REFRESH":
paulsFTPModel.pullStateFromView();
paulsFTPModel.pushChanges();
break;
}
}
public void requestViewRefresh()
{
// Tell the model to update the view
this.paulsFTPModel.pushChanges();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -