Пример #1
0
 void SetNotes(IHaveNotes note, string type, string text) {
     var fileName = GetNoteFileName(note, type);
     if (string.IsNullOrWhiteSpace(text)) {
         if (fileName.Exists)
             Tools.FileUtil.Ops.DeleteWithRetry(fileName.ToString());
     } else {
         var noteDir = GetNoteDirectory(type);
         noteDir.MakeSurePathExists();
         File.WriteAllText(fileName.ToString(), text, Encoding.UTF8);
     }
 }
Пример #2
0
        void SetNotes(IHaveNotes note, string type, string text)
        {
            var fileName = GetNoteFileName(note, type);

            if (string.IsNullOrWhiteSpace(text))
            {
                if (fileName.Exists)
                {
                    Tools.FileUtil.Ops.DeleteWithRetry(fileName.ToString());
                }
            }
            else
            {
                var noteDir = GetNoteDirectory(type);
                noteDir.MakeSurePathExists();
                File.WriteAllText(fileName.ToString(), text, Encoding.UTF8);
            }
        }
Пример #3
0
 public NotesViewModel(IHaveNotes item) {
     Item = item;
     DisplayName = "Notes";
     this.SetCommand(x => x.CloseNoteCommand).Subscribe(CloseNote);
 }
Пример #4
0
 public void OpenNote(IHaveNotes x)
 {
     ShowNotes(x);
 }
Пример #5
0
 IAbsoluteFilePath GetNoteFileName(IHaveNotes noter, string type) => GetNoteDirectory(type)
 .GetChildFileWithName(string.Format(type + "_{0}.txt",
     noter.NoteName.Replace(".", "_").Replace(":", "_")));
Пример #6
0
 bool HasNotes(IHaveNotes note, string type) => GetNoteFileName(note, type).Exists;
Пример #7
0
 string GetNotes(IHaveNotes note, string type) {
     var fileName = GetNoteFileName(note, type);
     return fileName.Exists ? File.ReadAllText(fileName.ToString(), Encoding.UTF8) : String.Empty;
 }
Пример #8
0
 IAbsoluteFilePath GetNoteFileName(IHaveNotes noter, string type) => GetNoteDirectory(type)
 .GetChildFileWithName(string.Format(type + "_{0}.txt",
                                     noter.NoteName.Replace(".", "_").Replace(":", "_")));
Пример #9
0
 bool HasNotes(IHaveNotes note, string type) => GetNoteFileName(note, type).Exists;
Пример #10
0
        string GetNotes(IHaveNotes note, string type)
        {
            var fileName = GetNoteFileName(note, type);

            return(fileName.Exists ? File.ReadAllText(fileName.ToString(), Encoding.UTF8) : String.Empty);
        }
Пример #11
0
 public void ShowNotes(IHaveNotes note)
 {
     ShowOverlay(new NotesViewModel(note));
 }
Пример #12
0
 public NotesViewModel(IHaveNotes item)
 {
     Item        = item;
     DisplayName = "Notes";
     this.SetCommand(x => x.CloseNoteCommand).Subscribe(CloseNote);
 }