Ejemplo n.º 1
0
        /// <summary>
        /// Creates a custom messagebox
        /// </summary>
        /// <param name="content">Content to be displayed</param>
        /// <param name="RequiredIcon">Icon to be displayed</param>
        /// <param name="RequiredButtons">Buttons to be displayed</param>
        /// <param name="arguments"></param>
        /// <returns>Dialogresult of the clicked button</returns>
        private static System.Windows.Forms.DialogResult ShowBox(string messageID, BMC_Icon RequiredIcon, BMC_Button RequiredButtons, bool isPrivateFunction, int height, params string[] arguments)
        {
            newMsgBox = new MessageBox();

            if (height != 0 &&
                height > 250)
            {
                newMsgBox.LayoutRoot.Height = height;
            }

            var sval = messageID.Split(new string[] { "@@@@@@" }, StringSplitOptions.None);

            if (sval.Count() > 0)
            {
                string newmessage = string.Empty;
                for (int i = 0; i < sval.Count(); i++)
                {
                    newmessage += sval[i];
                    if (arguments.Count() - 1 >= i)
                    {
                        newmessage += arguments[i];
                    }
                }
                newmessage.Replace("@@@@@@", "");
                messageID = newmessage;
            }

            newMsgBox.MsgContent.Text = messageID;
            if (messageID.Length > 100)
            {
                newMsgBox.MsgContent.FontSize = 14.0; newMsgBox.MsgContent.Margin = new Thickness(0, 0, 0, 15);
            }


            switch (RequiredIcon)
            {
            case (BMC_Icon.Information):
            {
                newMsgBox.icnInformation.Opacity = 1.0;
                break;
            }

            case (BMC_Icon.Warning):
            {
                newMsgBox.icnWarning.Opacity = 1.0;
                break;
            }

            case BMC_Icon.Question:
            {
                newMsgBox.icnQuestion.Opacity = 1.0;
                break;
            }

            case BMC_Icon.Error:
            {
                newMsgBox.icnError.Opacity = 1.0;
                break;
            }

            default:
            {
                newMsgBox.icnError.Opacity = 1.0;
                break;
            }
            }

            switch (RequiredButtons)
            {
            case BMC_Button.OK:
            {
                newMsgBox.OK.Visibility = Visibility.Visible;
                newMsgBox.OK.IsDefault  = true;
                break;
            }

            case BMC_Button.OKCancel:
            {
                newMsgBox.OK.Visibility     = Visibility.Visible;
                newMsgBox.Cancel.Visibility = Visibility.Visible;
                newMsgBox.OK.IsDefault      = true;
                break;
            }

            case BMC_Button.YesNo:
            {
                newMsgBox.Yes.Visibility = Visibility.Visible;
                newMsgBox.No.Visibility  = Visibility.Visible;
                newMsgBox.Yes.IsDefault  = true;
                break;
            }

            case BMC_Button.YesNoCancel:
            {
                newMsgBox.Yes.Visibility    = Visibility.Visible;
                newMsgBox.No.Visibility     = Visibility.Visible;
                newMsgBox.Cancel.Visibility = Visibility.Visible;
                newMsgBox.Yes.IsDefault     = true;
                break;
            }

            default:
            {
                break;
            }
            }

            newMsgBox.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            //
            if ((parentOwner != null) && (parentOwner.IsActive))
            {
                if ((childOwner != null) && (childOwner.IsActive))
                {
                    newMsgBox.Owner = childOwner;
                }
                else
                {
                    newMsgBox.Owner = parentOwner;
                }
            }
            else
            {
                WindowCollection WinScreens = Application.Current.Windows;
                foreach (Window screen in WinScreens)
                {
                    if ((screen.IsActive) && (screen != newMsgBox))
                    {
                        newMsgBox.Owner = screen;
                    }
                }
            }
            //
            if (newMsgBox.Owner == null)
            {
                newMsgBox.Topmost = true;
            }
            //
            newMsgBox.ShowDialog();
            return(_DialogResult);
        }
Ejemplo n.º 2
0
 public static System.Windows.Forms.DialogResult ShowBox(string messageID, BMC_Icon RequiredIcon, BMC_Button RequiredButtons, params string[] arguments)
 {
     return(ShowBox(Application.Current.FindResource(messageID) as string, RequiredIcon, RequiredButtons, true, arguments));
 }
Ejemplo n.º 3
0
 private static System.Windows.Forms.DialogResult ShowBox(string messageID, BMC_Icon RequiredIcon, BMC_Button RequiredButtons, bool isPrivateFunction, params string[] arguments)
 {
     return(ShowBox(messageID, RequiredIcon, RequiredButtons, isPrivateFunction, 0, arguments));
 }
