Questions tagged [xamarin]

Xamarin is a San Francisco based software company created by the engineers that created Mono, MonoTouch and Mono for Android which are cross-platform implementations of the Common Language Infrastructure (CLI) and Common Language Specifications (often called Microsoft .NET). With a C# shared codebase, developers can use Xamarin tools to write native iOS, Android, and Windows apps with native user interfaces and share code across multiple platforms.

Filter by
Sorted by
Tagged with
3
votes
1answer
80 views

Loading 300 images on a custom spinner with images

I have a spinner that it has a custom layout with 5 imageviews and 1 textview. I would like to load it up with 80 rows, so it will display around 300 images (all images are within the app). Is this a ...
1
vote
1answer
42 views

App.xaml.cs Startup Code Refactoring

Quite simply, this is my base class for Xamarin forms, everything is fully working, but it's getting a bit too long and feels a bit like it can be improved, especially the network bit could be handled ...
1
vote
2answers
126 views

What can I learn from this coding test?

So I was recently asked to complete the following challenge for an interview: Programming Problem Provide a production ready solution that accepts a new user name, validates a single string input as ...
4
votes
1answer
99 views

Proper Error handling when we expect results from secondary functions

I'm building an android application and I have some second thoughts on some error handling case. I have a method that gets data from the internet by calling this method: ...
1
vote
0answers
24 views

Xamarin: ToggleBar control

Heyhey, I'm attempting to implement a ToggleBar control for Xamarin as there is non up to date and fully customizeable. Now I haven't implemented too many controls and while the control is not fully ...
2
votes
1answer
62 views

ASP.NET Web API Authentication For Xamarin App

I've recently been learned how to implement a token based authentication with ASP.NET and I would love to get some input on how my code & structure is as well as how I can make it better. The code ...
3
votes
2answers
123 views

Refactor multiple if-else conditions when condition is a minor change

I'm new programmer and I'm working on Xamarin MVVM app and I have a pin view like So, basically I have numbers from 0-9 if you pick one number its visible then if ...
2
votes
0answers
21 views

Is this way of handling events in a Xamarin project memory safe?

I inherited a Xamarin project and I'm trying to find my way. The first task I completed involved creating a new reusable view and adding it to an existing screen. This was iOS specific, so I went and ...
1
vote
0answers
42 views

Xamarin.Forms Search ObservableCollection

I have this code in my ViewModel which searches a List of Items, the OnSearchAsync(string searchQuery) gets executed by a Command which is bound to ...
4
votes
1answer
292 views

Battleship Model

The following is some code for a Battleship game I'm working on. The plan is to create a multiplayer game using Xamarin Forms. This is just the model code, i.e. what the GUI will be interacting with ...
1
vote
1answer
147 views

Entry Validation in Xamarin.Forms

I have an Entry that I want to give a red outline when the entry is empty. I'm using SyncFusion's SFTextInputLayout for my Entry and it has a property ...
2
votes
0answers
728 views

Xamarin Forms MVVM Light Toolkit usage

I am playing around with Xamarin, because there is a good chance that I might have to start a project using it in a few months. What I am mostly looking at is Xamarin Forms as I am familiar with WPF ...
2
votes
0answers
87 views

Android Smartband2 Reader in Xamarin

This code was written a long time ago but has probably gotten a bit deprecated now and I wonder how it can be improved. It's for an xamarin cross-platform project for IOS and Android but this part is ...
2
votes
0answers
104 views

Java's AtomicInteger equivalent in c#

I'm trying to replicate Android's GenerateViewId() to assign a unique Tag to dynamically created UIViews in Xamarin.iOS. ...
2
votes
2answers
54 views

Checkout Process for Xamarin E commerce application

I'm new to development (I'm self Taught I got a job recently as an"app Developer") and this is my first real big project. In essence, it's an e-commerce store that uses a very awkward API. My Checkout ...
1
vote
1answer
81 views

Designing a dynamic array of Memory Streams

I'm working on a feature for work that requires me to combine a set number of memory streams based on specific conditions. Previous Code Before based on documentation/examples online. In order to ...
1
vote
0answers
18 views

xamarin SegmentedControl

I wanted to know is this the best way to handle a SegmentedControl using the e.NewValue? Base on the selected segment I hide and select different data? XAML ...
1
vote
0answers
216 views

HTTP Client - Best practices

I've made a HTTP client and would like some tips to improve my code, it's supposed to be built for xamarin forms but should work with any implementation. My goal of this project was to learn more ...
2
votes
0answers
26 views

Initializing Group Data Mess

This is my OnAppearingAsync method where I as a page load in Xamarin I filter data, group it together, set data based on it, order the groups e.t.c. However the code is rather long and looks a bit ...
3
votes
1answer
100 views

TDD test class for ViewModel class

I am currently writing my first TDD application. The project is in Xamarin.Forms and tested in xUnit. I am also using Autofac and Moq. The first class below is testing second class (VM). The VM is: ...
4
votes
1answer
76 views

Calculate expiration date based on server data

This code yet is not really optimize and I know that . But for now this is all I have. What this code does is that it computes the expiration date of an account. By the way I need to do the swapping ...
1
vote
0answers
488 views

Make API request with Access Token and Refresh

I have a class that makes API requests for a mobile app. The code can be making multiple API requests at the same time. But, if the request is unauthorized, I want to refresh the access token. While ...
2
votes
1answer
115 views

