Esempio 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);
                }
            }
        }
Esempio n. 2
0
        private void AddGCNToList(GCNotification gcn, String keyIcon, List <GCNotification> lst, bool special = false, int index = -1)
        {
            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";

            String lbl = gcn.name;

            if (special)
            {
                lbl = gcn.GetTypeKeyInEnglish();
            }

            EXImageListViewItem lvi = null;

            if (special)
            {
                lvi = new EXImageListViewItem(lbl, _daddy.GetImageSized("Nothing"));
                EXImageListViewSubItem svi2 = new EXImageListViewSubItem(_daddy.GetImageSized(keyIcon));
                lvi.SubItems.Add(svi2);
            }
            else
            {
                lvi = new EXImageListViewItem(lbl, _daddy.GetImageSized(keyIcon));
                EXImageListViewSubItem svi2 = new EXImageListViewSubItem("");
                lvi.SubItems.Add(svi2);
            }
            if (lst.Count != 1)
            {
                lvi.Font = MyTools.ChangeFontStyle(lvi.Font, true, false);

                EXImageListViewSubItem svi2 = new EXImageListViewSubItem("");
                lvi.SubItems.Add(svi2);
            }
            else
            {
                if (gcn.checknotif)
                {
                    EXImageListViewSubItem svi2 = new EXImageListViewSubItem(_daddy.GetImageSized("bulletgreen"));
                    lvi.SubItems.Add(svi2);
                }
                else
                {
                    EXImageListViewSubItem svi2 = new EXImageListViewSubItem(_daddy.GetImageSized("bulletred"));
                    lvi.SubItems.Add(svi2);
                }
            }

            EXListViewSubItem svi = null;

            if (special)
            {
                svi = new EXListViewSubItem("");
                lvi.SubItems.Add(svi);
                svi = new EXListViewSubItem("");
                lvi.SubItems.Add(svi);
            }
            else
            {
                svi = new EXListViewSubItem(coord);
                lvi.SubItems.Add(svi);
                svi = new EXListViewSubItem(radius);
                lvi.SubItems.Add(svi);
            }
            String kind = "";

            if (lst.Count == 1)
            {
                foreach (String k in gcn.kindofnotifnames)
                {
                    kind += k + " - ";
                }
            }
            svi = new EXListViewSubItem(kind);
            lvi.SubItems.Add(svi);

            if (special)
            {
                lvGCNListGroup.Items.Insert(index + 1, lvi);
            }
            else
            {
                lvGCNListGroup.Items.Add(lvi);
            }

            _dicoItemGCs.Add(lvi, lst);
        }