Exemplo n.º 1
0
        public static void BindDrawerToWindow(IWindowDrawer drawer, string factoryId)
        {
            if (string.IsNullOrEmpty(factoryId))
            {
                throw new Exception("Bad bad bad");
            }
            var factory = InvertApplication.Container.Resolve <IWindowFactory>(drawer.WindowFactoryId);

            BindDrawerToWindow(drawer, factory);
        }
Exemplo n.º 2
0
        public void SetAreasFor(IWindowDrawer drawerContainer)
        {
            drawerContainer.Drawers.Clear();

            //if (drawerContainer.ViewModel is IKeyHandler)
            //{
            //    drawerContainer.Drawers.Add(new KeyboardDispatcher()
            //    {
            //        DataSelector = () => drawerContainer.ViewModel as IKeyHandler,
            //        Layout = new AreaLayout(0, 0, 0, 0)
            //    });
            //}

            if (OnSetAreasForWindowDrawer != null)
            {
                OnSetAreasForWindowDrawer(drawerContainer);
            }
        }
Exemplo n.º 3
0
 public static void BindDrawerToWindow(IWindowDrawer drawer, IWindowFactory factory, IWindow window = null)
 {
     if (window == null)
     {
         window = factory.GetDefaultViewModelObject(drawer.PersistedData);
     }
     if (window.GetType() != factory.ViewModelType)
     {
         throw new Exception("Type of viewmodel != vm type of the factory");
     }
     drawer.PersistedData   = null;
     drawer.WindowFactoryId = factory.Identifier;
     drawer.ViewModel       = window;
     drawer.RepaintOnUpdate = factory.RepaintOnUpdate;
     if (!WindowDrawers.Contains(drawer))
     {
         WindowDrawers.Add(drawer);
     }
     factory.SetAreasFor(drawer);
 }