private void LoadTextTemplates() { var tpls = this.repository.ToList((q) => q.OrderBy(x => x.Filename)); this.templates.IsNotifying = false; foreach (var tpl in tpls) { var model = new TextFileModel(); model.InjectFrom(tpl); this.templates.Add(model); } this.templates.IsNotifying = true; this.templates.Refresh(); }
public void AddNew() { string file; if (OpenSaveAsDialog(out file) == true) { var model = new TextFileModel { Filename = file, Template = "%carena_wins% - %carena_losses%" }; Templates.Add(model); SelectedTemplate = model; Save(); } }
private void WriteFile(TextFileModel template, string content) { try { lock (fileLock) { using (var file = File.CreateText(template.Filename)) { file.Write(content); } } } catch (Exception ex) { // Fail silently :-) Log.Error(ex.ToString); } }
private void WriteFile(TextFileModel template, string content) { try { lock (fileLock) { using (var file = File.CreateText(template.Filename)) { file.Write(content); file.Close(); } } } catch (Exception ex) { // Fail silently :-) Log.Error(ex.ToString); } }