# FirstView

FirstView Static Function

Task FirstView.Connect(Server server)

Connect to a server directly, you can await this function.

// Create Google Drive server and connect it with FirstView Server google_server = new Server { Protocol = ServerProtocol.GoogleDrive}; FirstView.Connect(google_server);

Task FirstView.Connect(string sitename)

Connect to a server by name in the Site Manager, you can await this function.

The name should be the full path name.

For exmple, if you have a "demo" site under a "Test" folder in the Site Manager dialog, you must use "Test/demo" as the site name.

Server google_server = new Server { Protocol = ServerProtocol.GoogleDrive}; // Create Google Drive server Site.Add("Test/demo",google_server); // Add to Site Manager FirstView.Connect("Test/demo"); // Connect by the name of server

Server FirstView.GetServer()

Get the current connected server.

Task FirstView.Disconnect()

Disconnect from server.

void FirstView.Cancel()

Cancel the currently executing action.

void FirstView.SwitchToLocal()

Switch to local mode.

void FirstView.SwitchToServer()

Switch to server mode.

string FirstView.CurrentDir()

Get the current directory.

ObservableCollection<RushFileInfo> FirstView.FileList()

Get the current file list.

Task FirstView.ChangeDir(string dir)

Change current directory, you can await this function. The dir parameter can be a relative path to current dirctory or an absolute path start with "/".

Task FirstView.CreateDir(string dir)

Create a directory, the dir parameter can be a relative path to current dirctory or an absolute path start with "/".

Task FirstView.DeleteFile(string filepath)

Delete file, the filepath parameter can be a relative path to current dirctory or an absolute path start with "/".

Task FirstView.DeleteDir(string dirpath)

Delete directory, the dirpath parameter can be a relative path to current dirctory or an absolute path start with "/".

Task FirstView.RenameFile(string oldname,string newname)

Rename a file from oldname to newname, these parameters can be relative path to current dirctory or absolute path start with "/".

Task FirstView.RenameDir(string oldname,string newname)

Rename a directory from oldname to newname, these parameters can be relative path to current dirctory or absolute path start with "/".

void FirstView.TransferFile(string name)

Transfer the specified file immediately.

The name parameter can be a relative path to current dirctory or an absolute path start with "/".

//This script will first set Secondview to local mode and switch to the "Documents" directory, //then let FirstView connect to the demo.wftpserver.com server and switch to the "download" directory. //Finally start to download "Autumn.jpg" and "Spring.jpg". SecondView.SwitchToLocal(); await SecondView.ChangeDir("~Documents"); Server source = new Server{ Host ="demo.wftpserver.com", Username="demo", Password="demo" }; await FirstView.Connect(source); await FirstView.ChangeDir("download"); FirstView.TransferFile("Autumn.jpg"); FirstView.TransferFile("/download/Spring.jpg");

void FirstView.TransferDir(string name)

Transfer the directory immediately.

The name parameter can be a relative path to current dirctory or an absolute path start with "/".

//This script will first set Secondview to local mode and switch to the "Documents" directory, //then let FirstView connect to the demo.wftpserver.com server and transfer the "download" directory. SecondView.SwitchToLocal(); await SecondView.ChangeDir("~Documents"); Server source = new Server{ Host ="demo.wftpserver.com", Username="demo", Password="demo" }; await FirstView.Connect(source); FirstView.TransferDir("download");

void FirstView.QueueFile(string name)

Put the specified file to the transfer queue.

It will start transferring the next time you start processing the queue.

void FirstView.QueueDir(string name)

Put the specified directory to the transfer queue.

It will start transferring the next time you start processing the queue.