123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- using LYFZ.ComponentLibrary;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.Software.UI.DoorCityProcess
- {
- public partial class FTPUpFileForm : LYFZ.ComponentLibrary.BaseContentsFormMain
- {
- protected List<CheckBoxEx> cbItems = new List<CheckBoxEx>();
- protected List<RadioButtonEx> rbFtpItems = new List<RadioButtonEx>();
- protected List<CheckBoxEx> cbBranchItems = new List<CheckBoxEx>();
- int localHeight = 0;
- protected float gbBoxHeight = 0;
- public FTPUpFileForm()
- {
- InitializeComponent();
- //cbItems.Add(cb_Scene);
- this.Shown += FTPUpFileForm_Shown;
- localHeight = this.Height;
- gbBoxHeight = gb_FTPInfo.Height;
- }
- void FTPUpFileForm_Shown(object sender, EventArgs e)
- {
- btn_cancel.Click += btn_Click;
- btn_Upfile.Click += btn_Click;
- cb_Scene.Click += cb_Scene_Click;
- CheckAndCloseFrm();
- }
- void CheckAndCloseFrm()
- {
- bool b = false;
- foreach (var mod in cbItems)
- {
- b = (mod.Enabled);
- if(b)
- {
- break;
- }
- }
- if (!b)
- {
- MessageBoxCustom.Show("没有找到相应文件,传片操作退出。");
- DialogResult = System.Windows.Forms.DialogResult.No;
- }
- }
- void cb_Scene_Click(object sender, EventArgs e)
- {
-
- foreach (var item in cbItems)
- {
- if (item.Enabled)
- {
- item.Checked = cb_Scene.Checked;
- }
- }
- }
- void btn_Click(object sender, EventArgs e)
- {
- switch(((ButtonEx)sender).Text)
- {
- case "取消":
- ButtonCancel(sender, e);
- break;
- case "上传":
- ButtonUpFile(sender, e);
- break;
- }
- }
- /// <summary>
- ///按钮点击上传
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- public virtual void ButtonCancel(object sender, EventArgs e)
- {
- this.DialogResult = System.Windows.Forms.DialogResult.No;
- this.Close();
- }
- /// <summary>
- /// 按钮点击取消
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- public virtual void ButtonUpFile(object sender, EventArgs e)
- {
- //CheckBoxEx cb = new CheckBoxEx();
- //AddCheckBoxModel(cb);
- this.DialogResult = System.Windows.Forms.DialogResult.OK;
- }
- /// <summary>
- /// 动态添加场景
- /// </summary>
- /// <param name="cbEx"></param>
- public virtual void AddCheckBoxModel(CheckBoxEx cbEx)
- {
- cbEx.Text=cbEx.Text.Replace(",", ",");
- cbItems.Add(cbEx);
- cbEx.AutoSize = true;
- int autoHeight = 0;
- if(cbItems.Count>0)
- {
- autoHeight += cbEx.Height * (cbItems.Count );
- groupBoxEx1.Controls.Add(cbEx);
- cbEx.Location = new Point(cb_Scene.Location.X, cb_Scene.Location.Y + cbEx.Height * (cbItems.Count ));
- }
- this.Size = new Size(this.Width, localHeight + autoHeight);
- }
- public virtual RadioButtonEx AddCheckBoxByFtpInfo(DataRow dr)
- {
- RadioButtonEx cbex = new RadioButtonEx();
- cbex.Text = dr["Company_Name"].ToString() + "(" + dr["FTP_Name"].ToString() + ")账户";
- cbex.AutoSize = true;
- cbex.Tag = dr;
- rbFtpItems.Add(cbex);
- this.gb_FTPInfo.Controls.Add(cbex);
- return cbex;
- }
- public virtual void FTPUpFileForm_Load(object sender, EventArgs e)
- {
- }
- }
- }
|