public void Add() { if (this.groupName == null || this.groupName.Trim().Equals(string.Empty)) { this.Hint = "群组名不能为空!"; } else { RcvGroup rgp = new RcvGroup(); this.CopyNow(ref rgp); this.Groups.Add(rgp); this.groupConfig.ListGroup.Add(rgp); this.groupConfig.WriteConfigToFile(); InitEmailInfo(); InitNotesInfo(); InitFtpInfo(); InitLanInfo(); this.GroupName = ""; this.Hint = "添加配置成功!"; } }
public void CopyNow(ref RcvGroup gp) { gp.GroupName = this.GroupName; gp.ListEmail = new List <EmailAddress>(); foreach (var item in this.EmailOptions) { if (item.IsSelected == true) { gp.ListEmail.Add(item.Address); } } gp.ListNotes = new List <NotesAddress>(); foreach (var item in this.NotesOptions) { if (item.IsSelected == true) { gp.ListNotes.Add(item.Address); } } gp.ListFtp = new List <FtpAddress>(); foreach (var item in this.FtpOptions) { if (item.IsSelected == true) { gp.ListFtp.Add(item.Address); } } gp.ListLan = new List <LanAddress>(); foreach (var item in this.LanOptions) { if (item.IsSelected == true) { gp.ListLan.Add(item.Address); } } }
public void Modify() { if (this.selectItem == null) { this.Hint = "请先选择一个群组!"; } else { if (this.groupName == null || this.groupName.Trim().Equals(string.Empty)) { this.Hint = "群组名不能为空!"; } else { RcvGroup rgp = new RcvGroup(); this.CopyNow(ref rgp); this.groupConfig.ListGroup[this.groupConfig.ListGroup.IndexOf(this.selectItem)] = rgp; this.groupConfig.WriteConfigToFile(); this.Hint = "修改成功!"; } } }