Beispiel #1
0
        private void CodedBy_Click(object sender, RoutedEventArgs e)
        {
            popup win = new popup();

            win.popupWindow.Text = "Coded by Team Charlie:\nDitte Slyngborg\nJanus B. Reedtz\nMartin Nørholm\nRezan Razoul";
            win.Show();
        }
Beispiel #2
0
        private void CallDownload_Click(object sender, RoutedEventArgs e)
        {
            if (Directory.Exists(fileExtract) == false)
            {
                Directory.CreateDirectory(fileExtract);
            }
            else
            {
                DirectoryInfo dir = new DirectoryInfo(fileExtract);
                foreach (FileInfo fi in dir.GetFiles())
                {
                    fi.Delete();
                }
            }
            KommuneName.Text = "";
            var          hw  = new HtmlWeb();
            HtmlDocument doc = hw.Load("https://covid19.ssi.dk/overvagningsdata/download-fil-med-overvaagningdata");
            string       url = doc.DocumentNode.SelectSingleNode("//blockquote[@class='factbox']//p//a").Attributes["href"].Value.ToString();

            if (!string.IsNullOrEmpty(url))
            {
                Uri uri = new Uri(url);
                client.DownloadFileAsync(uri, @"C:\Temp\Corona.zip");
            }
            //hejhej
            Thread.Sleep(500);

            ExtractFile();
            popup p = new popup();

            p.popupWindow.Text = "Files downloaded!";
            p.Show();
        }
        //Data to insert to Infected but in a "perfect" version of the app it would be inserted from the csv-files.
        public void InsertSomeData()
        {
            popup win = new popup();

            try
            {
                SqlCommand inserts = new SqlCommand(
                    @"INSERT INTO Infected (numberTested,numberInfected,municipalityID,date)VALUES
                (1050, 1, 4, '2020-01-01'),(1060, 2, 5, '2020-01-01'),(1070, 3, 6, '2020-01-01'),
                (1180, 4, 4, '2020-02-01'),(1190, 5, 5, '2020-02-01'),(1200, 6, 6, '2020-02-01'),
                (1300, 7, 4, '2020-03-01'),(1310, 8, 5, '2020-03-01'),(1320, 9, 6, '2020-03-01'),
                (1500, 21, 4, '2020-04-01'),(1510, 22, 5,'2020-04-01'),(1520, 23, 6, '2020-04-01'),
                (1600, 14, 4, '2020-05-01'),(1610, 15, 5, '2020-05-01'),(1620, 16, 6, '2020-05-01'),
                (1700, 17, 4, '2020-06-01'),(1710, 18, 5, '2020-06-01'),(1720, 19, 6, '2020-06-01'),
                (1750, 21, 4, '2020-07-01'),(1760, 22, 5, '2020-07-01'),(1770, 23, 6, '2020-07-01'),
                (1800, 24, 4, '2020-08-01'),(1810, 25, 5, '2020-08-01'),(1820, 26, 6, '2020-08-01'),
                (1850, 27, 4, '2020-09-01'),(1860, 28, 5, '2020-09-01'),(1870, 29, 6, '2020-09-01'),
                (2018, 17, 4, '2020-10-01'), (2019, 18, 5, '2020-10-01'), (2020, 19, 6, '2020-10-01'),
                (2069, 21, 4, '2020-11-01'), (2069, 22, 5, '2020-11-01'), (2070, 23, 6, '2020-11-01'),
                (2118, 24, 4, '2020-12-01'), (2119, 25, 5, '2020-12-01'), (2120, 26, 6, '2020-12-01'),
                (2268, 27, 4, '2021-01-14'), (2269, 28, 5, '2021-01-14'), (2270, 29, 6, '2021-01-14')"
                    , connString);
                connString.Open();
                inserts.ExecuteNonQuery();
                win.popupWindow.Text     = "DATA ER SENDT!";
                win.popupWindow.FontSize = 40;
                win.Show();
            }
            catch (Exception ex)
            {
                win.popupWindow.Text = "Kunne ikke hente data. Dette er fejlmeddelelsen:\n" + ex.Message;
                win.Show();
            }
            finally
            {
                if (connString != null && connString.State == ConnectionState.Open)
                {
                    connString.Close();
                }
            }
        }
Beispiel #4
0
 // Handle collisions
 void OnCollisionEnter(Collision collision)
 {
     if (collision.collider.tag == "marked merchant")
     {
         string id = collision.collider.name;
         if (!visitedMerchants.Contains(id))
         {
             score      += 10;
             points.text = "Points: " + score;
             pb.BarValue = score;
             visitedMerchants.Add(id);
         }
         string merchantString = collision.collider.name;
         popup.Show((int)(Random.value * 10), merchantString, latValue.text, lonValue.text);
     }
 }