コード例 #1
0
 public void LoadNote(NoteCard note)
 {
     titleText.Text   = note.Title;
     noteText.Text    = note.NoteText;
     createdText.Text = String.Format("{0}", note.CreateDate);
     editedText.Text  = String.Format("{0}", note.EditDate);
 }
コード例 #2
0
        private void AddNote_Click(object sender, RoutedEventArgs e)
        {
            var c = new NoteCard();

            NoteCards.Add(c);
            c.Show();
            c.OnClosedCalled += (s, args) =>
            {
                NoteCard card = (NoteCard)s;
                NoteCards.Remove(card);
                card.Close();
            };
        }
コード例 #3
0
ファイル: NoteService.cs プロジェクト: NPerederiy/e-diary
        public async Task UpdateNoteAsync(NoteCard card)
        {
            Validate.NotNull(card, "Note card");
            var note = await FindNoteAsync(x => x.Id == card.NoteId);

            note.Header      = card.Header;
            note.Description = card.Description;
            note.CreatedAt   = card.CreatedAt;
            note.UpdatedAt   = card.UpdatedAt;
            note.FolderId    = card.FolderId;
            note.Status      = await FindEntityAsync(uow.StatusRepository, x => x.Name == card.CardStatus);

            uow.NoteRepository.Update(note);
        }
コード例 #4
0
ファイル: NoteService.cs プロジェクト: NPerederiy/e-diary
        public async Task CreateNoteAsync(NoteCard card)
        {
            Validate.NotNull(card, "Note card");
            var n = new Entities.Note
            {
                Header      = card.Header,
                Description = card.Description,
                CreatedAt   = card.CreatedAt,
                UpdatedAt   = card.CreatedAt,
                Status      = await FindEntityAsync(uow.StatusRepository, x => x.Name == card.CardStatus),
                FolderId    = card.FolderId
            };

            await uow.NoteRepository.CreateAsync(n);
        }
コード例 #5
0
        public void Delete(NoteCard note)
        {
            var file = Path.Combine(BaseDirectory, note.Title + ".note");

            File.Delete(file);
        }
コード例 #6
0
        public void Save(NoteCard note)
        {
            var file = Path.Combine(BaseDirectory, note.Title + ".note");

            File.WriteAllText(file, note.NoteText);
        }
コード例 #7
0
        public MainWindow()
        {
            InitializeComponent();

            try
            {
                ImageCards = JsonConvert.DeserializeObject <List <ImageCard.Properties> >(File.ReadAllText("Images.json")).Select(p => new ImageCard()
                {
                    CardProperties = p
                }).ToList();
            }
            catch
            {
                ImageCards = new List <ImageCard>();
            }
            try
            {
                ModelCards = JsonConvert.DeserializeObject <List <ModelCard.Properties> >(File.ReadAllText("Models.json")).Select(p => new ModelCard()
                {
                    CardProperties = p
                }).ToList();
            }
            catch
            {
                ModelCards = new List <ModelCard>();
            }
            try
            {
                NoteCards = JsonConvert.DeserializeObject <List <NoteCard.Properties> >(File.ReadAllText("Notes.json")).Select(p => new NoteCard()
                {
                    CardProperties = p
                }).ToList();
            }
            catch
            {
                NoteCards = new List <NoteCard>();
            }
            try
            {
                AlarmCards = JsonConvert.DeserializeObject <List <AlarmCard.Properties> >(File.ReadAllText("Alarms.json")).Select(p => new AlarmCard()
                {
                    CardProperties = p
                }).ToList();
            }
            catch
            {
                AlarmCards = new List <AlarmCard>();
            }
            try
            {
                CheckListCards = JsonConvert.DeserializeObject <List <CheckListCard.Properties> >(File.ReadAllText("CheckLists.json")).Select(p => new CheckListCard()
                {
                    CardProperties = p
                }).ToList();
            }
            catch
            {
                CheckListCards = new List <CheckListCard>();
            }

            ImageCards.ForEach((c) => {
                c.Show(); c.OnClosedCalled += (s, e) =>
                {
                    ImageCard card = (ImageCard)s;
                    ImageCards.Remove(card);
                    card.Close();
                };
            });
            ModelCards.ForEach((c) => {
                c.Show(); c.OnClosedCalled += (s, e) =>
                {
                    ModelCard card = (ModelCard)s;
                    ModelCards.Remove(card);
                    card.Close();
                };
            });
            NoteCards.ForEach((c) => {
                c.Show(); c.OnClosedCalled += (s, e) =>
                {
                    NoteCard card = (NoteCard)s;
                    NoteCards.Remove(card);
                    card.Close();
                };
            });
            AlarmCards.ForEach((c) => {
                c.Show(); c.OnClosedCalled += (s, e) =>
                {
                    AlarmCard card = (AlarmCard)s;
                    AlarmCards.Remove(card);
                    card.Close();
                };
            });
            CheckListCards.ForEach((c) => {
                c.Show(); c.OnClosedCalled += (s, e) =>
                {
                    CheckListCard card = (CheckListCard)s;
                    CheckListCards.Remove(card);
                    card.Close();
                };
            });

            Notifier.MouseDown += Notifier_MouseDown;;
            Notifier.Icon       = System.Drawing.SystemIcons.Application;

            Notifier.Text = "VCards";

            Notifier.Visible = true;

            try
            {
                Theme theme = JsonConvert.DeserializeObject <Theme>(File.ReadAllText("Theme.json"));

                dark = theme.NightMode;

                ThemeOpacity = theme.Opacity;

                new PaletteHelper().SetLightDark(dark);
                new PaletteHelper().ReplacePalette(theme.Pallete);

                OnOpacityChanged(ThemeOpacity);
            }
            catch { }
        }
コード例 #8
0
ファイル: NoteCardRepository.cs プロジェクト: yuhub/NoteCard
 public void Save(NoteCard noteCard)
 {
     var file = Path.Combine(BaseDirectory, noteCard.Title + ".note");
     File.WriteAllText(file, noteCard.NoteText);
 }
コード例 #9
0
ファイル: NoteCardRepository.cs プロジェクト: yuhub/NoteCard
 public void Delete(NoteCard noteCard)
 {
     var file = Path.Combine(BaseDirectory, noteCard.Title + ".note");
     File.Delete(file);
 }
コード例 #10
0
ファイル: NotesController.cs プロジェクト: NPerederiy/e-diary
 public async Task UpdateNoteAsync(NoteCard note)
 {
     Validate(note);
     await ns.UpdateNoteAsync(note);
 }