using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; using DevExpress.XtraEditors; using UI.Framework.Forms; namespace UserFission { public partial class EditGroupForm : BaseForm { public EditGroupForm(string weixinhao, string groupname = "", string groupnick = "") { InitializeComponent(); this.WeiXinHao = weixinhao; this.GroupName = groupname; this.GroupNick = groupnick; } private void EditGroupForm_Load(object sender, EventArgs e) { textEdit1.Text = GroupNick; textEdit2.Text = GroupName; } private void simpleButton2_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.No; } public string GroupNick = string.Empty; public string GroupName = string.Empty; string WeiXinHao = string.Empty; private void simpleButton1_Click(object sender, EventArgs e) { try { if (string.IsNullOrWhiteSpace(textEdit1.Text)) throw new Exception("群昵称不能为空!"); if (string.IsNullOrWhiteSpace(textEdit2.Text)) throw new Exception("群账号不能为空!"); GroupNick = textEdit1.Text; GroupName = textEdit2.Text; var groups = Class1.Config.InviteGroupInfo2[WeiXinHao]; var mess = string.Empty; if (groups.groupInfos.ContainsKey(GroupName)) { groups.groupInfos[GroupName] = GroupNick; mess = "修改成功"; } else { groups.groupInfos.Add(GroupName, GroupNick); mess = "增加成功"; } ShowSuccessAutoClose(mess); this.DialogResult = DialogResult.OK; } catch (Exception ex) { ShowError(ex); } } } }