Ejemplo n.º 4
0
        private static System.Windows.Forms.DialogResult ShowText(string message, BMC_Icon RequiredIcon, BMC_Button RequiredButtons, bool isPrivateFunction, params string[] arguments)
        {
            newMsgBox = new MessageBox();

            newMsgBox.MsgContent.Text = message;
            if (message.Length > 100) { newMsgBox.MsgContent.FontSize = 14.0; }

            switch (RequiredIcon)
            {
                case (BMC_Icon.Information):
                    {
                        newMsgBox.icnInformation.Opacity = 1.0;
                        break;
                    }
                case (BMC_Icon.Warning):
                    {
                        newMsgBox.icnWarning.Opacity = 1.0;
                        break;
                    }
                case BMC_Icon.Question:
                    {
                        newMsgBox.icnQuestion.Opacity = 1.0;
                        break;
                    }
                case BMC_Icon.Error:
                    {
                        newMsgBox.icnError.Opacity = 1.0;
                        break;
                    }
                default:
                    {
                        newMsgBox.icnError.Opacity = 1.0;
                        break;
                    }
            }

            switch (RequiredButtons)
            {
                case BMC_Button.OK:
                    {
                        newMsgBox.OK.Visibility = Visibility.Visible;
                        break;
                    }
                case BMC_Button.OKCancel:
                    {
                        newMsgBox.OK.Visibility = Visibility.Visible;
                        newMsgBox.Cancel.Visibility = Visibility.Visible;
                        break;
                    }
                case BMC_Button.YesNo:
                    {
                        newMsgBox.Yes.Visibility = Visibility.Visible;
                        newMsgBox.No.Visibility = Visibility.Visible;
                        break;
                    }
                case BMC_Button.YesNoCancel:
                    {
                        newMsgBox.Yes.Visibility = Visibility.Visible;
                        newMsgBox.No.Visibility = Visibility.Visible;
                        newMsgBox.Cancel.Visibility = Visibility.Visible;
                        break;
                    }
                default:
                    {
                        break;
                    }
            }

            newMsgBox.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            newMsgBox.ShowDialog();
            return _DialogResult;
        }
