Beispiel #1
0
 static App()
 {
     config = Config.ReadXml("config.xml");
     CeraDevices.CoordinatorDevice[] devices = new CoordinatorDevice[config.Coordinators.Length];
     for (int i = 0; i < config.Coordinators.Length; i++)
         devices[i] = new CoordinatorDevice(config.Coordinators[i].BaseUrl);
     devmgr = new DeviceManager(devices);
 }
Beispiel #2
0
        public Main()
        {
            InitializeComponent();
            coor = ((App.Current) as App).dev;
            
        //    this.ledBtn.Foreground = new SolidColorBrush(Colors.White);
          //this.ledBtn.Text = this.ledBtn.Text;
          //  this.ledBtn.Foreground = this.ledBtn.Foreground;
         

        }
Beispiel #3
0
 public App()
 {
     dev = new CeraDevices.CoordinatorDevice("http://10.10.1.1:8080");
     try
     {
     #if !DEBUG
       street_light_info=  dev.GetStreetLightList();
     #endif
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + "," + ex.StackTrace);
         Environment.Exit(-1);
     }
 }
 public FongNanMain()
 {
     InitializeComponent();
     coor = ((App.Current) as App).dev;
     if (RestHost == null)
     {
         RestHost = new ServiceHost(new wcfShschool.Service1() { main = this });
         //  RestHost.BaseAddresses = new Uri("http://localhost:8083", UriKind.Absolute);
         RestHost.Open();
     }
 //    this.ledBtn.Foreground = new SolidColorBrush(Colors.White);
   //this.ledBtn.Text = this.ledBtn.Text;
   //  this.ledBtn.Foreground = this.ledBtn.Foreground;
  
   
 }
        private async void Grid_Loaded(object sender, RoutedEventArgs e)
        {
            device = new CeraDevices.CoordinatorDevice(BaseUrl);
            try
            {
                StreetLightInfo[] infos = await device.GetStreetLightListAsync();
                this.grdDeviceInfo.ItemsSource = infos;
                tmr=new System.Windows.Threading.DispatcherTimer(){ Interval=TimeSpan.FromSeconds(5)};
                tmr.Tick += tmr_Tick;
                tmr.Start();
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
            }


          
        }