コード例 #1
0
ファイル: PendingBox.cs プロジェクト: zt199510/WPFUI
        public static IPendingHandler Show(string message, string title = null, bool cancelable = false, Window owner = null, PendingBoxConfigurations configurations = null)
        {
            if (configurations == null)
            {
                configurations = new PendingBoxConfigurations();
            }

            return(CallPendingBox(owner, message, title, cancelable, configurations));
        }
コード例 #2
0
ファイル: PendingBox.cs プロジェクト: zt199510/WPFUI
        public static IPendingHandler Show(string message, string title = null, bool cancelable = false, Window owner = null, string configKey = null)
        {
            PendingBoxConfigurations pendingBoxConfigurations = null;

            if (configKey.IsNullOrEmpty())
            {
                pendingBoxConfigurations = new PendingBoxConfigurations();
            }
            else
            {
                if (!PendingBoxConfigurations.ContainsKey(configKey))
                {
                    throw new Exception($"Configuration key \"{configKey}\" does not exists.");
                }

                pendingBoxConfigurations = PendingBoxConfigurations[configKey];
            }

            return(CallPendingBox(owner, message, title, cancelable, pendingBoxConfigurations));
        }
コード例 #3
0
ファイル: PendingBox.cs プロジェクト: zt199510/WPFUI
        private static IPendingHandler CallPendingBox(Window owner, string message, string title, bool cancelable, PendingBoxConfigurations configurations)
        {
            var msb     = new Controls.Internal.PendingBox(owner, message, title, cancelable, configurations);
            var handler = new PendingHandler(() =>
            {
                msb.ForceClose();
            }, (s) =>
            {
                msb.UpdateMessage(s);
            });

            WindowX windowX = null;

            if (configurations.InteractOwnerMask && owner != null && owner is WindowX)
            {
                windowX = owner as WindowX;
            }

            if (windowX != null)
            {
                windowX.IsMaskVisible = true;
            }
            msb.Closed += (s, e) =>
            {
                if (windowX != null)
                {
                    windowX.IsMaskVisible = false;
                }
                handler.RaiseCanceledEvent(s, e);
            };
            msb.Canceled += (s, e) =>
            {
                handler.RaiseCanceledEvent(s, e);
            };
            msb.Show();

            return(handler);
        }