똑똑해진느낌/C#

[C#] 알림창 만들기 (Notices)

찐쿵 2019. 10. 30. 10:59

c# winform 개발 중 알림창 띄우는 방식을 기록해본다.

"GUI"

"작동 시나리오"

1. 상위버전으로 게시하면, 프로그램 실행 시 무조건 띄움.

2. 동일버전 사용 중에는 사용자가 [다음 업데이트까지 보지 않겠습니다.] 를 선택하기 전까지는 실행시마다 띄움.

단, 해당 체크박스를 선택하면 동일버전 중에서는 알림창 띄우지 않음.

"속성값"

NoticeShow : 사용자가 알림창 보지않음을 선택한 값 (boolean)

Version : 해당 프로그램의 빌드 버전 (int)

"구현"

if (AssemblyVersion.Build != Properties.Settings.Default.Version)
{
    Properties.Settings.Default["Version"] = AssemblyVersion.Build;
    Properties.Settings.Default["NoticeShow"] = true;
    Properties.Settings.Default.Save();
}

if (Properties.Settings.Default.NoticeShow)
{
    Form CheckForm = Application.OpenForms["Notices"];
    if (CheckForm == null)
    {
        Notices = new _0.Main.Notices();
        Notices.Show(this);
    }
    else { Notices.BringToFront(); }
}