Exemplo n.º 1
0
 static BaseData()
 {
     try
     {
         string     serverNum  = System.Configuration.ConfigurationManager.AppSettings["ServerNum"];
         DC_Service dC_Service = new DC_Service();
         Server  = dC_Service.GetDCServer(serverNum);
         Devices = dC_Service.GetDCDevices(Server, 1);
         Configs = dC_Service.GetDCDataConfigs(Devices.Select(s => s.ID).ToList(), 1);
     }
     catch (Exception)
     {
     }
 }
Exemplo n.º 2
0
 private void Load()
 {
     try
     {
         List <DC_SERVER> servers = dC_Service.GetDCServers().OrderBy(s => s.NAME).ToList();
         foreach (var server in servers)
         {
             server.Devices = new ObservableCollection <DC_DEVICE>(dC_Service.GetDCDevices(server).OrderBy(s => s.NAME).ToList());
             foreach (var device in server.Devices)
             {
                 device.Configs = new ObservableCollection <DC_DATA_CONFIG>(dC_Service.GetDCDataConfigs(device).OrderBy(s => s.NAME).ToList());
             }
         }
         Servers = new ObservableCollection <DC_SERVER>(servers);
         OnPropertyChanged("Servers");
     }
     catch (Exception ex)
     {
         MessageBox.Show("加载异常。" + ex.Message, "提示", MessageBoxButton.OK, MessageBoxImage.Information);
     }
 }