Ejemplo n.º 1
0
        public static NotifyBoxResult Show(System.Windows.Forms.Form parent, string title = "웹툰 다운로더", string message = "메세지", NotifyBoxType type = NotifyBoxType.OK, NotifyBoxIcon icon = NotifyBoxIcon.Information)
        {
            NotifyBoxResult returnType = NotifyBoxResult.Null;

            NotifyBoxInterface notify = new NotifyBoxInterface(title, message, type, icon);

            if (parent == null)
            {
                notify.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
                notify.ShowDialog( );
            }
            else
            {
                parent.Invoke(new Action(() =>
                {
                    notify.Owner         = parent;
                    notify.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
                    notify.ShowDialog(parent);

                    returnType = notify.Result;
                }));
            }

            return(returnType);
        }
Ejemplo n.º 2
0
        public static NotifyBoxResult Show(Form parent, string title, string titleEng, string message, NotifyBoxType type, NotifyBoxIcon icon, int timeout = 0)
        {
            NotifyBoxResult returnType = NotifyBoxResult.Null;

            NotifyBoxForm form = new NotifyBoxForm(title, titleEng, message, type, icon, timeout);

            if (parent == null)
            {
                form.StartPosition = FormStartPosition.CenterScreen;
                form.ShowDialog( );

                returnType = form.Result;
            }
            else
            {
                parent.Invoke(new Action(() =>
                {
                    form.Owner         = parent;
                    form.StartPosition = FormStartPosition.CenterParent;
                    form.ShowDialog(parent);

                    returnType = form.Result;
                }));
            }

            return(returnType);
        }
        private void CLOSE_BUTTON_Click(object sender, EventArgs e)
        {
            NotifyBoxResult result = NotifyBox.Show(this, "질문", "다운로드를 취소하시겠습니까?", NotifyBoxType.YesNo, NotifyBoxIcon.Question);

            if (result == NotifyBoxResult.Yes)
            {
                DownloadOptionReturn.Invoke(DownloadOptionResult.Cancel, null);
            }
        }
Ejemplo n.º 4
0
        private void CLOSE_BUTTON_Click(object sender, EventArgs e)
        {
            if (UIStatusVar == UIStatus.Working)
            {
                NotifyBoxResult result = NotifyBox.Show(this, "질문", "다운로드가 현재 진행 중 입니다, 취소하고 프로그램을 종료하시겠습니까?", NotifyBoxType.YesNo, NotifyBoxIcon.Question);

                if (result == NotifyBoxResult.No)
                {
                    return;
                }

                Webtoon.DownloadThread.Abort( );
                Webtoon.DownloadThread = null;
            }

            this.Close( );
        }
Ejemplo n.º 5
0
        private void CANCEL_BUTTON_Click(object sender, EventArgs e)
        {
            if (UIStatusVar == UIStatus.Working || UIStatusVar == UIStatus.BaseInformationTargetLockOned)
            {
                if (Webtoon.DownloadThread != null)
                {
                    NotifyBoxResult result = NotifyBox.Show(this, "질문", "다운로드를 취소하시겠습니까?", NotifyBoxType.YesNo, NotifyBoxIcon.Question);

                    if (result == NotifyBoxResult.No)
                    {
                        return;
                    }

                    Webtoon.DownloadThread.Abort( );
                    Webtoon.DownloadThread = null;
                }

                UIStatusVar = UIStatus.Idle;

                NotifyBox.Show(this, "안내", "작업이 취소되었습니다", NotifyBoxType.OK, NotifyBoxIcon.Information);
            }
        }
Ejemplo n.º 6
0
 private void NO_Button_Click(object sender, EventArgs e)
 {
     Result = NotifyBoxResult.No;
     this.CloseForm( );
 }
Ejemplo n.º 7
0
        public NotifyBoxInterface(string title, string message, NotifyBoxType type, NotifyBoxIcon icon)
        {
            InitializeComponent( );

            TITLE_LABEL.Text   = title;
            MESSAGE_LABEL.Text = message;

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

            switch (icon)
            {
            case NotifyBoxIcon.Error:
                TYPE_ICON.Image = Properties.Resources.ERROR_ICON;
                System.Media.SystemSounds.Hand.Play( );
                break;

            case NotifyBoxIcon.Information:
                TYPE_ICON.Image = Properties.Resources.INFORMATION_ICON;
                System.Media.SystemSounds.Beep.Play( );
                break;

            case NotifyBoxIcon.Warning:
                TYPE_ICON.Image = Properties.Resources.WARNING_ICON;
                System.Media.SystemSounds.Exclamation.Play( );
                break;

            case NotifyBoxIcon.Question:
                TYPE_ICON.Image = Properties.Resources.QUESTION_ICON;
                System.Media.SystemSounds.Beep.Play( );
                break;

            case NotifyBoxIcon.Danger:
                TYPE_ICON.Image = Properties.Resources.DANGER_ICON;
                System.Media.SystemSounds.Hand.Play( );
                break;
            }

            switch (type)
            {
            case NotifyBoxType.OK:
                OK_Button.Visible  = true;
                Yes_Button.Visible = false;
                NO_Button.Visible  = false;

                OK_Button.Focus( );

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

            case NotifyBoxType.YesNo:
                OK_Button.Visible  = false;
                Yes_Button.Visible = true;
                NO_Button.Visible  = true;

                this.FormClosing += delegate(object sender, FormClosingEventArgs e)
                {
                    if (Result != NotifyBoxResult.Yes && Result != NotifyBoxResult.No)
                    {
                        Result = NotifyBoxResult.No;
                    }
                };
                break;
            }
        }
Ejemplo n.º 8
0
 private void OK_Button_Click(object sender, EventArgs e)
 {
     Result = NotifyBoxResult.OK;
     this.Close( );
 }
Ejemplo n.º 9
0
        public NotifyBoxInterface(string title, string message, NotifyBoxType type, NotifyBoxIcon icon)
        {
            InitializeComponent( );

            TITLE_LABEL.Text   = title;
            MESSAGE_LABEL.Text = message;

            switch (icon)
            {
            case NotifyBoxIcon.Error:
                TYPE_ICON.Image = Properties.Resources.ERROR_ICON;
                System.Media.SystemSounds.Exclamation.Play( );
                break;

            case NotifyBoxIcon.Information:
                TYPE_ICON.Image = Properties.Resources.INFORMATION_ICON;
                System.Media.SystemSounds.Asterisk.Play( );
                break;

            case NotifyBoxIcon.Warning:
                TYPE_ICON.Image = Properties.Resources.WARNING_ICON;
                System.Media.SystemSounds.Exclamation.Play( );
                break;

            case NotifyBoxIcon.Question:
                TYPE_ICON.Image = Properties.Resources.QUESTION_ICON;
                System.Media.SystemSounds.Question.Play( );
                break;
            }

            switch (type)
            {
            case NotifyBoxType.OK:
                OK_Button.Visible  = true;
                Yes_Button.Visible = false;
                NO_Button.Visible  = false;

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

            case NotifyBoxType.YesNo:
                OK_Button.Visible  = false;
                Yes_Button.Visible = true;
                NO_Button.Visible  = true;

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