Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6114447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:58:33+00:00 2026-05-23T14:58:33+00:00

In my program i have a window which the user sees when its time

  • 0

In my program i have a window which the user sees when its time to swipe a credit card. The window will wait until the credit card is swiped or any other error happens. Currently, the wait window is creating card reader class internally and using delegates/callback methods of the card reader class to know when the data on the card is available or any other errors happens.

Since there are 4-5 type of readers available i am implementing strategy pattern for the CardReader.

I would also like to decouple the CardReader creation/insstantiation code from the window code. Can you please give tips for doing the same.

I will be reading your comments prior to designing the strategy pattern class for CardReader.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:58:33+00:00Added an answer on May 23, 2026 at 2:58 pm

    Make the waiting window constructor require a reference to the class of the reader, register the waiting window for a OnCardReadEvent. When the event is received invoke the function inside the reader class to check it, than if needed continue displaying the waiting window or close it. On window close unregister from the OnCardReadEvent

    If you don’t have a OnCardReadEvent then make one.

    Inside the reader class when the read is done make something like this to enable multiple windows to receive data from a single reader

    DCardArrived _evnt = OnCardArrived; /*presumably declared event*/
             Delegate[] _iList;
             DCardArrived _Invoker;
             if (_evnt != null)
             {
                 _iList = _evnt.GetInvocationList();
                 for (int i = 0; i < _iList.Length; i++)
                 {
                      //You could also use BeginInvoke
                     _Invoker = (DCardArrived)_iList[i];
                     _Invoker.Invoke(this/*Sender*/,CardData/*class that inherits EventArgs containing the data either informing just the window to close or not or with the data for further processing*/);
                 }
             }
    

    You haven’t gave us much to work with 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program which creates DialogBox window when user clicks the menu item
I have a c# program through which i am opening cmd window as a
I have a program which plays two sounds. I want the user to know
I have a C# console program which main functions should let a user grep
Simple synopsis: I have a program which needs authentication from user to get access
I have a program which executes some process in main window and I need
I have a program which needs installing on windows 64 boxes. Most of the
I have my main program window, and I would like to make a foldable
I have downloaded a code when I am building the program, a message window
Have a look at this very simple example WPF program: <Window x:Class=WpfApplication1.Window1 xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.