コード例 #1
0
 public BaseModalWindow(UserControl control)
     : this()
 {
     this.Content.Children.Add(control);
     control.Focus();
 }
コード例 #2
0
ファイル: NodesSelector.cs プロジェクト: chris-tomich/Glyma
        public void DeleteNodes(UserControl sender = null)
        {
            if (HasInvisibleNodesSelected())
            {
                SuperMessageBoxService.ShowWarning("Delete Node(s)",
                    "Some hidden nodes have been selected, are you sure you wish to delete them? \r\n\r\n" +
                    "Press YES to delete them\r\n" +
                    "Press NO to show all hidden nodes",
                    "Yes",
                    "No",
                    "Cancel",
                    DeleteAllNodes,
                    () =>
                    {
                        foreach (var nodeControl in NodeControls)
                        {
                            if (nodeControl.CollapseState == CollapseState.Collapsed ||
                                nodeControl.CollapseState == CollapseState.SemiCollapsed)
                            {
                                var control = nodeControl as NodeControl;
                                if (control != null && control.GetAllChildNodeControls().Any(q => q.ViewModelNode.IsSelected))
                                {
                                    control.CollapseControl.ExpandNodes(new ChildrenControlCollection(control));
                                }
                            }
                        }
                        if (sender != null)
                        {
                            sender.Focus();
                        }
                    },
                    () =>
                    {
                        if (sender != null)
                        {
                            sender.Focus();
                        }
                    });
            }
            else
            {
                if (NodeControls.Any(q => q.CollapseState == CollapseState.Collapsed || q.CollapseState == CollapseState.SemiCollapsed))
                {
                    SuperMessageBoxService.ShowWarning("Delete Node(s)",
                    "The selected node(s) have hidden related node(s), are you sure you wish to delete your selection? \r\n\r\n" +
                    "Press YES to delete the selected node(s) then show the hidden node(s)\r\n" +
                    "Press NO to just show the hidden node(s)",
                    "Yes",
                    "No",
                    "Cancel",
                        () =>
                        {
                            DeleteAllNodes();
                            SelectorControl.RecheckIncorrectVisibility();
                            SelectorControl.ReScanForCollapseStates();
                        },
                        () =>
                        {
                            foreach (var nodeControl in NodeControls)
                            {
                                if (nodeControl.CollapseState == CollapseState.Collapsed ||
                                    nodeControl.CollapseState == CollapseState.SemiCollapsed)
                                {
                                    var control = nodeControl as NodeControl;
                                    if (control != null)
                                    {
                                        control.CollapseControl.ExpandNodes(new ChildrenControlCollection(control, false, true));
                                    }
                                }
                            }
                            if (sender != null)
                            {
                                sender.Focus();
                            }
                        },
                        () =>
                        {
                            if (sender != null)
                            {
                                sender.Focus();
                            }
                        });
                }
                else
                {
                    DeleteAllNodes();
                }
            }


            
        }