ClientsLibrary中提供的账户选择功能,支持选择所有,按工厂选择,按角色选择。

This commit is contained in:
dathlin
2017-10-15 21:07:22 +08:00
parent 5a5aeca134
commit 1ec5d80fc3
3 changed files with 12 additions and 6 deletions

View File

@@ -16,13 +16,18 @@ namespace ClientsLibrary
{ {
#region Constructor #region Constructor
/// <summary>
public FormAccountSelect(List<string> selected = null) /// 实例化一个选择服务器账户的窗口,该窗口可以根据工厂属性或是角色属性来筛选
/// </summary>
/// <param name="condition"></param>
/// <param name="selected"></param>
public FormAccountSelect(string condition = null, List<string> selected = null)
{ {
InitializeComponent(); InitializeComponent();
Icon = UserSystem.GetFormWindowIcon(); Icon = UserSystem.GetFormWindowIcon();
m_selected = selected; m_selected = selected;
m_condition = condition;
} }
@@ -35,7 +40,7 @@ namespace ClientsLibrary
{ {
// 初始化 // 初始化
OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode., ""); OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(CommonHeadCode.SimplifyHeadCode., m_condition);
if (result.IsSuccess) if (result.IsSuccess)
{ {
List<UserAccount> accounts = JArray.Parse(result.Content).ToObject<List<UserAccount>>(); List<UserAccount> accounts = JArray.Parse(result.Content).ToObject<List<UserAccount>>();
@@ -136,6 +141,7 @@ namespace ClientsLibrary
private List<string> m_selected; private List<string> m_selected;
private List<UserAccount> m_result; private List<UserAccount> m_result;
private string m_condition;
#endregion #endregion

View File

@@ -183,9 +183,9 @@ namespace ClientsLibrary.Configuration
if (listBox1.SelectedItem is RoleItem role) if (listBox1.SelectedItem is RoleItem role)
{ {
// select account // select account
using (FormAccountSelect form = new FormAccountSelect(role.Accounts)) using (FormAccountSelect form = new FormAccountSelect(null, role.Accounts))
{ {
if(form.ShowDialog() == DialogResult.OK) if (form.ShowDialog() == DialogResult.OK)
{ {
role.Accounts = form.SelectAccounts.ConvertAll(m => m.UserName); role.Accounts = form.SelectAccounts.ConvertAll(m => m.UserName);
listBox2.DataSource = role.Accounts; listBox2.DataSource = role.Accounts;

View File

@@ -42,7 +42,7 @@ namespace CommonLibrary
* *
**************************************************************************/ **************************************************************************/
SoftBasic.FrameworkVersion = new SystemVersion("1.6.14"); SoftBasic.FrameworkVersion = new SystemVersion("1.6.15");
} }