Example #1
0
        /// <summary>
        /// Allow modifying the categories in the given ExtPerson; returns true if possibly changed
        /// </summary>
        public static bool SelectCats(ExtPerson ep)
        {
            var dialog = new CatMultiselectDialog
            {
                Owner = App.Current.MainWindow,
                _VM   = new VM(ep.SelectedCatIds)
            };

            dialog.DataContext   = dialog._VM;
            dialog.eCaption.Text = $"Choose categories for {ep.Person.Name}";
            if (dialog.ShowDialog() != true)
            {
                return(false);
            }
            ep.SelectedCatIds = dialog._VM.GetEditedSelectedIds();
            return(true);
        }
Example #2
0
        /// <summary>
        /// Allow selecting categories (such as for searching); returns null on cancel
        /// </summary>
        public static long[] SelectCats(bool allowNonLeafSelection, string caption)
        {
            var dialog = new CatMultiselectDialog
            {
                Owner = App.Current.MainWindow,
                _VM   = new VM(Array.Empty <long>())
                {
                    ShowNonLeafCheckboxes = allowNonLeafSelection
                }
            };

            dialog.DataContext   = dialog._VM;
            dialog.eCaption.Text = caption;
            if (dialog.ShowDialog() != true)
            {
                return(null);
            }
            return(dialog._VM.GetEditedSelectedIds());
        }