コード例 #1
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();
 }
コード例 #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();
        }
コード例 #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();
            }
        }
コード例 #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);
     }
 }
コード例 #5
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();
     }
 }
コード例 #6
0
 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);
     }
 }