📄 frmsettings.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using feiyun0112.cnblogs.com.CSDNReader.Model;
using feiyun0112.cnblogs.com.CSDNReader.Functions;
namespace feiyun0112.cnblogs.com.CSDNReader
{
public partial class frmSettings : Form
{
public frmSettings()
{
InitializeComponent();
txtMaxTopicReplies.Text =Setting.MaxTopicReplies.ToString();
txtMinTopicPoint.Text =Setting.MinTopicPoint.ToString();
txtSignature.Text =Setting.Signature;
//代理
chkUseProxy.Checked = Setting.UseProxy;
grpProxy.Enabled = chkUseProxy.Checked;
txtProxyServer.Text = Setting.ProxyServer;
txtProxyPort.Text = Setting.ProxyPort ;
txtProxyUsername.Text = Setting.ProxyUsername;
txtProxyPassword.Text = Setting.ProxyPassword;
//设置
chkMarkAllReaded.Checked = Setting.MarkAllReaded;
chkShowTopicTab.Checked = Setting.ShowTopicTab;
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnOK_Click(object sender, EventArgs e)
{
if (!ValidCheck())
{
return;
}
SettingFunc func = new SettingFunc();
func.SetSetting("MaxTopicReplies", txtMaxTopicReplies.Text);
func.SetSetting("MinTopicPoint", txtMinTopicPoint.Text);
func.SetSetting("Signature", txtSignature.Text);
//代理
func.SetSetting("UseProxy", chkUseProxy.Checked.ToString());
func.SetSetting("ProxyServer", txtProxyServer.Text);
func.SetSetting("ProxyPort", txtProxyPort.Text);
func.SetSetting("ProxyUsername", txtProxyUsername.Text);
func.SetSetting("ProxyPassword", txtProxyPassword.Text);
//设置
func.SetSetting("MarkAllReaded", chkMarkAllReaded.Checked.ToString());
func.SetSetting("ShowTopicTab", chkShowTopicTab.Checked.ToString());
this.DialogResult = DialogResult.OK;
}
private void chkUseProxy_CheckedChanged(object sender, EventArgs e)
{
grpProxy.Enabled = chkUseProxy.Checked;
}
private bool ValidCheck()
{
try
{
if (!CommonFunc.IsNumeric(txtMinTopicPoint.Text))
{
MsgFunc.ShowWarning("请输入最低分数!");
return false;
}
if (!CommonFunc.IsNumeric(txtMaxTopicReplies.Text))
{
MsgFunc.ShowWarning("请输入最大回复数!");
return false;
}
if (chkUseProxy.Checked)
{
if (txtProxyServer.Text.Length == 0)
{
MsgFunc.ShowWarning("请输入代理服务器地址!");
return false;
}
if (txtProxyPort.Text.Length == 0)
{
MsgFunc.ShowWarning("请输入代理服务器端口!");
return false;
}
if (!CommonFunc.IsNumeric(txtProxyPort.Text))
{
MsgFunc.ShowWarning("请输入代理服务器端口!");
return false;
}
}
}
catch
{
return false;
}
return true;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -