コード例 #1
0
        public void OnLayoutLoaded(LayoutLoadedArgs args)
        {
            var matchingAnchorables = args.LayoutAnchorables.Where(anch => anch.Content.GetType() == Definition.View &&
                                                                   anch.Content.SafeCast <UserControl>().DataContext.GetType() == Definition.ViewModel &&
                                                                   anch.IsVisible);

            var rougeAnchorables = ActivePanels.Where(o => !matchingAnchorables.Select(anch => anch.Content.SafeCast <UserControl>().DataContext).
                                                      Contains(o.Content.SafeCast <UserControl>().DataContext));

            foreach (var anchorable in rougeAnchorables.ToList())
            {
                RemoveDynamicPanel(anchorable);
            }

            foreach (var invalidationSubscription in InvalidationSubscriptions)
            {
                invalidationSubscription.Event.Unsubscribe(invalidationSubscription.Token);
            }

            InvalidationSubscriptions.Clear();
            ActivePanels.Clear();
            foreach (var anchorable in matchingAnchorables)
            {
                ResolveDynamicPanelDependencies(anchorable);
                ActivePanels.Add(anchorable);
            }

            SyncSelection(ActivePanels.Select(o => o.Content.SafeCast <UserControl>().DataContext));
        }
コード例 #2
0
        public static void AddPanel(ScreenSafePanel panel)
        {
            if (ActivePanels.Contains(panel))
            {
                return;
            }

            ActivePanels.Add(panel);

            panel.ApplySafeArea(_currentSafeArea);
        }
コード例 #3
0
        private void AddDynamicPanel(LayoutAnchorable anchorable)
        {
            var container = GetPrefferedLayoutContainer();

            container.Children.Add(anchorable);
            container.SelectedContentIndex = container.Children.IndexOf(anchorable);

            ResolveDynamicPanelDependencies(anchorable);

            ActivePanels.Add(anchorable);
        }