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

📄 sendfiletoselfform.cs

📁 飞信的收发使用csharp进行开发
💻 CS
字号:
namespace Imps.Client.Pc
{
    using Imps.Client.Core;
    using Imps.Client.Pc.BizControls;
    using Imps.Client.Pc.Controls;
    using Imps.Client.Resource;
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class SendFileToSelfForm : XIMDialog
    {
        private IFrameworkWindow _framworkWnd;
        private UploadShareContent _sc;
        private XButton btnCancel;
        private IContainer components;
        private Label lblSendFileStatus;
        private Panel panel1;
        private ProgressBar proSendPercent;

        public SendFileToSelfForm(UploadShareContent sc, IFrameworkWindow framworkWnd)
        {
            this.InitializeComponent();
            this._framworkWnd = framworkWnd;
            this.initComponentRegion();
            this._sc = sc;
            this._sc.ShareContentComplete += new EventHandler(this._sc_ShareContentComplete);
            this._sc.ShareContentFailed += new EventHandler<ShareContentFailedEventArgs>(this._sc_ShareContentFailed);
            this._sc.ShareContentProgress += new EventHandler<ShareContentProcessEventArgs>(this._sc_ShareContentProgress);
            this.proSendPercent.Value = 0;
        }

        private void _sc_ShareContentComplete(object sender, EventArgs e)
        {
            if (!base.IsDisposed)
            {
                this.lblSendFileStatus.Text = "发送完成!";
                this.btnCancel.Text = "关闭";
            }
        }

        private void _sc_ShareContentFailed(object sender, ShareContentFailedEventArgs e)
        {
            if (!base.IsDisposed)
            {
                this.lblSendFileStatus.Text = "发送失败!";
                this._framworkWnd.UnifiedMessageBox.ShowInfo(this, "发送文件失败!");
                base.Close();
            }
        }

        private void _sc_ShareContentProgress(object sender, ShareContentProcessEventArgs e)
        {
            if (!base.IsDisposed)
            {
                this.proSendPercent.Value = Convert.ToInt32((float) (e.Percent * 100f));
            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            base.Close();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            this.components = new Container();
            ComponentResourceManager manager = new ComponentResourceManager(typeof(SendFileToSelfForm));
            this.panel1 = new Panel();
            this.lblSendFileStatus = new Label();
            this.proSendPercent = new ProgressBar();
            this.btnCancel = new XButton();
            this.panel1.SuspendLayout();
            base.SuspendLayout();
            this.panel1.BackColor = Color.Transparent;
            this.panel1.Controls.Add(this.btnCancel);
            this.panel1.Controls.Add(this.proSendPercent);
            this.panel1.Controls.Add(this.lblSendFileStatus);
            this.panel1.Dock = DockStyle.Fill;
            this.panel1.Location = new Point(6, 0x1f);
            this.panel1.Name = "panel1";
            this.panel1.Size = new Size(0x13e, 0x68);
            this.panel1.TabIndex = 2;
            this.lblSendFileStatus.AutoSize = true;
            this.lblSendFileStatus.Location = new Point(13, 11);
            this.lblSendFileStatus.Name = "lblSendFileStatus";
            this.lblSendFileStatus.Size = new Size(0x55, 13);
            this.lblSendFileStatus.TabIndex = 0;
            this.lblSendFileStatus.Text = "发送文件中......";
            this.proSendPercent.Location = new Point(0x10, 0x1c);
            this.proSendPercent.Name = "proSendPercent";
            this.proSendPercent.Size = new Size(0x11a, 0x13);
            this.proSendPercent.TabIndex = 1;
            this.proSendPercent.Value = 50;
            this.btnCancel.Location = new Point(0x75, 0x3a);
            this.btnCancel.Name = "btnCancel";
            this.btnCancel.Size = new Size(0x4c, 0x19);
            this.btnCancel.TabIndex = 5;
            this.btnCancel.Text = "取消(&N)";
            this.btnCancel.UseVisualStyleBackColor = true;
            this.btnCancel.Click += new EventHandler(this.btnCancel_Click);
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(0x157, 0x8f);
            base.Controls.Add(this.panel1);
            base.Icon = (Icon) manager.GetObject("$this.Icon");
            base.MinimizeBox = false;
            base.Name = "SendFileToSelfForm";
            base.Padding = new Padding(6, 0x1f, 0x13, 8);
            base.StartPosition = FormStartPosition.Manual;
            base.Text = "SendFileToSelfForm";
            base.Controls.SetChildIndex(this.panel1, 0);
            base.Controls.SetChildIndex(base.menubar, 0);
            this.panel1.ResumeLayout(false);
            this.panel1.PerformLayout();
            base.ResumeLayout(false);
        }

        protected override void OnFormClosed(FormClosedEventArgs e)
        {
            if (this._sc != null)
            {
                this._sc.ShareContentComplete -= new EventHandler(this._sc_ShareContentComplete);
                this._sc.ShareContentFailed -= new EventHandler<ShareContentFailedEventArgs>(this._sc_ShareContentFailed);
                this._sc.ShareContentProgress -= new EventHandler<ShareContentProcessEventArgs>(this._sc_ShareContentProgress);
                this._sc.Close();
            }
            this._sc = null;
            base.OnFormClosed(e);
        }

        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            if ((((this._sc != null) && !this._sc.Complete) && (!this._sc.IsFailed && !this._sc.IsCancel)) && (this._framworkWnd.UnifiedMessageBox.ShowConfirmation(this, StringTable.Conversation.MsgShareContentConfirmCloseForm) != DialogResult.Yes))
            {
                e.Cancel = true;
            }
            else
            {
                base.OnFormClosing(e);
            }
        }
    }
}

⌨️ 快捷键说明

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