示例#1
0
        public void TimerAction()
        {
            if (Timer.Delay > 2)
            {
                Timer.Delay -= Timer.Delay / 20;
            }
            DateTime tmp = CurrentDate.AddMonths(tmrMonthDelta).Date;

            if (Math.Abs((DateTime.Now - tmp).TotalDays / 365) < 1000)
            {
                CurrentDate = tmp;
            }
            else
            {
                Timer.Stop();
                tmrMonthDelta = -tmrMonthDelta;
                MessageBoxOverlay.ShowSuccess("You won. I loose.", ParentWindow);
            }
            Invalidate();
        }
示例#2
0
        public static DialogResults Show(string message, MessageBoxTypes msgType = MessageBoxTypes.Info, MessageBoxButtons buttons = MessageBoxButtons.OkCancel, SummerGUIWindow parent = null)
        {
            // *** Icon
            FontAwesomeIcons icon         = FontAwesomeIcons.fa_anchor;
            ColorContexts    colorContext = ColorContexts.Default;

            // init icon
            switch (msgType)
            {
            case MessageBoxTypes.Info:
                icon         = FontAwesomeIcons.fa_info_circle;
                colorContext = ColorContexts.Information;
                break;

            case MessageBoxTypes.Success:
                icon         = FontAwesomeIcons.fa_exclamation_circle;
                colorContext = ColorContexts.Success;
                break;

            case MessageBoxTypes.Warning:
                icon         = FontAwesomeIcons.fa_warning;
                colorContext = ColorContexts.Warning;
                break;

            case MessageBoxTypes.Error:
                icon         = FontAwesomeIcons.fa_times_circle;
                colorContext = ColorContexts.Danger;
                break;

            case MessageBoxTypes.Question:
                icon         = FontAwesomeIcons.fa_question_circle;
                colorContext = ColorContexts.Question;
                break;

            case MessageBoxTypes.Help:
                icon         = FontAwesomeIcons.fa_life_ring;
                colorContext = ColorContexts.Success;
                break;
            }

            MessageBoxOverlay box = new MessageBoxOverlay(parent, colorContext);

            box.InitIconImage((char)icon, colorContext);

            // *** Buttons
            box.InitButtons(buttons, colorContext);
            box.InitText(message.TrimRightLinebreaks() + "\n", colorContext);

            if (msgType == MessageBoxTypes.Error)
            {
                //box.InitCopyButton ();
            }

            box.Style.BackColorBrush.Color =
                Color.FromArgb(30, Color.DarkSlateGray);
            /*** ***/

            box.Show(parent);
            box.Focus();

            return(DialogResults.OK);

            /***
             * if (box != null)
             *      box.Dispose ();
             * return box.Result;
             ***/
        }