# PlayerMonitoring [C#]

This example shows how to retrive groups and players monitoring from specific manager, and how to send an update to players.

[C#]

       //Initialize the XAML object and retrieve group from server by login
       public PlayerMonitoring(string login, string password)
       {
           InitializeComponent();

           //Login and retrive group
           List<View_Group> listResult;
           sample.GetGroup(out listResult, login, password);

           //Bind group to TreeList
           treeGroup.ItemsSource = TreeNode.GetTreeNode(listResult);

           //Retrive the list of player monitoring
           long serverDate;
           sample.GetMonitoring(out listPLayer, out serverDate);

           //Update the Server date for retrive the player status
           Monitoring.ServerDate = serverDate;
       }

[C#]

       //Select group and retrive coresponding player
       private void treeGroup_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
       {
           //Retrive player by group from list of player
           ObservableCollection<Monitoring> listMonitoring = new ObservableCollection<Monitoring>();
           (from l1 in listPLayer where l1.GroupId == (treeGroup.SelectedItem as TreeNode).Id select l1).ToList().ForEach(x => listMonitoring.Add(new Monitoring(x)));

           //Bind player to list
           gridPlayer.ItemsSource = listMonitoring;
       }

[C#]

       //Send update to specific player(s)
       private void btnValidate_Click(object sender, RoutedEventArgs e)
       {
           //Retrive list of selected player
           List<long> listPLayerId = (from l1 in (gridPlayer.ItemsSource as ObservableCollection<Monitoring>) where l1.IsChecked select l1.player.PlayerId).ToList();
           sample.SendUpdate(listPLayerId);

           MessageBox.Show("Updates Sent");
       }