Exemplo n.º 1
0
        /// <summary>
        /// Occurs when a barcode has been detected.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BarcodeReaderOnDetectionOccurred(object sender, BarcodeDetectedEventArgs e)
        {
            InvokeVotingScreen(() =>
            {
                if (e == null)
                {
                    return;
                }

                DisconnectCamera();
                _barcodelist.Add(e.DetectedBarcode);
                var element = _barcodelist.Last();
                path        = element.Content;

                try
                {
                    _barcodelist.Clear();
                    List <StringValue> lst = new List <StringValue>();
                    UTF8Encoding utf8      = new UTF8Encoding();

                    using (StreamReader sr = new StreamReader(path))
                    {
                        string line;

                        while ((line = sr.ReadLine()) != null)
                        {
                            var temp = utf8.GetString(utf8.GetBytes(line));
                            lst.Add(new StringValue(temp));
                        }
                    }


                    this.Hide();
                    Voting_Screen.getInstance().list = lst;
                    Voting_Screen.getInstance().Sourcelist();
                    Voting_Screen.getInstance().ShowDialog();

                    this.Dispose();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(@"Forkert QR kode. Prøv igen eller kontakt en administrator.", @"Der opstod en fejl!");
                }
            });
        }
Exemplo n.º 2
0
 /// <summary>
 /// Ensures that only one instances can be created.
 /// </summary>
 /// <returns></returns>
 public static Voting_Screen getInstance()
 {
     return(instance ?? (instance = new Voting_Screen()));
 }