Exemple #1
0
        public MainPage()
        {
            if (UdpServer.IsRunning == false)
            {
                ThemeManager.Init();
                StartServer();
                RoomCreater.LoadListFromFile();

                DataSample newel = new DataSample
                {
                    SenderId    = "21000000",
                    Temperature = 35,
                    Humidity    = 20,
                    Movement    = 1,
                    CoLevel     = 12,
                    LpgLevel    = 0,
                    SmokeLevel  = 0
                };



                Unit newUnit = new Unit
                {
                    Id   = "21000000",
                    Type = "Switcer",
                    Auto = true
                };
                Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                {
                    Collections.AddToActualDatas(newel);
                    Collections.UnitsToLocalize.Add(newel.SenderId);
                    Collections.AddToNodeList(newUnit);
                });
            }
            this.InitializeComponent();
            DataContext = this;
            InitClock();


            RefreshAvgTemp("init");
            Collections.ResreshSenderDataEvent += RefreshAvgTemp;
        }
Exemple #2
0
 private void Button_Tapped(object sender, TappedRoutedEventArgs e)
 {
     RoomCreater.SaveLisToFile();
     this.Frame.Navigate(typeof(MainPage));
 }