Exemple #1
0
        private void RenameGroupExec(string groupName)
        {
            var dialog = new GroupNameDialogViewModel(_allNotesVM.AllGroups, groupName, "Rename Group");

            dialog.DialogClosed += async(d) =>
            {
                await Task.Delay(300);

                _homeVM.FixAirspace = false;

                if (dialog.Result == System.Windows.Forms.DialogResult.Cancel)
                {
                    return;
                }

                // Update the group name in the DB then update the notes in the VM
                await App.Local.UpdateGroup(groupName, dialog.GroupName);

                // Update the notes with this group name
                foreach (var note in (_allNotesVM.View.SourceCollection as ObservableCollection <NoteViewModel>))
                {
                    string oldGroupName = groupName.ToUpper();
                    if (note.Group.ToUpper() == oldGroupName)
                    {
                        note.Group = dialog.GroupName;
                    }
                }

                // Update the group name
                _allNotesVM.UpdateGroup(groupName, dialog.GroupName);
            };

            _homeVM.InvokeShowDialog(dialog);
        }
Exemple #2
0
        public void AddGroupExec()
        {
            var dialog = new GroupNameDialogViewModel(_allNotesVM.AllGroups, String.Empty, "Add New Group");

            dialog.DialogClosed += async(d) =>
            {
                await Task.Delay(300);

                _homeVM.FixAirspace = false;

                if (dialog.Result == System.Windows.Forms.DialogResult.Cancel)
                {
                    return;
                }

                await AddGroupToDatabase(dialog.GroupName);
            };

            _homeVM.InvokeShowDialog(dialog);
        }