Exemplo n.º 1
0
        void statisticsClient_GetStatusesForAllDevicesCompleted(object sender, MobileDataRepo.GetStatusesForAllDevicesCompletedEventArgs e)
        {
            var statuslist = new List <ListBoxItem>();

            foreach (var data in e.Result)
            {
                var brush = new SolidColorBrush();

                brush.Color = Colors.Yellow;

                if (data.Status.ToString().Equals("Red"))
                {
                    brush.Color = Colors.Red;
                }

                if (data.Status.ToString().Equals("Green"))
                {
                    brush.Color = Colors.Green;
                }

                var lbi = new ListBoxItem
                {
                    Content     = data.DeviceName,
                    DataContext = data.Id,
                    Background  = brush
                };
                statuslist.Add(lbi);
            }


            DeviceStatusesListBox.ItemsSource = statuslist;
        }
        void statisticsDataClient_GetStatusesForAllDevicesCompleted(object sender, MobileDataRepo.GetStatusesForAllDevicesCompletedEventArgs e)
        {
            var g = new List <Grid>();

            var deviceTextBlock = new List <TextBlock>();



            var colour = new SolidColorBrush(Colors.Red);

            foreach (var res in e.Result)
            {
                if (res.Status.ToString() == "Green")
                {
                    colour.Color = Colors.Green;
                }
                if (res.Status.ToString() == "Yellow")
                {
                    colour.Color = Colors.Yellow;
                }
                var text = new TextBlock
                {
                    Text        = res.DeviceName + res.Status,
                    DataContext = res.Id,

                    Padding = new System.Windows.Thickness {
                        Top = 10
                    }
                };
                text.Tap += text_Tap;

                deviceListStackPannel.Children.Add(text);


                deviceTextBlock.Add(new TextBlock
                {
                    Text = res.DeviceName + res.Status,


                    DataContext = res.Id,
                    Padding     = new System.Windows.Thickness {
                        Top = 10
                    }
                });
            }
            // statuslistSelector.ItemsSource = g;
        }