private async void ShowModalDialog(IDialogWindow dialog)
 {
     await Application.Current.Dispatcher.InvokeAsync(() =>
     {
         dialog.ShowDialog();
     });
 }
Example #2
0
 /// <summary>
 /// Shows the dialog window.
 /// </summary>
 /// <param name="dialogWindow">The dialog window to show.</param>
 /// <param name="isModal">If true; dialog is shown as a modal</param>
 protected virtual void ShowDialogWindow(IDialogWindow dialogWindow, bool isModal)
 {
     if (isModal)
     {
         dialogWindow.ShowDialog();
     }
     else
     {
         dialogWindow.Show();
     }
 }
        public void ShowDialog <T>(IDialogModel model, Action closed = null) where T : IDialogWindow, new()
        {
            IDialogWindow dialog = CreateDialog <T>(model, closed);

            if (model.IsModal)
            {
                dialog.ShowDialog();
            }
            else
            {
                dialog.Show();
            }
        }
Example #4
0
        void ShowDialogInternal(string name, IDialogParameters parameters, Action <IDialogResult> callback, bool isModal)
        {
            IDialogWindow dialogWindow = CreateDialogWindow();

            ConfigureDialogWindowEvents(dialogWindow, callback);
            ConfigureDialogWindowContent(name, dialogWindow, parameters);

            if (isModal)
            {
                dialogWindow.ShowDialog();
            }
            else
            {
                dialogWindow.Show();
            }
        }
Example #5
0
        void ShowDialogInternal(string name, IDialogParameters parameters, Action <IDialogResult> callback, bool isModal)
        {
            IDialogWindow dialogWindow = CreateDialogWindow();

            ConfigureDialogWindowEvents(dialogWindow, callback);
            ConfigureDialogWindowContent(name, dialogWindow, parameters);

            dialogWindow.Owner = Application.Current.Windows.OfType <Window>().FirstOrDefault(x => x.IsActive);

            if (isModal)
            {
                dialogWindow.ShowDialog();
            }
            else
            {
                dialogWindow.Show();
            }
        }
        void ShowDialogInternal(string name, IDialogParameters parameters, Action <IDialogResult> callback, bool isModal)
        {
            IDialogWindow dialogWindow = CreateDialogWindow();

            ConfigureDialogWindowEvents(dialogWindow, callback);
            ConfigureDialogWindowContent(name, dialogWindow, parameters);

            // TODO some way to initialize the shell for before showing it (region navigation)

            if (isModal)
            {
                dialogWindow.ShowDialog();
            }
            else
            {
                dialogWindow.Show();
            }
        }
        void ShowDialogInternal(string name, IDialogParameters parameters, Action <IDialogResult> callback, bool isModal)
        {
            DialogWindow = CreateDialogWindow();

            ConfigureDialogWindowEvents(DialogWindow, callback);
            ConfigureDialogWindowContent(name, DialogWindow, parameters);

            //TODO: remove this
            InitializeDialogWindow(name, parameters);

            //TODO: do this
            //DialogWindow.Initialize(name, parameters);

            if (isModal)
            {
                DialogWindow.ShowDialog();
            }
            else
            {
                DialogWindow.Show();
            }
        }
Example #8
0
        /// <summary>
        /// 打开模态窗口
        /// </summary>
        /// <param name="page">内容页面</param>
        /// <param name="icon">图标</param>
        /// <param name="pageTitle">页面标题</param>
        /// <param name="args">页面传参</param>
        /// <param name="callback">关闭窗体后执行的回调函数</param>
        /// <param name="disableArea">是否禁用弹框页面的保存,取消区域(即隐藏保存,取消按钮)</param>
        protected void ShowDialog(string page, IconEnum icon, string pageTitle = "未设置标题", object args = null, Action <IDialogResult> callback = null, bool disableArea = false)
        {
            IDialogWindow dialogWindow = Container.Resolve <IDialogWindow>("dialog");

            dialogWindow.ConfigureDialogWindowEvents(callback);

            DialogParameters pars = new DialogParameters();

            pars.Add("page", page);
            pars.Add("icon", icon.ToDescription());
            pars.Add("title", pageTitle);
            if (disableArea)
            {
                pars.Add("disableArea", true);
            }
            if (args != null)
            {
                pars.Add("args", args.ToJson());
            }
            dialogWindow.ConfigureDialogWindowContent("CommonDialogPage", pars);
            dialogWindow.ShowDialog();
        }