Ejemplo n.º 1
0
        private void PopulateList()
        {
            // **** BLOC TO RETRIEVE NOTIFICATIONS LIST ***
            if (!SpecialFeatures.SpecialFeaturesMgt.AreSpecialFeaturesEnabled())
            {
                return;
            }
            List <String> options;
            ImageList     imglist2;
            List <Tuple <String, String, bool, String, String, String> > lsentries;
            List <String>   checkedvalues;
            CookieContainer cookieJar = _daddy.CheckGCAccount(true, false);

            if (cookieJar == null)
            {
                return;
            }
            NotificationsManager.RetrieveNotificationsList(_daddy, out options, out imglist2, out lsentries, out checkedvalues);
            // **** END BLOC TO RETRIEVE NOTIFICATIONS LIST ***

            // Get details on notifications and group them
            Dictionary <String, List <GCNotification> > diconotifs = new Dictionary <string, List <GCNotification> >();
            String post_response = "";

            foreach (Tuple <String, String, bool, String, String, String> tpl in lsentries)
            {
                GCNotification gcn = NotificationsManager.GetNotificationData(_daddy, tpl.Item2, ref post_response);
                String         key = gcn.dlat.ToString() + gcn.dlon.ToString() + gcn.distance.ToString();
                if (diconotifs.ContainsKey(key))
                {
                    diconotifs[key].Add(gcn);
                }
                else
                {
                    diconotifs.Add(key, new List <GCNotification>(new GCNotification[] { gcn }));
                }
            }

            _dicoItemGCs.Clear();
            lvGCNListGroup.Items.Clear();
            foreach (KeyValuePair <String, List <GCNotification> > pair in diconotifs)
            {
                GCNotification gcn    = pair.Value[0];
                String         sLat2  = CoordConvHMI.ConvertDegreesToDDMM(gcn.dlat, true);
                String         sLon2  = CoordConvHMI.ConvertDegreesToDDMM(gcn.dlon, false);
                String         coord  = /*"DD° MM.MMM: " + */ sLat2 + " " + sLon2 + "\r\n";
                String         radius = gcn.distance.ToString() + " Km";

                // Create line
                if (pair.Value.Count == 1)
                {
                    AddGCNToList(gcn, gcn.GetTypeKeyInEnglish(), pair.Value);
                }
                else
                {
                    AddGCNToList(gcn, "GroupCaches", pair.Value);
                }
            }
        }