안녕하세요. 내 프로그램이 항상 백그라운드에서 업데이트를 찾는 앱을 가질 수 있는지 궁금합니다. 앱 업데이트를 전달할 때 사용 가능한 업데이트가 있음을 알리는 알림이 약간 있습니다. 내 프로그램은 현재 프로그램이 시작될 때 메시지 상자가 있고 Java와 같은 작업 표시 줄에 아이콘을 갖고 싶기 때문에 잠시 기다려야한다는 메시지가 나타나면 잠시 기다려주십시오. # 업데이트 알림 메시지를 표시 하시겠습니까?
이
내가 notification를 수행 할 작업의 그림이며,이 내가 업데이트를 확인하기 위해 현재 가지고있는 코드입니다.
public void CheckForUpdates()
{
try
{
CleanUp();
WebClient downloadClient = new WebClient();
downloadClient.DownloadFile(UpdateUrl, LocalUpdateFile);
downloadClient.Dispose();
if (!File.Exists(LocalUpdateFile))
throw new FileNotFoundException("The local update file is missing!", LocalUpdateFile);
UpdateSaveFile localFile = DecodeSaveFile(LocalUpdateFile);
Version localVersion = Assembly.GetEntryAssembly().GetName().Version;
Version onlineVersion = Version.Parse(localFile.VersionString);
if (onlineVersion > localVersion)
{
if (DevExpress.XtraEditors.XtraMessageBox.Show(String.Format("Version {0} available,\nInstall it now?", onlineVersion.ToString()), "Elfenliedtopfan5 BO3 Weapon Adder Updater.", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)//MessageBox.Show(String.Format("Version {0} available,\nInstall it now?", onlineVersion.ToString()), "Youtube Updater", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
frmUpdater updateForm = new frmUpdater(localFile, GetPath(UpdateUrl));
updateForm.ShowDialog();
}
}
else
{
Message_elf msg = new Message_elf("You already have the latest version!", "elfenliedtopfan5 weapon adder 2016");
//MessageBox.Show("You already have the latest version!", "Youtube Updater", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch (Exception e)
{
MessageBox.Show("Error checking for updates\ntry again later!\n\nError Message:" + e.Message, "Youtube Updater", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
나는 이것을 내 메인 양식을 통해 호출 할 수 있습니다.
updater1.CheckForUpdates();
어떤 도움을 많이 받았다.
이 항목을 검토 한 적이 있습니까? http://stackoverflow.com/questions/11027051/how-to-develop-a-program-that-runs-in-the-background-in-net? – vipersassassin