public MainWindow()
 {
     InitializeComponent();
    coor_mgr = ((App.Current) as App).coor_mgr;
   InitLed2dPositoin();
   
 }
 public MainWindow()
 {
     InitializeComponent();
    coor_mgr = ((App.Current) as App).coor_mgr;
     InitLed2dPositoin();
     serviceHost = new ServiceHost(new Service1());
     serviceHost.Open();
  }
示例#3
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);
 }
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     dev_mgr=(App.Current as App).coor_mgr;
     try
     {
         StreetLightInfo[] infos = dev_mgr.GetStreetLightList(devid);
         datagrid1.ItemsSource = infos[0].sch.Segnments.OrderBy(n => n.Time).ToArray();
         info = infos[0];
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            dev_mgr=(App.Current as App).coor_mgr;
            try
            {
                CeraDevices.StreetLightInfo[] infos = dev_mgr.GetStreetLightList(devid);

                foreach (ScheduleSegnment seg in infos[0].sch.Segnments)
                {
                    if (seg.Time == 15555)
                        seg.Level = 255;
                }
                datagrid1.ItemsSource = infos[0].sch.Segnments.OrderBy(n => n.Time).ToArray();
                info = infos[0];
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#6
0
        public App()
        {
            #if Version1
               // coor_mgr = new DeviceManager(new ICoordinatorDevice[] { new CoordinatorDevice("http://10.10.1.1:8080") });
            //海洋大學 IP: 140.121.184.101  IP: 140.121.184.102  IP: 140.121.184.103
            coor_mgr = new DeviceManager(new ICoordinatorDevice[] {
            new CoordinatorDevice("http://140.121.184.101:8080"),
            new CoordinatorDevice("http://140.121.184.102:8080"),
            new CoordinatorDevice("http://140.121.184.103:8080")
            });

            #else
               // coor_mgr = new DeviceManager(new ICoordinatorDevice[] { new CoordinatorDevice2("http://192.168.0.99:8080") });
              //  coor_mgr = new DeviceManager(new ICoordinatorDevice[] { new CoordinatorDevice2("http://122.116.43.100:8080") });
            coor_mgr = new DeviceManager(new ICoordinatorDevice[] { new CoordinatorDevice2("http://192.168.1.1:8080") });
            #endif
            #region 綠創園區
              //  coor_mgr = new DeviceManager(new CeraDevices.CoordinatorDevice[] { new CeraDevices.CoordinatorDevice("http://172.16.23.92:8080") });
            #endregion

            try
            {
            #if !DEBUG
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
                street_light_info = coor_mgr.GetStreetLightList();

            #endif
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "," + ex.StackTrace);
                Environment.Exit(-1);
            }
        }
示例#7
0
        public App()
        {
            #if !DEBUG  //龜山
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            coor_mgr = new DeviceManager(new CeraDevices.CoordinatorDevice[] { new CeraDevices.CoordinatorDevice("http://10.10.1.1:8080"), new CeraDevices.CoordinatorDevice("http://10.10.1.2:8080") });
              // 銘傳士林校區

              // coor_mgr = new DeviceManager(new CeraDevices.CoordinatorDevice[] { new CeraDevices.CoordinatorDevice("http://10.10.1.1:8080") });
            try
            {

               street_light_info = coor_mgr.GetStreetLightList();

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "," + ex.StackTrace);
                Environment.Exit(-1);
            }
            #endif
        }