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();
 }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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();
            }
        }
Ejemplo n.º 4
0
 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);
     }
 }
 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);
                 file.Close();
             }                    
         }
     }
     catch (Exception ex)
     {
         // Fail silently :-)
         Log.Error(ex.ToString);
     }
 }