Пример #1
0
        void ChangeReader()
        {
            if (reader != null)
            {
                reader.StopMonitor();
                reader = null;
            }

            eReaderStatus.Text = "";
            eCardAtr.Text      = "";

            ReaderSelectForm readerSelect = new ReaderSelectForm(imgHeader.BackColor);

            readerSelect.SelectedReader = eReaderName.Text;
            readerSelect.ShowDialog();
            if (readerSelect.SelectedReader != null)
            {
                eReaderName.Text = readerSelect.SelectedReader;
            }

            reader = new SCardReader(eReaderName.Text);

            SetNfcMode(0, false);

            reader.StartMonitor(new SCardReader.StatusChangeCallback(ReaderStatusChanged));
        }
Пример #2
0
        void MainFormShown(object sender, EventArgs e)
        {
            SplashForm splash = new SplashForm();

            splash.ShowDialog();

            ReaderSelectForm readerSelect = new ReaderSelectForm(this.imgHeader.BackColor);

            if (readerSelect.SelectedReader == null)
            {
                readerSelect.Preselect("SpringCard|ontactless");
                for (;;)
                {
                    readerSelect.ShowDialog();
                    if (readerSelect.SelectedReader != null)
                    {
                        break;
                    }

                    if (MessageBox.Show("This application can't run without a reader. Do you want to leave the application now ?",
                                        "No reader selected",
                                        MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                    {
                        Application.Exit();
                        return;
                    }
                }
            }

            setReader(readerSelect.SelectedReader);
        }
Пример #3
0
        void MainFormShown(object sender, EventArgs e)
        {
            if (true)
            {
                SplashForm splash = new SplashForm();
                splash.ShowDialog();
            }

            ReaderSelectForm readerSelect = new ReaderSelectForm(imgHeader.BackColor);

            if (readerSelect.SelectedReader == null)
            {
                readerSelect.Preselect("SpringCard|NFC|tactless");
                for (;;)
                {
                    readerSelect.ShowDialog();
                    if (readerSelect.SelectedReader != null)
                    {
                        break;
                    }

                    if (MessageBox.Show("This application can't run without a reader. Do you want to leave the application now ?",
                                        "No reader selected",
                                        MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                    {
                        Application.Exit();
                        return;
                    }
                }
            }

            eReaderName.Text   = readerSelect.SelectedReader;
            eReaderStatus.Text = "";
            eCardAtr.Text      = "";

            reader = new SCardReader(eReaderName.Text);

            Settings s = new Settings();

            if ((s.SelectedType >= 0) && (s.SelectedType < cbNdefType.Items.Count))
            {
                cbNdefType.SelectedIndex = s.SelectedType;
            }
            else
            {
                cbNdefType.SelectedIndex = 0;
            }
            CbNdefTypeSelectedIndexChanged(null, null);

            SetNfcMode(0, false);
            ShowStatus();

            reader.StartMonitor(new SCardReader.StatusChangeCallback(ReaderStatusChanged));
        }
Пример #4
0
        void MiReaderClick(object sender, EventArgs e)
        {
            ReaderSelectForm readerSelect = new ReaderSelectForm(this.imgHeader.BackColor);

            readerSelect.SelectedReader = eReaderName.Text;
            readerSelect.ShowDialog();

            if (readerSelect.SelectedReader != null)
            {
                setReader(readerSelect.SelectedReader);
            }
        }
Пример #5
0
        void ChangeReader()
        {
            ReleaseReader();

            eReaderStatus.Text = "";
            eCardAtr.Text      = "";

            ReaderSelectForm readerSelect = new ReaderSelectForm(this.imgHeader.BackColor);

            readerSelect.SelectedReader = eReaderName.Text;
            readerSelect.ShowDialog();
            if (readerSelect.SelectedReader != null)
            {
                SelectReader(readerSelect.SelectedReader);
            }
        }
Пример #6
0
        void MainFormShown(object sender, EventArgs e)
        {
            if (true)
            {
                SplashForm splash = new SplashForm();
                splash.ShowDialog();
            }

            Trace.WriteLine("Loading settings from registry");

            Settings s = new Settings();

            Trace.WriteLine("Selected mode?");

            try
            {
                switch (s.SelectedMode)
                {
                case Settings.MODE_RECV_ONLY:
                    rbRecvOnly.Checked = true;
                    Trace.WriteLine("Mode set to Receiver");
                    break;

                case Settings.MODE_SEND_ONLY:
                    rbSendOnly.Checked = true;
                    Trace.WriteLine("Mode set to Sender");
                    break;

                case Settings.MODE_RECV_THEN_SEND:
                    rbRecvThenSend.Checked = true;
                    Trace.WriteLine("Mode set to Receiver, then Sender");
                    break;

                case Settings.MODE_SEND_THEN_RECV:
                    rbSendThenRecv.Checked = true;
                    Trace.WriteLine("Mode set to Sender, then Receiver");
                    break;

                case Settings.MODE_SEND_AND_RECV:
                default:
                    rbSendAndRecv.Checked = true;
                    Trace.WriteLine("Mode set to Sender+Receiver");
                    break;
                }
            }
            catch
            {
                rbRecvOnly.Checked = true;
                Trace.WriteLine("Mode set to Receiver (default)");
            }

            if ((s.SelectedType >= 0) && (s.SelectedType < cbNdefType.Items.Count))
            {
                cbNdefType.SelectedIndex = s.SelectedType;
            }
            else
            {
                cbNdefType.SelectedIndex = 0;
            }

            ReaderSelectForm readerSelect = new ReaderSelectForm(this.imgHeader.BackColor);

            if (readerSelect.SelectedReader == null)
            {
                readerSelect.Preselect("SpringCard|NFC|tactless");
                for (;;)
                {
                    readerSelect.ShowDialog();
                    if (readerSelect.SelectedReader != null)
                    {
                        break;
                    }

                    if (MessageBox.Show("This application can't run without a reader. Do you want to leave the application now ?",
                                        "No reader selected",
                                        MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                    {
                        Application.Exit();
                        return;
                    }
                }
            }

            eReaderStatus.Text = "";
            eCardAtr.Text      = "";

            SelectReader(readerSelect.SelectedReader);
        }