Пример #1
0
        private async void Window_LoadedAsync(object sender, RoutedEventArgs e)
        {
            //1.启动各类定时器
            _UpdateAppTimer.Start();
            _UpdateAppTimer.Interval = new TimeSpan(0, 10, 0);
            _CheckNetStateTimer.Start();

            //2.读取系统用户列表
            AppSet.SysUsers = await DataUserRepository.GetAllRecords();

            if (AppSet.SysUsers == null || AppSet.SysUsers.Count < 2)
            {
                AppFuns.ShowMessage("读取用户列表时出错,程序无法运行。", Caption: "错误", isErr: true);
                //关闭本程序
                ShutDownApp();
            }
            //3.读取服务器设置
            AppSet.ServerSetting = await DataSystemRepository.ReadServerSettings();

            if (AppSet.ServerSetting == null)
            {
                AppFuns.ShowMessage("读取系统设置信息时出错,程序无法运行。", Caption: "错误", isErr: true);
                //关闭本程序
                ShutDownApp();
            }
            lblLoginMsg.Text = $"当前用户:{AppSet.LoginUser.Name}-{AppSet.LoginUser.UnitName}";
            ListBoxItem_MouseLeftButtonUp_0(null, null);
        }
            public async void UpdateEntityInfoAsync()
            {
                ExcuteResult excute = await DataSystemRepository.UpdateServerSettings(EntitySettingServer);

                if (excute.State == 0)
                {
                    AppFuns.ShowMessage("更新成功!");
                    AppSet.ServerSetting = EntitySettingServer;
                }
            }
 public async Task GetEntityInfoAsync()
 {
     EntitySettingServer = await DataSystemRepository.ReadServerSettings();
 }