예제 #1
0
        private void ConnectionOnOnMessage(string msg)
        {
            if (msg.StartsWith("PlugState"))
            {
                msg = msg.Replace("PlugState", "");
                MyPlugState state = JsonConvert.DeserializeObject <MyPlugState>(msg);



                for (int i = 0; i < devicesCollection.Count; i++)
                {
                    if (string.Equals(devicesCollection[i].Mac, state.Mac))
                    {
                        state.IsOn = state.IsOn ?? false;
                        state.IsScheduleEnabled = state.IsScheduleEnabled ?? false;

                        devicesCollection[i].MyPlugState = state;
                        if (state.Schedule != null)
                        {
                            devicesCollection[i].MyPlugState.MyScheduleList =
                                helper.DisirializeSchedule(devicesCollection[i].MyPlugState.Schedule);
                        }
                    }
                }

                Device.BeginInvokeOnMainThread(() =>
                {
                    Indicator.IsRunning     = false;
                    Indicator.IsVisible     = false;
                    DevListView.ItemsSource = devicesCollection;
                });
            }
        }
예제 #2
0
        private void ConnectionOnOnMessage(string msg)
        {
            if (msg.StartsWith("PlugState"))
            {
                msg = msg.Replace("PlugState", "");
                MyPlugState state = JsonConvert.DeserializeObject <MyPlugState>(msg);



                for (int i = 0; i < devicesCollection.Count; i++)
                {
                    if (devicesCollection[i].Mac == state.Mac)
                    {
                        state.IsOn = state.IsOn ?? false;
                        devicesCollection[i].MyPlugState = state;
                    }
                }



                Device.BeginInvokeOnMainThread(() =>
                {
                    Indicator.IsRunning = false;
                    Indicator.IsVisible = false;

                    DevListView.ItemsSource = devicesCollection;
                });
            }
        }
예제 #3
0
 private void ConnectionOnOnMessage(string msg)
 {
     if (msg.StartsWith("PlugState"))
     {
         msg = msg.Replace("PlugState", "");
         MyPlugState state = JsonConvert.DeserializeObject <MyPlugState>(msg);
         if (string.Equals(p.Mac, state.Mac))
         {
             p.MyPlugState = state;
             p.MyPlugState.MyScheduleList = _helper.DisirializeSchedule(p.MyPlugState.Schedule);
             Device.BeginInvokeOnMainThread(() =>
             {
                 SchedulesListView.ItemsSource = p.MyPlugState.MyScheduleList;
                 Indicator.IsRunning           = false;
                 Indicator.IsVisible           = false;
                 MainStack.IsVisible           = true;
             });
         }
     }
 }