Deserializing response to correct type

I use this method to get either Customer or Account. The server will determine which type it is. The response will have a property "Type": "Customer" or ...
1
vote
1answer
94 views

Login flow in app

I made the login flow without any reference to a tutorial. So I want some feedback. Basically it sends username and password in a POST request to /token. The app stores the tokens on device, then ...
-1
votes
1answer
511 views

C# Handling Task Cancellations/Timeouts and Exceptions [closed]

I am very new to Tasks and therefore new to handling task cancellations and task exceptions. I wrote this method that gets a List which is then used to populate an ObsservableCollection shown in a ...
1
vote
0answers
306 views

Xamarin Forms with Ninject navigation service

I am new to Xamarin Forms and I have been searching online finding ways to set up navigation in a MVVM fashion. In particular I am designing around a concept I found here. However, I am using Ninject ...
2
votes
1answer
405 views

Class to make Web Service calls

I've a web service class to handle all requests to the external service. All the methods are very similar, so I want to refactor this into DRY code. This is an app in Xamarin.Forms. I'm making the ...
3
votes
1answer
7k views

Giving error response in Web API

I'm creating a Web Api in .NET Framework that is connected to an ASMX service. No own logic, just pass through data. Everything works as expected. But not sure if it's good. Have to repeat the same ...
3
votes
1answer
170 views

Make requests to SOAP API

I would like feedback on this class library, mainly the architecture. It works very well. But maybe someone knows how to improve it. This is a class library for working towards an external system. I ...
4
votes
1answer
4k views

Login modal with MVVM pattern

I would like some feedback on whether this follows MVVM principles well. The MainPage has a Login button that opens the login modal page. Upon successful login, the LoginPageViewModel will raise an ...
1
vote
1answer
89 views

Xamarin Prism IOC

sorry for this type of question, I am wondering if are there any good code practice to use in order to isolate IOCs on my App.cs ...
1
vote
1answer
6k views

Parsing SOAP messages from a web service

I'm consuming an ASMX service with SOAP messages. Since Xamarin doesn't support SOAP 1.2, I'm writing the Web requests manually. I'm sending a user/password to retrieve the user ID. A successful ...
3
votes
0answers
800 views

List nearby bluetooth devices as well as devices in the database

I made a list of all nearby printer devices (that match the same name in the database) as well as all printer devices from the database. They are separated in the list by "--". I am able to get the ...
0
votes
1answer
233 views

AsyncTask for subscribing to current location

I made the below CurrentLocationTask as a way of reducing code duplication, as my application currently has 2 different Activity...
1
vote
0answers
32 views

Save Position on the cloud or locally

I have a tracking software. At first I just send the position to the web Service ...
1
vote
0answers
30 views

Initalize first page in Xamarin [closed]

EventPage is the RootPage of the application, on appearing eventpage calls loginpage and with a button loginpage in turn calls other pages. My question is, is this a good way to do this? ...
4
votes
3answers
3k views

Generic WebRequest Method for .PCL

I have created this method to do all my WebRequests. Generally my question is, if this could be improved in any way. As a side question, I would like to know if it be better to create methods for ...
3
votes
1answer
547 views

Reading file from flash with Xamarin.Forms on Android using ActionOpenDocument intent with StartActivityForResult

I have a Xamarin.Forms application which utilizes dependency services to access Android specific features, in this case file access on the storage. The file we are accessing is a serialized .xml file ...
1
vote
0answers
46 views

Change ObservableCollection's data

I'm having a ListView which contains some users. This ListView is used to select users which should be added to a new group chat....
3
votes
1answer
11k views

Changing visibility of ToolbarItem - Xamarin.Forms

I want to fill collection of ToolbarItems from XAML, but change visibility of some ...
5
votes
1answer
96 views

Painting a lot of diagrams for a board game

I'm creating a chess application and I would like to show plenty of big chess diagrams in scrollview. At the moment I just create ImageView for every diagram, create bitmap into it, paint the diagram ...
-3
votes
1answer
1k views

c# Linq vs foreach [closed]

which better in performance consider that case I have an array of objects (DocsOrder), I looped throw that array to match exists of passed data ...
1
vote
0answers
120 views

Xamarin.Forms Use Plugin or DependencyService

I am working on Xamarin forms project that targets three platforms (Android, iOS, UWP), and I was wondering which better to use Plugins or it's better to use DependencyService https://developer....
2
votes
1answer
2k views

MVVM pattern in Xamarin login form

Please let me know if the MVVM pattern I followed in this is correct or not. Here is the code for ViewModel ...
2
votes
1answer
615 views

Submit form data to server side

I have this method here called SubmitProc which submits form data that the user filled out to the server side and does a check if the response to the server goes through. If it's fine, great. If not, ...
1
vote
1answer
53 views

Navigating menus in automation tests

I am trying to write a method that can find the child item in a menu. The below code works but is not exactly elegant or scaleable. Is there another way to find the path to child menu item that could ...
-1
votes
2answers
2k views

Design pattern to implement Database operations [closed]

I am trying to implement design pattern in my project and have been reading material over net. we have a sales application ( in C# ) where in we are storing entities like ...
6
votes
1answer
75 views

Sign In or Sign Up - either way don't repeat yourself

I have one application with two views. One to sign in and one to sign up. Each view has an Email entry as main identifier. I want to add some itemTemplates to my application, because for now I repeat ...