public ProgramInfo(ExtentProgramData pargramdata) { InitializeComponent(); Data = pargramdata; pargramData = AT_BC.Data.Helpers.DataContractSerializeHelper.Clone <ExtentProgramData>(pargramdata);; this.DataContext = pargramData; }
private void btnAdd_Click(object sender, RoutedEventArgs e) { ExtentProgramData data = new ExtentProgramData(); ProgramInfo info = new ProgramInfo(data); info.Title = "添加"; if (info.ShowDialog(this) == true) { ProgramInfo.Add(data); } }
private ExtentProgramData ToExtentProgramData(ExtentProgramInfo info) { if (info != null) { ExtentProgramData data = new ExtentProgramData(); data.Name = info.Name; data.Path = info.Path; data.IconURL = info.IconURL; return(data); } return(null); }
private void btnDelete_Click(object sender, RoutedEventArgs e) { ExtentProgramData data = dglist.SelectedItem as ExtentProgramData; if (data != null) { DeleteImageFile(data.IconURL); ProgramInfo.Remove(data); Save(); } else { MessageBox.Show("请选择需要删除的项!"); } }
private ExtentProgramInfo ToExtentProgramInfo(ExtentProgramData info) { if (info != null) { ExtentProgramInfo data = new ExtentProgramInfo(); data.Name = info.Name; data.Path = info.Path; data.IconURL = info.IconURL; if (string.IsNullOrEmpty(data.IconURL)) { data.IconURL = "/CO_IA.UI.Screen;component/Images/defaultprogram.png"; } return(data); } return(null); }
private void btnModify_Click(object sender, RoutedEventArgs e) { ExtentProgramData data = dglist.SelectedItem as ExtentProgramData; if (data != null) { string imgfile = data.IconURL; ProgramInfo info = new ProgramInfo(data); info.Title = "修改"; if (info.ShowDialog(this) == true) { if (data.IconURL != imgfile) { DeleteImageFile(imgfile); } } } else { MessageBox.Show("请选择修改项!"); } }
private void AddSectionItem(ConfigurationSectionGroup group, string index, ExtentProgramData data) { ExtentProgramInfo info = ToExtentProgramInfo(data); group.Sections.Add(index.ToString(), info); }