Search This Blog

Tuesday, October 3, 2017

Creating a list of unique random numbers

Creating a list of unique random numbers

public static List<int> GetUniqueRandomNumbers(int iAmountOfRandomNumbers, int iSmallestNumber, int iBiggestNumber)

            //Create a list of numbers from which the routine
            //shall choose the result numbers
            List<int> lstPossibleNumbers = new List<int>();
            for (int i = iSmallestNumber; i <= iBiggestNumber; i++)

            //Create a list, which shall hold the result numbers
            List<int> lstResultList = new List<int>();

            //Initialize a random number generator
            Random objRand = new Random();

            //For-loop which picks each round a unique random number
            for (int i = 0; i < iAmountOfRandomNumbers; i++)
                //Generate random number
                int randomNumber = objRand .Next(1, lstPossibleNumbers.Count) - 1;
                //Use random number as index for the possible number list
                //Remove the chosen result number from possible numbers list
            return lstResultList;

Friday, May 19, 2017

iTunes Connect Screenshots Sizes for all iOS (iPhone/iPad/Apple Watch) devices

The following resolutions are acceptable to iTunes connect:
  • iPhone 3+4 (3.5 Inch)
    • 640 x 960
  • iPhone 5 (4 Inch)
    • 640 x 1136
  • iPhone 6 (4.7 Inch)
    • 750 x 1334
  • iPhone 6 Plus (5.5 Inch)
    • 1242 x 2208
    • You need the screenshot in this resolution, the phone scales them down to 1080 x 1920
  • iPad (Air and Mini Retina)
    • 1536 x 2048
  • iPad Pro (12.9 Inch)
    • 2048 x 2732
  • Apple Watch
    • 312 x 390 pixels
    • (only one orientation)

Wednesday, May 17, 2017

Issues in Xamarin.iOS - Failed to launch the simulator: Could not find file "/Users/_____/Library/Caches/Xamarin/mtbs/builds/...

Clean Visual Studio solution: which can be dome by t manually by removing every bin/obj folder,
On Mac, remove  everything under /Users/<User Name>/Library/Caches/Xamarin/mtbs/builds

In Mac you have two ways of accessing the Go To Folder function from the Mac OS X desktop and Finder:
From the “Go” menu navigate down to “Go to Folder” ….or better yet…
Hit Command+Shift+G from the OS X desktop or a Finder window

Friday, May 5, 2017

Xamarin Forms OnPlatform samples in Xaml

** To set image width

<Image x:Name ="lstImage" Aspect="AspectFill"   HorizontalOptions="EndAndExpand" Source=  "{Binding IconUrl}">
                   <OnPlatform x:TypeArguments="x:Double">
                   </OnPlatform >
    </Image >

***To set background color
<StackLayout.BackgroundColor> <OnPlatform x:TypeArguments="Color"> <OnPlatform.iOS>#FF0000</OnPlatform.iOS> <OnPlatform.Android>#00FF00</OnPlatform.Android> </OnPlatform> </StackLayout.BackgroundColor>

To set  it from codebehind use:

Tuesday, April 18, 2017

Some useful Plugin's for Xamarin

Here goes the link

In case of Settings Plugin for Xamarin and Windows,
Ensure that you install NuGet into PCL and all platform projects and see Helpers/Settings.cs
If you are installing this in a normal project and not using a pcl create a new file called Settings.cs or whatever you want and copy this code in.

to add/retrieve data use following code:
string sName = CrossSettings.Current.GetValueOrDefault<string>("UserNameKey","unknown");

### Important

sqllite-net-pcl plugin

Thursday, March 30, 2017

The name "ContentPage" does not exist in the namespace "".

Most likely, the reason why you see those errors is that you are using the default XAML editor.
To fix this error try following:
1- Close all open documents.
2- From solution explorer, Right click on the *.XAML file you want to open.
3- Click on "Open With".
4- Click on "XML Text Editor".
5- Click on "Set as default" if you like.
Now you will be editing the file as normal XML file and errors should disappear.

Tuesday, February 14, 2017

Saving data between user sessions in Xamarin forms

At Application level OnStart, OnSleep and OnResume methods can be used for saving data between user sessions.
At Page level, OnAppearing and OnDisappearing events, whoch are fired when a page is created or right before it is destroyed.
 protected override void OnDisappearing()