Example #1
0
        /// <summary>
        /// 弹出窗口
        /// </summary>
        /// <typeparam name="TViewModel">传入的viewmodel</typeparam>
        /// <param name="owner">owner</param>
        /// <param name="title">窗口的title</param>
        /// <param name="view">窗口的内容</param>
        /// <param name="viewmodel">窗口的内容的viewmodel</param>
        /// <param name="onDialogCloseCallBack">窗口关闭后的回掉事件</param>
        /// <param name="option">窗口的一些属性设置(主要是动画)</param>
        /// <param name="winLoadAction">窗口加载完页面后执行的操作</param>
        /// <param name="request">InteractionRequest类,调用者可执行Requested,即可关闭弹出的窗口</param>
        public static void ShowDialog <TViewModel>(Window owner, string title, System.Windows.Controls.UserControl view, TViewModel viewmodel, Action <TViewModel> onDialogCloseCallBack, MyLayerOptions option, Action winLoadAction, InteractionRequest request)
        {
            view.DataContext = viewmodel;
            MyLayer messageBox = new MyLayer(owner, view, title, option, true, winLoadAction);

            if (onDialogCloseCallBack != null)
            {
                messageBox.Closed += (sender, e) => onDialogCloseCallBack(viewmodel);
            }
            if (request != null)
            {
                CallParameterizedMethodAction action = new CallParameterizedMethodAction();
                action.MethodName   = "Close";
                action.TargetObject = messageBox;
                InteractionRequestTrigger trigger = new InteractionRequestTrigger();
                trigger.Actions.Add(action);
                trigger.SourceObject = request;
                Interaction.GetTriggers(messageBox).Add(trigger);
            }
            messageBox.Show();
        }
Example #2
0
 /// <summary>
 /// 弹出窗口
 /// </summary>
 /// <typeparam name="TViewModel">传入的viewmodel</typeparam>
 /// <param name="title">窗口的title</param>
 /// <param name="view">窗口的内容</param>
 /// <param name="viewmodel">窗口的内容的viewmodel</param>
 /// <param name="winLoadAction">窗口加载完页面后执行的操作</param>
 /// <param name="request">InteractionRequest类,调用者可执行Requested,即可关闭弹出的窗口</param>
 public static void ShowDialog <TViewModel>(string title, System.Windows.Controls.UserControl view, TViewModel viewmodel, Action winLoadAction, InteractionRequest request)
 {
     ShowDialog <TViewModel>(null, title, view, viewmodel, null, null, winLoadAction, request);
 }
Example #3
0
 /// <summary>
 /// 弹出窗口
 /// </summary>
 /// <typeparam name="TViewModel">传入的viewmodel</typeparam>
 /// <param name="title">窗口的title</param>
 /// <param name="view">窗口的内容</param>
 /// <param name="viewmodel">窗口的内容的viewmodel</param>
 /// <param name="onDialogCloseCallBack">窗口关闭后的回掉事件</param>
 /// <param name="option">窗口的一些属性设置(主要是动画)</param>
 /// <param name="winLoadAction">窗口加载完页面后执行的操作</param>
 /// <param name="request">InteractionRequest类,调用者可执行Requested,即可关闭弹出的窗口</param>
 public static void ShowDialog <TViewModel>(string title, System.Windows.Controls.UserControl view, TViewModel viewmodel, Action <TViewModel> onDialogCloseCallBack, MyLayerOptions option, Action winLoadAction, InteractionRequest request)
 {
     ShowDialog <TViewModel>(null, title, view, viewmodel, onDialogCloseCallBack, option, winLoadAction, request);
 }
Example #4
0
 /// <summary>
 /// 弹出窗口
 /// </summary>
 /// <param name="title">窗口的title</param>
 /// <param name="view">窗口的内容</param>
 /// <param name="request">InteractionRequest类,调用者可执行Requested,即可关闭弹出的窗口</param>
 public static void ShowDialog(string title, System.Windows.Controls.UserControl view, InteractionRequest request)
 {
     ShowDialog <object>(null, title, view, null, null, null, null, request);
 }