UpdateManager ถูกสร้างขึ้นตามกำหนดเวลา ห้องสมุดนี้ได้รับการพัฒนาฟรี
ไลบรารีนี้สามารถใช้เพื่อตรวจสอบการอัปเดตแอปพลิเคชัน มันถูกออกแบบมาสำหรับแอพพลิเคชั่น WPF และ Windows ในการใช้งานคุณต้องใช้ไฟล์ XML หรือ JSON บนรีโมตหรือเซิร์ฟเวอร์ท้องถิ่นที่แสดงถึงคลาสการอัปเดต
UpdateManager มีให้บริการเป็นแพ็คเกจ NUGET คุณสามารถค้นหาได้ที่นี่:
https://www.nuget.org/packages/codedead.updatemanager/
ตัวอย่างโครงการสามารถพบได้ที่นี่:
https://github.com/codedead/updatemanager/tree/master/updatemanager.sample
https://github.com/codedead/updatemanager/tree/master/updatemanager.sample.wpf
สร้างวัตถุ updateManager ใหม่เช่นนี้:
// Import statement
using CodeDead . UpdateManager . Classes ;
// Initialize a new UpdateManager object
UpdateManager updateManager = new UpdateManager ( ) ;คุณสามารถตรวจสอบการอัปเดตเช่นนี้:
try
{
// Retrieve the latest Update object from the remote location
Update update = updateManager . GetLatestVersion ( ) ;
}
catch ( Exception ex )
{
MessageBox . Show ( ex . Message , "Application title" , MessageBoxButton . OK , MessageBoxImage . Error ) ;
} การอัปเดตสามารถจัดเก็บและแยกวิเคราะห์ในสองรูปแบบที่แตกต่างกัน: JSON หรือ XML โดยค่าเริ่มต้นคุณสมบัติ ข้อมูล จะถูกตั้งค่าเป็น JSON คุณสามารถเปลี่ยนคุณสมบัติ ข้อมูล ได้โดยการตั้งค่าคุณสมบัติที่เหมาะสมบนวัตถุ UpdateManager :
// Initialize a new UpdateManager object
UpdateManager updateManager = new UpdateManager ( ) ;
// Set the data type of the remote Update object representation
updateManager . DataType = DataType . Json ; // Initialize a new UpdateManager object
UpdateManager updateManager = new UpdateManager ( ) ;
// Set the data type of the remote Update object representation
updateManager . DataType = DataType . Xml ;{
"MajorVersion" : 1 ,
"MinorVersion" : 0 ,
"BuildVersion" : 0 ,
"RevisionVersion" : 0 ,
"UpdateUrl" : " https://codedead.com/update.exe " ,
"InfoUrl" : " https://codedead.com " ,
"UpdateInfo" : " A new version is now available. Please click the download button to download version 1.0.0.0 "
}<? xml version = " 1.0 " ?>
< Update xmlns : xsd = " http://www.w3.org/2001/XMLSchema " xmlns : xsi = " http://www.w3.org/2001/XMLSchema-instance " >
< MajorVersion >1</ MajorVersion >
< MinorVersion >0</ MinorVersion >
< BuildVersion >0</ BuildVersion >
< RevisionVersion >0</ RevisionVersion >
< UpdateUrl >https://example.com/update.exe</ UpdateUrl >
< InfoUrl >https://codedead.com/</ InfoUrl >
< UpdateInfo >A new version is now available. Please click the download button to download version 1.0.0.0</ UpdateInfo >
</ Update >ห้องสมุดนี้ได้รับการดูแลโดย CodeDead คุณสามารถค้นหาเพิ่มเติมเกี่ยวกับเราโดยใช้ลิงก์ต่อไปนี้:
นอกจากนี้เรายังขอขอบคุณ Jetbrains สำหรับใบอนุญาตโอเพ่นซอร์สที่พวกเขาให้เราทำงานกับเครื่องมือที่ยอดเยี่ยมเช่น Rider และ Resharper