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); }
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); } }
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( ); }
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); } }
private void NO_Button_Click(object sender, EventArgs e) { Result = NotifyBoxResult.No; this.CloseForm( ); }
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; } }
private void OK_Button_Click(object sender, EventArgs e) { Result = NotifyBoxResult.OK; this.Close( ); }
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; } }