Пример #1
0
        /*
         * Open (or re-focus) a CardForm for the specified reader
         * ------------------------------------------------------
         */
        void OpenCardForm(string ReaderName, Image ReaderImage, uint ShareMode, uint Protocol)
        {
            CardForm f = null;

            /* Try to retrieve an existing CardForm belonging to this reader */
            /* ------------------------------------------------------------- */

            for (int i = 0; i < card_forms.Count; i++)
            {
                if (card_forms[i].ReaderName.Equals(ReaderName))
                {
                    f = card_forms[i];
                    break;
                }
            }

            if (f == null)
            {
                /* Create a new CardForm */
                /* --------------------- */

                f = new CardForm(ReaderName, ReaderImage, OnCloseCardForm);

                /* Location */
                f.Left = Left + 80 + 20 * card_forms.Count;
                f.Top  = Top + 40 + 20 * card_forms.Count;

                /* Remember this CardForm in our list */
                card_forms.Add(f);

                if (ShareMode == SCARD.SHARE_DIRECT)
                {
                    /* Direct mode -> preload control page */
                    f.HistoryControl(1);
                }
                else
                {
                    /* Other mode -> preload transmit page */
                    f.HistoryTransmit(1);
                }
            }

            /* Make the form visible, on top, focused */
            /* -------------------------------------- */

            f.Show();
            f.BringToFront();
            f.Focus();

            /* Connect (or reconnect) to the reader/card */
            /* ----------------------------------------- */
            f.Connect(ShareMode, Protocol);
        }
Пример #2
0
        void MainFormFormClosed(object sender, FormClosedEventArgs e)
        {
            if (reader_list != null)
            {
                reader_list.StopMonitor();
                reader_list = null;
            }

            for (int i = 0; i < card_forms.Count; i++)
            {
                CardForm f = card_forms[i];
                f.Close();
                f.Dispose();
            }

            Settings.Save();
        }