private void addAnnotations(SQLite.TableQuery <MagpieIOS.MagpieBadge> table)
        {
            var documents = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            var dbPath    = Path.Combine(documents, "db_sqlite-net.db");
            var db        = new SQLiteConnection(dbPath);


            int index = 0;

            foreach (MagpieBadge badge in table)
            {
                double lat  = table.ElementAt(index).lat;
                double lon  = table.ElementAt(index).lon;
                String name = table.ElementAt(index).bname;
                String sub  = table.ElementAt(index).art + " - " + table.ElementAt(index).year;

                //if iscollected check
                String q         = "SELECT * FROM MagpieUser WHERE bid = " + table.ElementAt(index).bid;
                var    userTuple = db.Query <MagpieUser>(q);

                if (userTuple.ElementAt(0).isClaimed.Equals(""))
                {
                    var annotation = new AnnotationModel(new CLLocationCoordinate2D(lat, lon), name, index, false, sub);
                    map.AddAnnotation(annotation);
                }
                else
                {
                    var annotation = new AnnotationModel(new CLLocationCoordinate2D(lat, lon), name, index, true, sub);
                    map.AddAnnotation(annotation);
                }

                index++;
            }
        }
Beispiel #2
0
        private static async Task SendOnEmail(SQLite.TableQuery <Model.Errors> notices)
        {
            var message = new Xamarin.Essentials.EmailMessage
            {
                Subject = "Отчет об ошибках",
                Body    = "Здесь вы можете добавить описание вашей проблемы (если она есть). Мы постараемся вам помочь",
                To      = new List <string>()
                {
                    "*****@*****.**"
                },
                BodyFormat = Xamarin.Essentials.EmailBodyFormat.PlainText
            };

            var    fn   = "logs.txt";
            var    file = System.IO.Path.Combine(Xamarin.Essentials.FileSystem.CacheDirectory, fn);
            string log  = Api.Funcs.PhoneModel + ":" + Environment.NewLine + Environment.NewLine +
                          string.Join(Environment.NewLine, notices.Select(er =>
                                                                          er.Name + Environment.NewLine +
                                                                          er.Method + Environment.NewLine +
                                                                          er.Params + Environment.NewLine));

            System.IO.File.WriteAllText(file, log);
            message.Attachments.Add(new Xamarin.Essentials.EmailAttachment(fn));



            await Xamarin.Essentials.Email.ComposeAsync(message);

            //*/
        }