账户选择器增加说明,增加选择账户的数量限制功能,v1.6.18
This commit is contained in:
@@ -12,6 +12,25 @@ using System.Windows.Forms;
|
||||
|
||||
namespace ClientsLibrary
|
||||
{
|
||||
|
||||
/**************************************************************************************************
|
||||
*
|
||||
* 时间: 2017年10月17日 08:02:15
|
||||
* 功能说明: 本窗口提供一个账户选择的功能,比如在分配任务时,需要支持分配给某个部门的人,或是分配给
|
||||
* 某个角色权限的人,可以在此处进行账户选择,根据实例化参数的不同来区分
|
||||
* 举例: 选择某个工厂的一个账户,需要这么实例化:FormAccountSelect form = new FormAccountSelect("分厂示例一",1,1,null)
|
||||
* 选择某个角色的一个账户,需要这么实例化:FormAccountSelect form = new FormAccountSelect("2487f33a8f22408ca4bbca5456a7eecb",1,1,null)
|
||||
* 两者区分的条件是判断字符串的长度是否大于等于16
|
||||
* 如果允许选择所有的账户的一个账户,需要这么实例化:FormAccountSelect form = new FormAccountSelect("",1,1,null)
|
||||
* 当然也支持选择多个账户,直至选择完成所有的账户
|
||||
*
|
||||
***************************************************************************************************/
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 账户选择器的类,支持从服务器的账户数据上选择我们需要的账户
|
||||
/// </summary>
|
||||
public partial class FormAccountSelect : Form
|
||||
{
|
||||
#region Constructor
|
||||
@@ -19,15 +38,19 @@ namespace ClientsLibrary
|
||||
/// <summary>
|
||||
/// 实例化一个选择服务器账户的窗口,该窗口可以根据工厂属性或是角色属性来筛选
|
||||
/// </summary>
|
||||
/// <param name="condition"></param>
|
||||
/// <param name="selected"></param>
|
||||
public FormAccountSelect(string condition = null, List<string> selected = null)
|
||||
/// <param name="condition">筛选条件</param>
|
||||
/// <param name="minSelected">选择账户数量的下限</param>
|
||||
/// <param name="multiSelected">选择账户数量的上限</param>
|
||||
/// <param name="selected">已选择的账户名</param>
|
||||
public FormAccountSelect(string condition = null, int minSelected = 0, int maxSelected = int.MaxValue, List<string> selected = null)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Icon = UserSystem.GetFormWindowIcon();
|
||||
m_selected = selected;
|
||||
m_condition = condition;
|
||||
m_MaxSelected = maxSelected;
|
||||
m_MinSelected = minSelected;
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +143,7 @@ namespace ClientsLibrary
|
||||
for (int i = 0; i < dataGridView1.Rows.Count; i++)
|
||||
{
|
||||
DataGridViewRow dgvr = dataGridView1.Rows[i];
|
||||
if(dgvr.Cells[0].Value != null)
|
||||
if (dgvr.Cells[0].Value != null)
|
||||
{
|
||||
if ((bool)dgvr.Cells[0].Value)
|
||||
{
|
||||
@@ -129,6 +152,12 @@ namespace ClientsLibrary
|
||||
}
|
||||
}
|
||||
|
||||
if (m_result.Count < m_MinSelected || m_result.Count > m_MaxSelected)
|
||||
{
|
||||
MessageBox.Show(string.Format(UserLocalization.Localization.FormateBetweenTwoSize, m_MinSelected, m_MaxSelected));
|
||||
return;
|
||||
}
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
@@ -142,6 +171,8 @@ namespace ClientsLibrary
|
||||
private List<string> m_selected;
|
||||
private List<UserAccount> m_result;
|
||||
private string m_condition;
|
||||
private int m_MaxSelected = int.MaxValue;
|
||||
private int m_MinSelected = 0;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ namespace ClientsLibrary.Configuration
|
||||
if (listBox1.SelectedItem is RoleItem role)
|
||||
{
|
||||
// select account
|
||||
using (FormAccountSelect form = new FormAccountSelect(null, role.Accounts))
|
||||
using (FormAccountSelect form = new FormAccountSelect(null, 0, int.MaxValue, role.Accounts))
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace ClientsLibrary
|
||||
/// <summary>
|
||||
/// 本软件的当前版本,用来验证更新的关键依据
|
||||
/// </summary>
|
||||
public static SystemVersion CurrentVersion { get; } = new SystemVersion("1.0.0.171015");
|
||||
public static SystemVersion CurrentVersion { get; } = new SystemVersion("1.0.0.171017");
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -23,6 +23,11 @@ namespace CommonLibrary
|
||||
public string GeneralDescription { get; set; } = "描述";
|
||||
public string GeneralAllowLoginList { get; set; } = "允许登录列表";
|
||||
|
||||
#region 格式化文本
|
||||
|
||||
public string FormateBetweenTwoSize { get; set; } = "选择的数量范围为 {0} - {1}";
|
||||
|
||||
#endregion
|
||||
|
||||
#region 复选框
|
||||
|
||||
|
||||
@@ -23,6 +23,12 @@ namespace CommonLibrary
|
||||
public string GeneralAllowLoginList { get; set; } = "Allow login list";
|
||||
|
||||
|
||||
#region 格式化文本
|
||||
|
||||
public string FormateBetweenTwoSize { get; set; } = "Select count should between {0} and {1}";
|
||||
|
||||
#endregion
|
||||
|
||||
#region 复选框
|
||||
|
||||
public string CheckBoxAllowUserMulti { get; set; } = "Allow an account to log if online (except admin)";
|
||||
|
||||
@@ -93,6 +93,12 @@ namespace CommonLibrary
|
||||
string GeneralAllowLoginList { get; set; }
|
||||
|
||||
|
||||
#region 格式化文本
|
||||
|
||||
string FormateBetweenTwoSize { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region 复选框
|
||||
|
||||
string CheckBoxAllowUserMulti { get; set; }
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace CommonLibrary
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
SoftBasic.FrameworkVersion = new SystemVersion("1.6.17");
|
||||
SoftBasic.FrameworkVersion = new SystemVersion("1.6.18");
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user