Пример #1
0
        private void OpenWindow(OpenWindowEventArgs args)
        {
            var view = PageLocator.Resolve(args.PageName);

            var window = view as Window;
            if (window != null)
            {
                window.Owner = this;
                var vm = window.DataContext as INavigationAware;
                if (vm != null)
                {
                    vm.OnNavigatedTo(args.Param);
                }
                window.ShowDialog();
            }
        }
Пример #2
0
        /// <summary>
        /// 打开窗口事件回调处理
        /// </summary>
        /// <param name="args"></param>
        private static void OnOpenWindow(OpenWindowEventArgs args)
        {
            WindowID key = (WindowID)((int)Enum.Parse(typeof(WindowID), args.WinName));

            if (args.IsSuccess)              //成功打开
            {
                IView     view     = CtrlManager.mDicWindCtrls[key];
                TUIWindow uiWindow = args.UiWindow;
                if (uiWindow.DataCfg.WinType == WindowType.Normal && CtrlManager.mDicOpenCtrls.ContainsKey(WindowID.MenuTopBarView))
                {
                    if (uiWindow.DataCfg.IsOnset)
                    {
                        ((MenuTopBarView)CtrlManager.mDicOpenCtrls[WindowID.MenuTopBarView]).ShowHUDView(true);
                        ((MenuTopBarView)CtrlManager.mDicOpenCtrls[WindowID.MenuTopBarView]).ShowBcakBtn(false, view.WindowTitle);
                    }
                    else if (!uiWindow.DataCfg.IsDelayShowBar)
                    {
                        ((MenuTopBarView)CtrlManager.mDicOpenCtrls[WindowID.MenuTopBarView]).ShowBcakBtn(true, view.WindowTitle);
                    }
                    else
                    {
                        ((MenuTopBarView)CtrlManager.mDicOpenCtrls[WindowID.MenuTopBarView]).DelayShowBcakBtn(true, view.WindowTitle);
                    }
                }
                if (view.uiWindow == null)
                {
                    view.uiWindow = uiWindow;
                    view.Init();
                }
                view.IsOpened = true;
                view.RegisterUpdateHandler();
                view.HandleAfterOpenView();
                CtrlManager.mDicOpenCtrls[key] = view;
            }
            else             //失败,就移除
            {
                CtrlManager.mDicWindCtrls.Remove(key);
            }
        }
Пример #3
0
 private void ChangePrice()
 {
     var products = selectedItems.OfType<Product>().ToArray();
     var args = new OpenWindowEventArgs(PageName.ChangePriceWindow, products);
     eventAggregator.GetEvent<OpenWindowEvent>().Publish(args);
 }
Пример #4
0
 private void EditProduct(Product p)
 {
     var args = new OpenWindowEventArgs(PageName.ProductEditWindow, p);
     eventAggregator.GetEvent<OpenWindowEvent>().Publish(args);
 }
Пример #5
0
 private void CreateProduct()
 {
     var args = new OpenWindowEventArgs(PageName.ProductCreateWindow, null);
     eventAggregator.GetEvent<OpenWindowEvent>().Publish(args);
 }