private static void LoadStyle() { try { IBLL.IPrint bll = new BLL.PrintBLL(); Dictionary <string, Model.sys_t_print_style_data> dic = bll.GetPrintStyleData(""); foreach (string key in myStyle.Keys) { Model.sys_t_print_style style = myStyle[key]; //打印样式 写成文件 using (FileStream fs = new FileStream(style_path + style.style_data + ".txt", FileMode.Create)) { using (StreamWriter sw = new StreamWriter(fs, Encoding.UTF8)) { if (dic.Keys.Contains(style.style_data)) { sw.Write(dic[style.style_data].style_str); } else { sw.Write(defaultStyle); } sw.Flush(); } } } } catch (Exception e) { MsgForm.ShowFrom(e); } }
public static void DelStyle(string style_id) { try { if (myStyle.Keys.Contains(style_id)) { Model.sys_t_print_style style = myStyle[style_id]; if (File.Exists(style_path + style.style_data + ".txt")) { File.Delete(style_path + style.style_data + ".txt"); } } } catch (Exception e) { MsgForm.ShowFrom(e); } }