Example #1
0
        public NotifyBoxForm(string title, string titleEng, string message, NotifyBox.NotifyBoxType type, NotifyBox.NotifyBoxIcon icon, int time)
        {
            InitializeComponent( );

            this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw, true);
            this.UpdateStyles( );
            this.Opacity = 0;

            switch (icon)
            {
            case NotifyBox.NotifyBoxIcon.Information:
                SystemSounds.Asterisk.Play( );
                this.APP_TITLE_BAR.TextColor = Color.White;
                this.APP_TITLE_BAR.BackColor = Color.Gray;
                break;

            case NotifyBox.NotifyBoxIcon.Question:
                SystemSounds.Asterisk.Play( );
                this.APP_TITLE_BAR.TextColor = Color.White;
                this.APP_TITLE_BAR.BackColor = Color.DodgerBlue;
                break;

            case NotifyBox.NotifyBoxIcon.Error:
                SystemSounds.Hand.Play( );
                this.APP_TITLE_BAR.TextColor = Color.White;
                this.APP_TITLE_BAR.BackColor = Color.FromArgb(255, 255, 100, 100);
                break;

            case NotifyBox.NotifyBoxIcon.Danger:
                SystemSounds.Hand.Play( );
                this.APP_TITLE_BAR.TextColor = Color.White;
                this.APP_TITLE_BAR.BackColor = Color.Crimson;
                break;

            case NotifyBox.NotifyBoxIcon.Warning:
                break;
            }

            this.APP_TITLE_BAR.KoreanText  = title;
            this.APP_TITLE_BAR.EnglishText = titleEng;
            this.MESSAGE_LABEL.Text        = message;

            switch (type)
            {
            case NotifyBox.NotifyBoxType.OK:
                this.OK_BUTTON.Visible  = true;
                this.YES_BUTTON.Visible = false;
                this.NO_BUTTON.Visible  = false;

                this.FormClosing += delegate(object sender, FormClosingEventArgs e)
                {
                    if (Result != NotifyBox.NotifyBoxResult.OK)
                    {
                        Result = NotifyBox.NotifyBoxResult.OK;
                    }
                };
                break;

            case NotifyBox.NotifyBoxType.YesNo:
                this.OK_BUTTON.Visible  = false;
                this.YES_BUTTON.Visible = true;
                this.NO_BUTTON.Visible  = true;

                this.FormClosing += delegate(object sender, FormClosingEventArgs e)
                {
                    if (Result != NotifyBox.NotifyBoxResult.Yes && Result != NotifyBox.NotifyBoxResult.No)
                    {
                        Result = NotifyBox.NotifyBoxResult.No;
                    }
                };
                break;

            case NotifyBox.NotifyBoxType.TimeNotify:
                this.OK_BUTTON.Visible  = true;
                this.OK_BUTTON.Enabled  = false;
                this.OK_BUTTON.Text     = time + "초 후 닫힘";
                this.YES_BUTTON.Visible = false;
                this.NO_BUTTON.Visible  = false;

                System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer( )
                {
                    Interval = 1000
                };
                timer.Tick += (object sender, EventArgs e) =>
                {
                    this.OK_BUTTON.Text = (--time > 0 ? time : 0) + "초 후 닫힘";

                    if (time <= 0)
                    {
                        Animation.UI.FadeOut(this, true);
                    }
                };
                timer.Start( );

                this.FormClosing += delegate(object sender, FormClosingEventArgs e)
                {
                    Result = NotifyBox.NotifyBoxResult.Null;
                };
                break;
            }
        }
Example #2
0
 private void OK_BUTTON_Click(object sender, EventArgs e)
 {
     this.Result = NotifyBox.NotifyBoxResult.OK;
     Animation.UI.FadeOut(this, true);
 }