Forum Xamarin Xamarin.Forms

What's a good architecture for a barcode scan app that changes the view depending on 3 scan types?

I have 3 types of objects for a delivery scanning app. 2 of these are types of containers, and the 3rd type are packages that need moved between containers.

There isn't much of an order to how these things should be scanned, that's largely on the user. But the general UI idea is, if you scan items of type A, then the A screen/view shows, if you scan B, it swaps to the B screen, and the same for C. These screens should be jumped between rapidly, as the user scans the different types. How should I persist data between these pages/views?

I have thought about ViewModels, or just 1 shared ViewModel, I've thought about the Application.Current.Properties, and I've thought about SQLite. Which of these would be the best way to store this data? To give an example of what should appear on screen, a list of opened containers could be on one screen, and a list of packages to physically move could be on the 2nd screen. As a user opens more containers with scanning, this list should grow, and as a user picks up and drops packages (using scanning) this list should also grow/shrink on screen, in real time.

I am also considering an invisible tab bar to handle the navigation of this quick switching, i.e. 3 tabbed pages that you don't see the bar for.

I hope that makes sense. Has anyone worked on something like this before?


  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    Boiling it down I heard

    I have an idea for an app. But I don't know where to go from there. I don't know what the UI should be and I don't know how to architect the logic or organize the objects.

    So I'd suggest you get together with the stake holders: The people/companies that would actually use the product and find out what it is they need and want. Why spend 5,000 hours making an app only to find out its not what anyone actually needs because you're guessing about an industry you're not intimately involved in.

  • LandLuLandLu Member, Xamarin Team Xamurai

    @CharlieFinlayson.3926 You want to store data in the disk or memory? Try to describe more clearly about your destination. Also attach some screenshots or code to help us understand your issue.

  • UnreachableCodeUnreachableCode USMember ✭✭✭
    edited October 2018

    I've worked on the requirements gathering and a bit more of the implementation, and I have a pretty good idea of how the app will be architected. I'll post a general overview of it here to get some feedback.

    Essentially there will be 3 screens to show the scanned containers and items being moved between them.

    I'll be using the MessagingCenter to dispatch different messages depending on whether a container A, B or an item was scanned. This will switch the current tab on screen depending on what stage of the scanning process the user is in.

    All scan data will be persisted using separate repositories and database helpers, for containers and items, to access the database in SQLite. This is for short term use only as all long-term data will be downloaded and uploaded to my client's internal system.

    For the time being, I'm using an MVC type pattern with no ViewModel framework but I think I'll be porting the application to use FreshMVVM when the page code behinds get complicated. But I'm not sure whether this will do much other than move the code to other files. I understand MVVM pretty well but what else am I gaining from this long term, if pages are cross=platform and can be bound to like a ViewModel? I do all of my views in Xaml, so there's no UI code in my pages.

    I use the built in Dependency resolver to get things like my Android scanning library, repositories, etc.

Sign In or Register to comment.