Posts

How to setup Azure Service Bus Relay to use with ACS

In August 2014 Microsoft decided to remove Microsoft Azure Active Directory Access Control (also known as Access Control Service or ACS) from the default Azure Portal setup when creating a new Service Bus Namespace.   Shared Access Signature (SAS) is now default. Service Bus authentication through ACS is managed through a companion “-sb” ACS namespace and to create this we now need to do it from the Azure Power Shell command line (thanks Microsoft!) To do this: Download the PowerShell console https://azure.microsoft.com/en-gb/documentation/articles/powershell-install-configure/#Install Open up the Console and type Add-AzureAccount  and then type in the email address and password associated with your account (Work or Microsoft) Once authenticated you need to create the Service Bus Namespace so it's good to go for ACS. To do this you use the  New-AzureSBNamespace command Parameter Set: Default New-AzureSBNamespace [-Name] <String> [[-Location] <String&g

INSTALL_PARSE_FAILED_MANIFEST_MALFORMED

Whilst developing an Android App using Xamarin 5.1 I had issues deploying to the device. The exception was: Deployment failed because of an internal error: Unexpected install output: pkg: /data/local/tmp/com.mycompany.myapp.apk Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED] It turns out that this is down to the fully qualified naming of an activity. One of the changes with 5.1 is that you now need to fully qualify the Android Callable Wrapper Naming. So for example if you previously had: namespace MyNameSpace { [ Activity ] public partial class ActivityType : Activity { /* ... */ } } Then to maintain compatibility with your scripts/external code, set the  ActivityAttribute.Name  property: namespace MyNameSpace { [ Activity ( Name = " mynamespace .ActivityType" )] public partial class ActivityType : Activity { /* ... */ } } The important thing to note is is the case sensitivity of the Name decla

Separator Insets on UITableView in iOS8 - Xamarin.iOS

In iOS7 it was possible to configure the separator insets by setting the separator inset property on the tableview: tableView.SeparatorInsets = new UIEdgeInsets(0, 0, 0, 0) In iOS8 this no longer works and you need to set the LayoutMargins on both the table and the cell remembering to check if the property is supported first to avoid breaking iOS7 if   ( this .T ableView . RespondsToSelector ( new   Selector ( " setLayoutMargins : " )))     this .T ableView . LayoutMargins   =   new   UIEdgeInsets ( 0 ,   0 ,   0 ,   0 ) ; Commonly the cell separator insets are set by overriding WillDisplay public   override   void   WillDisplay ( UITableView   tableView ,   UITableViewCell   cell ,   NSIndexPath   indexPath ) {     if   (c ell . RespondsToSelector ( new   Selector ( " setLayoutMargins : " )))         c ell . LayoutMargins   =   new   UIEdgeInsets ( 0 ,   0 ,   0 ,   0 ) ; } Hopefully this won't change again with iOS9...

A simple Async await call to download a file with Basic Authentication

A simple async await method to download a file using basic authentication. As this is Basic Auth you should only really use it with https:// calls otherwise the username & password will be sent over as plain Base64 string. using System; using System.IO; using System.Net; using System.Net.Http; using System.Threading.Tasks; private static async Task DownloadFileUsingBasicAuth(string url, string saveFileAs, string username, string password) {                HttpClientHandler handler = new HttpClientHandler();       handler.Credentials = new System.Net.NetworkCredential(username, password);       HttpClient httpClient = new HttpClient(handler);       Uri uri = new Uri(url);       HttpResponseMessage responseMessage = await httpClient.GetAsync(uri, HttpCompletionOption.ResponseHeadersRead);       if (responseMessage.StatusCode == HttpStatusCode.OK)       {           using (var fileStream = File.Create(saveFileAs))           {               using (var httpStream = await responseM

Good Dynamics Android Manifest File Basic Template with Xamarin

At  YARG  we develop Enterprise Apps using Xamarin with the Good Technologies GD SDK.  When creating a new Android App this is the basic Manifest file that we use, which includes the basic permissions.   <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" package="com.mycompany.myapp" android:installLocation="auto" android:versionName="Version 1.0"> <uses-sdk android:minSdkVersion="17" /> <application android:label="MyApp" android:icon="@drawable/icon"> <activity android:name="com.good.gd.ui.GDInternalActivity" android:windowSoftInputMode="adjustPan"></activity> <!-- Main GD Service --> <service android:name="com.good.gd.service.GDService" android:enabled="true" android:exported="false"></service>

.NET Reflector replacement that's free - ILSpy

This is a replacement for .NET Reflector (which has been owned by RedGate since 2011... boooo...) ILSpy requires the .NET Framework 4.0. http://ilspy.net/

Xamarin Forms - InitializeComponent does not exist in the current context

Image
I was presented with this error whilst developing with Xamarin Forms For me it was simply down to copy and paste :-O.  I'd created a new Xaml Page, which fully qualified was MyNameSpace.MyPage. I then copied in some Xaml which had a different name in the Xaml x:Class attribute (x:Class="NotMyNameSpace.OrPage"). I then tried to compile with our fixing the x:Class attribute and got the 'InitializeComponent does not exist' error. Once I changed the Xaml to match my actual classname (x:Class="MyNameSpace.MyPage") I was back on track and the error went away. Hope this helps. For more information have a look at  forums.xamarin.com The other reason is that you may have created a Shared Xamarin Forms Project rather than a Xamarin Forms Portable project. From Craig Dunn at Xamarin (taken from  Xamarin Forms Forum ) You cannot use Xaml with the Shared Project template with iOS apps (in Xamarin Studio). It's a weird combination to rem