// 创建同步设置面板 private void CreateSyncSettingPanel() { // 创建同步目录文本框 CharmTextBox txtSyncDir = new CharmTextBox { Location = new Point(127 + MENU_WIDTH, 20 + TITLE_HEIGHT), Width = 260 }; // 创建浏览路径按钮 CharmButton btnViewPath = new CharmButton { ButtonType = ButtonType.Classic_Size_08223, Text = "浏览路径", ForeColor = Color.DarkGreen, Location = new Point(399 + MENU_WIDTH, 22 + TITLE_HEIGHT) }; // 创建同步周期文本框 CharmTextBox txtSyncCycle = new CharmTextBox { Location = new Point(127 + MENU_WIDTH, 55 + TITLE_HEIGHT), Width = 50, TextInputMode = InputMode.Integer, MaxLength = 5, TextAlign = HorizontalAlignment.Center }; // 创建空间名称文本框 CharmTextBox txtBucket = new CharmTextBox { Location = new Point(290 + MENU_WIDTH, 55 + TITLE_HEIGHT), Width = 95, }; // 创建私有空间检查框 CharmCheckBox chkPrivateBucket = new CharmCheckBox { Location = new Point(400 + MENU_WIDTH, 57 + TITLE_HEIGHT), Text = "私有空间" }; // 创建同步前缀文本框 CharmTextBox txtPrefix = new CharmTextBox { Location = new Point(150 + MENU_WIDTH, 90 + TITLE_HEIGHT), Width = 95, }; // 创建监控变动检查框 CharmCheckBox chkCaptureChange = new CharmCheckBox { Location = new Point(260 + MENU_WIDTH, 92 + TITLE_HEIGHT), Text = "监控目录文件变化" }; // 创建立即同步按钮 CharmButton btnSyncNow = new CharmButton { ButtonType = ButtonType.Classic_Size_08223, Text = "立即同步", ForeColor = Color.Purple, Location = new Point(399 + MENU_WIDTH, 92 + TITLE_HEIGHT) }; // 创建 AccessKey 文本框 CharmTextBox txtAccessKey = new CharmTextBox { Location = new Point(127 + MENU_WIDTH, 160 + TITLE_HEIGHT), Width = 260, TextInputMode = InputMode.Password }; // 创建查看 AccessKey 按钮 CharmButton btnViewAccessKey = new CharmButton { ButtonType = ButtonType.Classic_Size_08223, Text = "查看密钥", ForeColor = Color.Red, Location = new Point(399 + MENU_WIDTH, 162 + TITLE_HEIGHT) }; // 创建 SecretKey 文本框 CharmTextBox txtSecretKey = new CharmTextBox { Location = new Point(127 + MENU_WIDTH, 195 + TITLE_HEIGHT), Width = 260, TextInputMode = InputMode.Password }; // 创建查看 SecretKey 按钮 CharmButton btnViewSecretKey = new CharmButton { ButtonType = ButtonType.Classic_Size_08223, Text = "查看密钥", ForeColor = Color.Red, Location = new Point(399 + MENU_WIDTH, 197 + TITLE_HEIGHT) }; // 创建七牛开发平台链接标签 CharmLinkLabel lblQiniuOpen = new CharmLinkLabel { Location = new Point(280, 265), ForeColor = Color.Blue, Text = "七牛云存储开发者平台" }; // 关联控件事件 txtSyncDir.TextChanged += txtSyncDir_TextChanged; btnViewPath.MouseClick += btnViewPath_MouseClick; txtSyncCycle.TextChanged += txtSyncDir_TextChanged; txtBucket.TextChanged += txtSyncDir_TextChanged; chkPrivateBucket.MouseClick += chkPrivateBucket_MouseClick; lblQiniuOpen.MouseClick += lblQiniuOpen_MouseClick; txtAccessKey.TextChanged += txtSyncDir_TextChanged; btnViewAccessKey.MouseClick += btnViewAccessKey_MouseClick; txtSecretKey.TextChanged += txtSyncDir_TextChanged; btnViewSecretKey.MouseClick += btnViewSecretKey_MouseClick; txtPrefix.TextChanged += txtSyncDir_TextChanged; chkCaptureChange.MouseClick += chkPrivateBucket_MouseClick; btnSyncNow.MouseClick += btnSyncNow_MouseClick; // 将控件添加到集合中 this.Controls.Add(txtSyncDir); this.Controls.Add(txtSyncCycle); this.Controls.Add(txtAccessKey); this.Controls.Add(txtSecretKey); this.Controls.Add(txtBucket); this.Controls.Add(txtPrefix); // 创建同步设置面板控件集合 mSyncSettingControls = new List<Control> { txtSyncDir, txtSyncCycle, txtAccessKey, txtSecretKey, txtBucket, txtPrefix }; mSyncSettingCharmControls = new List<CharmControl> { btnViewPath, lblQiniuOpen, btnViewAccessKey, btnViewSecretKey, chkPrivateBucket, chkCaptureChange, btnSyncNow }; }
// 初始化设置 private void InitializeSetting() { // 设置窗体属性 this.Icon = Properties.Resources.icon; this.Text = "过滤规则测试"; // 绘制窗体背景 DrawFormBackground(); #region 创建窗体组件 // 创建关闭系统按钮 CharmSysButton btnClose = new CharmSysButton { SysButtonType = SysButtonType.Close, ToolTipText = "关闭", Location = new Point(this.Width - 44, 1) }; // 创建测试目录文本框 CharmTextBox txtTestDir = new CharmTextBox { Location = new Point(110, 10 + TITLE_HEIGHT), Width = 330 }; // 创建浏览路径按钮 CharmButton btnViewPath = new CharmButton { ButtonType = ButtonType.Classic_Size_08223, Text = "浏览路径", ForeColor = Color.DarkGreen, Location = new Point(455, 12 + TITLE_HEIGHT) }; // 创建测试规则按钮 CharmButton btnTest = new CharmButton { ButtonType = ButtonType.Classic_Size_12425, Text = "开始测试规则", ForeColor = Color.MediumSlateBlue, Location = new Point(420, 435), }; // 将控件添加到集合中 this.Controls.Add(txtTestDir); // 创建控件集合 mControls = new List<Control> { txtTestDir }; mCharmControls = new List<CharmControl> { btnClose, btnViewPath, btnTest }; // 关联控件事件 btnClose.MouseClick += btnClose_MouseClick; btnViewPath.MouseClick += btnViewPath_MouseClick; btnTest.MouseClick += btnTest_MouseClick; #endregion // 加载本地设置 LoadLocalSetting(); }