Пример #1
0
        protected override void SetupViewNamespaces()
        {
            base.SetupViewNamespaces();

            var concepts = new[] { "Connect", "Games", "Games.Library" };
            var types    = new[] { "Overlays", "Popups", "Dialogs" };

            var nsRootSource = "withSIX.Play.Applications.ViewModels";
            var nsRootTarget = "withSIX.Play.Presentation.Wpf.Views";

            // Setup root
            ViewLocator.AddNamespaceMapping(nsRootSource, nsRootTarget);
            foreach (var type in types)
            {
                ViewLocator.AddNamespaceMapping(nsRootSource + "." + type, nsRootTarget + "." + type);
            }

            // Setup concepts
            foreach (var concept in concepts)
            {
                var nsSource = nsRootSource + "." + concept;
                var nsTarget = nsRootTarget + "." + concept;
                ViewLocator.AddNamespaceMapping(nsSource, nsTarget);
                foreach (var type in types)
                {
                    ViewLocator.AddNamespaceMapping(nsSource + "." + type, nsTarget + "." + type);
                }
            }
        }
Пример #2
0
        void SetupCM()
        {
            var original = ViewLocator.LocateForModel;

            ViewLocator.LocateForModel = (o, dependencyObject, arg3) => {
                var v = original(o, dependencyObject, arg3);
                // TODO: Lacks CM's Context/target support
                if ((v == null) || v is TextBlock)
                {
                    var rxv = (UIElement)ReactiveUI.ViewLocator.Current.ResolveView(o);
                    if (rxv != null)
                    {
                        v = rxv;
                    }
                }

                var vFor = v as IViewFor;
                if (vFor != null)
                {
                    vFor.ViewModel = o;
                }

                return(v);
            };
            //ViewLocator.AddNamespaceMapping("withSIX.Core.Presentation.Wpf.Views", "withSIX.Core.Presentation.Wpf.Views");
            ViewLocator.AddNamespaceMapping("withSIX.Core.Applications.MVVM.ViewModels.Popups",
                                            "withSIX.Core.Presentation.Wpf.Views.Popups");
            ViewLocator.AddNamespaceMapping("withSIX.Core.Applications.MVVM.ViewModels.Dialogs",
                                            "withSIX.Core.Presentation.Wpf.Views.Dialogs");
            ViewLocator.AddNamespaceMapping("withSIX.Core.Applications.MVVM.ViewModels",
                                            "withSIX.Core.Presentation.Wpf.Views");
        }