Ejemplo n.º 5
0
 public static System.Windows.Forms.DialogResult ShowBox(string messageID, BMC_Icon RequiredIcon, BMC_Button RequiredButtons, params string[] arguments)
 {
     return ShowBox(Application.Current.FindResource(messageID) as string, RequiredIcon, RequiredButtons, true, arguments);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Creates a custom messagebox
        /// </summary>
        /// <param name="content">Content to be displayed</param>
        /// <param name="RequiredIcon">Icon to be displayed</param>
        /// <param name="RequiredButtons">Buttons to be displayed</param>
        /// <param name="arguments"></param>
        /// <returns>Dialogresult of the clicked button</returns>
        private static System.Windows.Forms.DialogResult ShowBox(string messageID, BMC_Icon RequiredIcon, BMC_Button RequiredButtons, bool isPrivateFunction, params string[] arguments)
        {
            newMsgBox = new MessageBox();
            
            var sval = messageID.Split(new string[] { "@@@@@@" }, StringSplitOptions.None);
            if (sval.Count() > 0)
            {
                string newmessage = string.Empty;
                for (int i = 0; i < sval.Count(); i++)
                {
                    newmessage += sval[i];
                    if (arguments.Count() - 1 >= i)
                        newmessage += arguments[i];
                }
                newmessage.Replace("@@@@@@", "");
                messageID = newmessage;
            }

            newMsgBox.MsgContent.Text = messageID;
            if (messageID.Length > 100) { newMsgBox.MsgContent.FontSize = 14.0; }            

            switch (RequiredIcon)
            {
                case (BMC_Icon.Information):
                    {
                        newMsgBox.icnInformation.Opacity = 1.0;
                        break;
                    }
                case (BMC_Icon.Warning):
                    {
                        newMsgBox.icnWarning.Opacity = 1.0;
                        break;
                    }
                case BMC_Icon.Question:
                    {
                        newMsgBox.icnQuestion.Opacity = 1.0;
                        break;
                    }
                case BMC_Icon.Error:
                    {
                        newMsgBox.icnError.Opacity = 1.0;
                        break;
                    }
                default:
                    {
                        newMsgBox.icnError.Opacity = 1.0;
                        break;
                    }
            }

            switch (RequiredButtons)
            {
                case BMC_Button.OK:
                    {
                        newMsgBox.OK.Visibility = Visibility.Visible;
                        break;
                    }
                case BMC_Button.OKCancel:
                    {
                        newMsgBox.OK.Visibility = Visibility.Visible;
                        newMsgBox.Cancel.Visibility = Visibility.Visible;
                        break;
                    }
                case BMC_Button.YesNo:
                    {
                        newMsgBox.Yes.Visibility = Visibility.Visible;
                        newMsgBox.No.Visibility = Visibility.Visible;
                        break;
                    }
                case BMC_Button.YesNoCancel:
                    {
                        newMsgBox.Yes.Visibility = Visibility.Visible;
                        newMsgBox.No.Visibility = Visibility.Visible;
                        newMsgBox.Cancel.Visibility = Visibility.Visible;
                        break;
                    }
                default:
                    {
                        break;
                    }
            }

            newMsgBox.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            //
            if ((parentOwner != null) && (parentOwner.IsActive))
            {
                if ((childOwner != null) && (childOwner.IsActive))
                {
                    newMsgBox.Owner = childOwner;
                }
                else
                    newMsgBox.Owner = parentOwner;
            }
            else
            {
                WindowCollection WinScreens = Application.Current.Windows;
                foreach (Window screen in WinScreens)
                {
                    if ((screen.IsActive) && (screen != newMsgBox))
                        newMsgBox.Owner = screen;
                }

            }
            //
            if (newMsgBox.Owner == null)
                newMsgBox.Topmost = true;
            //
            newMsgBox.ShowDialog();
            return _DialogResult;            
        }
Ejemplo n.º 7
0
 public static System.Windows.Forms.DialogResult ShowText(string message, BMC_Icon RequiredIcon, BMC_Button RequiredButtons, params string[] arguments)
 {
     return ShowBox(message, RequiredIcon, RequiredButtons, true, arguments);
 }
Ejemplo n.º 8
0
        private static System.Windows.Forms.DialogResult ShowText(string message, BMC_Icon RequiredIcon, BMC_Button RequiredButtons, bool isPrivateFunction, params string[] arguments)
        {
            newMsgBox = new MessageBox();

            newMsgBox.MsgContent.Text = message;
            if (message.Length > 100)
            {
                newMsgBox.MsgContent.FontSize = 14.0;
            }

            switch (RequiredIcon)
            {
            case (BMC_Icon.Information):
            {
                newMsgBox.icnInformation.Opacity = 1.0;
                break;
            }

            case (BMC_Icon.Warning):
            {
                newMsgBox.icnWarning.Opacity = 1.0;
                break;
            }

            case BMC_Icon.Question:
            {
                newMsgBox.icnQuestion.Opacity = 1.0;
                break;
            }

            case BMC_Icon.Error:
            {
                newMsgBox.icnError.Opacity = 1.0;
                break;
            }

            default:
            {
                newMsgBox.icnError.Opacity = 1.0;
                break;
            }
            }

            switch (RequiredButtons)
            {
            case BMC_Button.OK:
            {
                newMsgBox.OK.Visibility = Visibility.Visible;
                break;
            }

            case BMC_Button.OKCancel:
            {
                newMsgBox.OK.Visibility     = Visibility.Visible;
                newMsgBox.Cancel.Visibility = Visibility.Visible;
                break;
            }

            case BMC_Button.YesNo:
            {
                newMsgBox.Yes.Visibility = Visibility.Visible;
                newMsgBox.No.Visibility  = Visibility.Visible;
                break;
            }

            case BMC_Button.YesNoCancel:
            {
                newMsgBox.Yes.Visibility    = Visibility.Visible;
                newMsgBox.No.Visibility     = Visibility.Visible;
                newMsgBox.Cancel.Visibility = Visibility.Visible;
                break;
            }

            default:
            {
                break;
            }
            }

            newMsgBox.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            newMsgBox.ShowDialog();
            return(_DialogResult);
        }
Ejemplo n.º 9
0
 public static System.Windows.Forms.DialogResult ShowText(string message, BMC_Icon RequiredIcon, BMC_Button RequiredButtons, params string[] arguments)
 {
     return(ShowBox(message, RequiredIcon, RequiredButtons, true, arguments));
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Creates a custom messagebox
        /// </summary>
        /// <param name="content">Content to be displayed</param>
        /// <param name="RequiredIcon">Icon to be displayed</param>
        /// <param name="RequiredButtons">Buttons to be displayed</param>
        /// <returns>Dialogresult of the clicked button</returns>
        public static System.Windows.Forms.DialogResult showBox(string content, BMC_Icon RequiredIcon, BMC_Button RequiredButtons)
        {
            newMsgBox = new MessageBox();
            newMsgBox.MsgContent.Text = content;
            //newMsgBox.tbHeader.Text = RequiredIcon.ToString();

            switch (RequiredIcon)
            {
            case (BMC_Icon.Information):
            {
                newMsgBox.icnInformation.Opacity = 1.0;
                break;
            }

            case (BMC_Icon.Warning):
            {
                newMsgBox.icnWarning.Opacity = 1.0;
                break;
            }

            case BMC_Icon.Question:
            {
                newMsgBox.icnQuestion.Opacity = 1.0;
                break;
            }

            case BMC_Icon.Error:
            {
                newMsgBox.icnError.Opacity = 1.0;
                break;
            }

            default:
            {
                newMsgBox.icnError.Opacity = 1.0;
                break;
            }
            }

            switch (RequiredButtons)
            {
            case BMC_Button.OK:
            {
                newMsgBox.btnOK.Visibility = Visibility.Visible;
                break;
            }

            case BMC_Button.OKCancel:
            {
                newMsgBox.btnOK.Visibility     = Visibility.Visible;
                newMsgBox.btnCancel.Visibility = Visibility.Visible;
                break;
            }

            case BMC_Button.YesNo:
            {
                newMsgBox.btnYes.Visibility = Visibility.Visible;
                newMsgBox.btnNo.Visibility  = Visibility.Visible;
                break;
            }

            case BMC_Button.YesNoCancel:
            {
                newMsgBox.btnYes.Visibility    = Visibility.Visible;
                newMsgBox.btnNo.Visibility     = Visibility.Visible;
                newMsgBox.btnCancel.Visibility = Visibility.Visible;
                break;
            }

            default:
            {
                break;
            }
            }

            newMsgBox.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            newMsgBox.ShowDialog();
            return(_DialogResult);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Creates a custom messagebox
        /// </summary>
        /// <param name="content">Content to be displayed</param>
        /// <param name="RequiredIcon">Icon to be displayed</param>
        /// <param name="RequiredButtons">Buttons to be displayed</param>
        /// <returns>Dialogresult of the clicked button</returns>
        public static System.Windows.Forms.DialogResult showBox(string content, BMC_Icon RequiredIcon, BMC_Button RequiredButtons)
        {
            newMsgBox = new MessageBox();
            newMsgBox.MsgContent.Text = content;
            //newMsgBox.tbHeader.Text = RequiredIcon.ToString();

            switch (RequiredIcon)
            {
                case (BMC_Icon.Information):
                    {
                        newMsgBox.icnInformation.Opacity = 1.0;
                        break;
                    }
                case (BMC_Icon.Warning):
                    {
                        newMsgBox.icnWarning.Opacity = 1.0;
                        break;
                    }
                case BMC_Icon.Question:
                    {
                        newMsgBox.icnQuestion.Opacity = 1.0;
                        break;
                    }
                case BMC_Icon.Error:
                    {
                        newMsgBox.icnError.Opacity = 1.0;
                        break;
                    }
                default:
                    {
                        newMsgBox.icnError.Opacity = 1.0;
                        break;
                    }
            }

            switch (RequiredButtons)
            {
                case BMC_Button.OK:
                    {
                        newMsgBox.btnOK.Visibility = Visibility.Visible;
                        break;
                    }
                case BMC_Button.OKCancel:
                    {
                        newMsgBox.btnOK.Visibility = Visibility.Visible;
                        newMsgBox.btnCancel.Visibility = Visibility.Visible;
                        break;
                    }
                case BMC_Button.YesNo:
                    {
                        newMsgBox.btnYes.Visibility = Visibility.Visible;
                        newMsgBox.btnNo.Visibility = Visibility.Visible;
                        break;
                    }
                case BMC_Button.YesNoCancel:
                    {
                        newMsgBox.btnYes.Visibility = Visibility.Visible;
                        newMsgBox.btnNo.Visibility = Visibility.Visible;
                        newMsgBox.btnCancel.Visibility = Visibility.Visible;
                        break;
                    }
                default:
                    {
                        break;
                    }
            }

            newMsgBox.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            newMsgBox.ShowDialog();
            return _DialogResult;
        }
Ejemplo n.º 12
0
 private static System.Windows.Forms.DialogResult ShowBox(string messageID, BMC_Icon RequiredIcon, BMC_Button RequiredButtons, bool isPrivateFunction, params string[] arguments)
 {
     return ShowBox(messageID, RequiredIcon, RequiredButtons, isPrivateFunction, 0, arguments);
 }