Ejemplo n.º 1
0
        internal void NavigatedTo(object parm)
        {
            if (parm is RootModel m1)
            {
                GetModelControl(m1);
                NavigationService.ActiveModelPage = this;
            }
            else if (parm is ViewLifetimeControl viewControl && viewControl.IModel is RootModel m2)
            {
                GetModelControl(m2);
                //await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { viewControl.PageControl = new IModelControl(viewControl.IModel); ModelControl = viewControl.PageControl;  ControlGrid.Children.Add(viewControl.PageControl); });
            }
            ControlGrid.Children.Add(PageControl as UIElement);


            void GetModelControl(RootModel m)
            {
                if (m.PageControl is null)
                {
                    m.DataRoot.SetLocalizer(ResourceExtensions.CoreLocalizer());

                    switch (m.ControlType)
                    {
                    case ControlType.PrimaryTree:
                    case ControlType.PartialTree:
                        var treeControl = new ModelTreeControl(m);
                        treeControl.Loaded += TreeControll_Loaded;
                        m.PageControl       = treeControl;
                        break;

                    case ControlType.SymbolEditor: m.PageControl = new SymbolEditControl(m); break;

                    case ControlType.GraphDisplay: m.PageControl = new ModelGraphControl(m); break;

                    default:
                        throw new ArgumentException("Unknown ControlType");
                    }
                }
                PageControl = m.PageControl as IModelPageControl;
            }
        }
Ejemplo n.º 2
0
        internal async System.Threading.Tasks.Task NavigatedToAsync(object parm)
        {
            if (parm is RootModel m1)
            {
                GetModelControl(m1);
                NavigationService.ActiveModelPage = this;
            }
            else if (parm is ViewLifetimeControl viewControl && viewControl.DataModel is IPageModel m2)
            {
                GetModelControl(m2);
            }
            ControlGrid.Children.Add(PageControl as UIElement);


            void GetModelControl(IPageModel m)
            {
                if (m.PageControl is null)
                {
                    Root.SetLocalizer(ResourceExtensions.CoreLocalizer());

                    switch (m.ControlType)
                    {
                    case ControlType.PrimaryTree:
                    case ControlType.PartialTree:
                        var treeControl = new ModelTreeControl(m);
                        treeControl.Loaded += TreeControll_Loaded;
                        m.PageControl       = treeControl;
                        break;

                    case ControlType.ComplexDraw: m.PageControl = new ModelDrawControl(m); break;

                    default:
                        throw new ArgumentException("Unknown ControlType");
                    }
                }
                PageControl = m.PageControl as IModelPageControl;
            }
        }