Develop Windows programs using C#
Use WebAPI.Client to develop WPF program.
- Use Visual Studio 2022 to develop software, create a new WPF Application project
- Add project reference: IoT.API.WebApi.Client.dll
-
Create a new MainWindow.xaml window and add the following code:
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Reflection; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using IoT.API.WebApi.Client; namespace IoT.Example.WpfApp { public partial class MainWindow : Window { public string AppId { get; set; } public string AppKey { get; set; } public string AppSecret { get; set; } public MainWindow() { InitializeComponent(); AppClient.GetInstance().Initialize(AppId, AppKey, AppSecret); } } }
- After completing the above operations, you can use AppClient.GetInstance() to call the Web API function in the program. Please refer to the sample program for details.


Download the WPF sample program
WPF sample program, the operating environment requirements are .Net Core 5
- Example Source Code:https://cloud.tzonedigital.cn/f/dev/Example.WPFApp/source_code.zip