⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 paulsftpview.cs

📁 ftp上传的c#程序. ftp上传的c#程序.
💻 CS
字号:
namespace FTP.View 
{
	using System;
	using System.IO;
	using System.Windows.Forms;
	using System.Drawing;
	using System.Diagnostics;
	using System.Threading; 
	using System.Resources;
	using FTP.Model.DataStructures;
	using FTP.View.VisibleControls;
	using FTP.Controller;

	public class PaulsFTPView : System.Windows.Forms.Form 
	{
		// Main member classes
		public	  ModelViewState      ftpModelViewState;
		private   HandleUserGestures  handleUserGestures;

		// The meunu
		private FTP.View.VisibleControls.MainMenu         mForm;

		// Panels and splitters
		private FTP.View.VisibleControls.AbstractPanel    pnlConnectionBar;
		private Panel     pnlTop;
		private FTP.View.VisibleControls.AbstractPanel    pnlTopLeft;
		private FTP.View.VisibleControls.AbstractPanel    pnlTopRight;
		private FTP.View.VisibleControls.AbstractPanel    pnlBottom;
		private Splitter  splLeftRight;
		private System.Windows.Forms.ImageList imageList1;
		private System.ComponentModel.IContainer components;
		private Splitter  splTopBottom;
    
		public PaulsFTPView(PaulsFTPController  pFTPController) 
		{
			this.handleUserGestures = new HandleUserGestures(this, pFTPController, ref this.ftpModelViewState);
			this.CreateComponents();
			// Event handling takes over from here
		}

		private void CreateComponents() 
		{
			pnlConnectionBar    = new FTP.View.VisibleControls.ConnectionBar(this.handleUserGestures);
			pnlConnectionBar.Size = new Size(900,30);
			pnlConnectionBar.Dock = DockStyle.Top;
      
			pnlTop        = buildTopPanel(); 
			pnlTop.Dock   =  DockStyle.Fill;

			splTopBottom  = new Splitter();
			splTopBottom.Dock = DockStyle.Bottom;

			pnlBottom       = new FTP.View.VisibleControls.CommandSummary(handleUserGestures); 
			pnlBottom.Size  = new Size(1000,150);
			pnlBottom.Dock  = DockStyle.Bottom;

			this.Controls.Add(pnlTop);
			this.Controls.Add(splTopBottom);
			this.Controls.Add(pnlBottom);
			this.Controls.Add(pnlConnectionBar);

			//Instantiating Main Menu and Toolbar
			mForm = new FTP.View.VisibleControls.MainMenu(this.handleUserGestures);
			this.Menu = mForm;

			// Setup the Form    
			this.Text = "Pauls FTP (C# Example)";
			this.Size = new Size(1000,700);
			this.StartPosition	= FormStartPosition.CenterScreen;
			this.Show();
		}

		private Panel buildTopPanel() 
		{

			pnlTopLeft        = new FTP.View.VisibleControls.PanelTreeView(handleUserGestures);
			pnlTopLeft.Dock   = DockStyle.Fill;
      
			splLeftRight      = new Splitter();
			splLeftRight.Dock = DockStyle.Right;

			pnlTopRight       = new FTP.View.VisibleControls.PanelListView(handleUserGestures);
			pnlTopRight.Dock  = DockStyle.Right;
			pnlTopRight.Size   = new Size(600,100);

			Panel newPanel  = new Panel();

			newPanel.Controls.Add(pnlTopLeft);
			newPanel.Controls.Add(splLeftRight);
			newPanel.Controls.Add(pnlTopRight);
      
			return newPanel;
		}

		// Event for Closing Form
		protected void eventCloseForm(object pSender, EventArgs pArgs) 
		{
      
		}


		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(PaulsFTPView));
			this.imageList1 = new System.Windows.Forms.ImageList(this.components);
			// 
			// imageList1
			// 
			this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
			this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
			this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
			this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
			// 
			// PaulsFTPView
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(292, 273);
			this.Name = "PaulsFTPView";

		}

		// This method is called from the Model as a delgate
		public void processChangesFromModel(ref ModelViewState pFtpViewState) 
		{
			this.ftpModelViewState	= pFtpViewState;

			// Notify all panels to refresh waht they display
			pnlBottom.AcceptModelChanges(pFtpViewState);
			pnlConnectionBar.AcceptModelChanges(pFtpViewState);
			pnlTopLeft.AcceptModelChanges(pFtpViewState);
			pnlTopRight.AcceptModelChanges(pFtpViewState);
			mForm.AcceptModelChanges(pFtpViewState);
		}

		public void PullStateFromPanels() 
		{
			// Ask all interest to return the latest state
			pnlBottom.ExtractUserChanges(ref this.ftpModelViewState);
			pnlConnectionBar.ExtractUserChanges(ref this.ftpModelViewState);
			pnlTopRight.ExtractUserChanges(ref this.ftpModelViewState);
			pnlTopLeft.ExtractUserChanges(ref this.ftpModelViewState);
			mForm.ExtractUserChanges(ref this.ftpModelViewState);
		}

	} // End of Class PaulsFTPView
}

/*
    public void MonitorPercentage() {
        byte downloadPercent;
        do {
          downloadPercent = nongui.FileDownloadPercent;
          bConnect.Text = Convert.ToString(downloadPercent);
          Thread.Sleep(500);
          }
        while (downloadPercent != 100);
    }

      case "DOWNLOAD":
        userGesture.command = "DOWNLOAD";

        Thread thread = new Thread(new ThreadStart( nongui.commandRETR )); 
        Thread thread2 = new Thread(new ThreadStart( this.MonitorPercentage )); 
        thread.Start();
        thread2.Start();
      

//        this.tbFtpSummary.Text = nongui.MessagesFromServer;
*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -