void addNote_AddClicked(object sender, EventArgs e) { try { if (!string.IsNullOrEmpty(addNote._header) && !string.IsNullOrEmpty(addNote._note)) { int maxId = stickyNoteList.Max(c => c.Id) + 1; StickyNoteMaster master = new StickyNoteMaster(); master.Id = maxId; master.Header = addNote._header; master.Note = addNote._note; master.Height = 250; master.Width = 250; master.XLocation = 0; master.YLocation = 0; master.BackgroundColor = "#FFFFFF"; User user = new User(); user.UserId = UserId; user.StickyNoteList = new List <StickyNoteMaster>(); user.StickyNoteList.Add(master); if (FileUtils.ProcessStickyNote(user, FileOperation.AddNote)) { stickyNoteList.Add(new StickyNoteMaster { Header = addNote._header, Height = 250, Id = maxId, Note = addNote._note, Width = 250, XLocation = 0, YLocation = 0, BackgroundColor = "#FFFFFF" }); stickyNote = new StickyNote(UserId, addNote._header, addNote._note, new Thickness(0, 0, 0, 0), maxId.ToString(), 250, 250, "#FFFFFF"); stickyNote.ShowDialog(); stickyNote.AddNewClicked += new EventHandler(stickyNote_AddNewClicked); LayoutRoot.Children.Add(stickyNote); } } else { MessageBox.Show("*Header and Note are required.", "Error", MessageBoxButton.OK); addNote = new AddNotes(); addNote.AddClicked += new EventHandler(addNote_AddClicked); addNote.Show(); } } catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message); } }
void stickyNote_AddNewClicked(object sender, EventArgs e) { addNote = new AddNotes(); addNote.AddClicked += new EventHandler(addNote_AddClicked); addNote.Show(); }