protected void RemoveWindow <T>(Screen rootModel, ChildWindowType windowType) where T : ContentControl
        {
            var view = rootModel.GetView() as T;

            if (view == null)
            {
                return;
            }
            RemoveWindow(view, windowType);
        }
示例#2
0
            private ChildAccessibleObject GetChildAccessibleObject(ChildWindowType childWindowType)
            {
                if (childWindowType == ChildWindowType.Edit)
                {
                    return(_owner.ChildEditAccessibleObject);
                }
                else if (childWindowType == ChildWindowType.ListBox || childWindowType == ChildWindowType.DropDownList)
                {
                    return(_owner.ChildListAccessibleObject);
                }

                return(new ChildAccessibleObject(_owner, Handle));
            }
        protected void PrepareWindow <T>(Screen rootModel, ChildWindowType windowType, bool isModal = false) where T : ContentControl
        {
            var content = Application.Current.MainWindow.Content as Grid;

            if (content == null)
            {
                return;
            }

            var rowCount    = content.RowDefinitions.Count;
            var columnCount = content.ColumnDefinitions.Count;

            var view = ViewLocator.LocateForModel(rootModel, null, null);

            if (view == null)
            {
                return;
            }

            if (isModal && content.Children.Contains(view))
            {
                return;
            }

            if (typeof(T) == typeof(ChildWindow))
            {
                ((ChildWindow)view).WindowState           = WindowState.Open;
                ((ChildWindow)view).WindowStartupLocation = WindowStartupLocation.Center;
                ((ChildWindow)view).IsModal = isModal;
            }

            Grid.SetColumn(view, 0);
            Grid.SetColumnSpan(view, columnCount == 0 ? 1 : columnCount);
            Grid.SetRow(view, 0);
            Grid.SetRowSpan(view, rowCount == 0 ? 1 : rowCount);

            ViewModelBinder.Bind(rootModel, view, null);
            content.Children.Add(view);

            ChildWindowBag.Add(new ChildWindowBagItem(windowType, rootModel));

            var animationType = typeof(T) == typeof(ChildWindow) ? WindowAnimationType : OverlayAnimationType;

            PrepareAnimation(view as ContentControl, content.ActualHeight.Equals(0) ? content.Height : content.ActualHeight, animationType);
        }
        protected void RemoveWindow <T>(T view, ChildWindowType windowType) where T : ContentControl
        {
            var rootModel          = ViewModelLocator.LocateForView(view);
            var childWindowBagItem = ChildWindowBag.Find(ci => ci.ViewModel.Equals(rootModel) && ci.WindowType == windowType);

            ChildWindowBag.Remove(childWindowBagItem);

            var mainWindow = Application.Current.MainWindow;
            var content    = mainWindow.Content as Grid;

            if (content == null)
            {
                return;
            }

            var animationType = typeof(T) == typeof(ChildWindow) ? WindowAnimationType : OverlayAnimationType;

            RemoveAnimation(view, content, animationType);
        }
 private ChildAccessibleObject GetChildAccessibleObject(ChildWindowType childWindowType)
 => childWindowType switch
 {
 public ComboBoxChildNativeWindow(ComboBox comboBox, ChildWindowType childWindowType)
 {
     _owner           = comboBox;
     _childWindowType = childWindowType;
 }
示例#7
0
 public ChildWindowBagItem(ChildWindowType windowType, Screen viewModel) : this()
 {
     WindowType = windowType;
     ViewModel  = viewModel;
 }
 public ChildWindowBagItem(ChildWindowType windowType, Screen viewModel)
     : this()
 {
     WindowType = windowType;
     ViewModel = viewModel;
 }