Friday, 10 March 2017

Visual Studio 2017 install stuck on Applying Microsoft.VisualStudio.Debugger.JustInTime

This happened to me and I tried lots of things to overcome the problem - eventually I found I had to this:


  • Switch off AVG antivirus protection
  • Switch off  'Real-time protection' on your Windows Defender settings
  • Restart
After restart my install started where it left off and didn't get stuck again!

Tuesday, 28 February 2017

Winforms - showing touch keyboard on Win 10

If you're using a textbox in a winforms app on Windows 10 in tablet mode the touch keyboard only seems to show if your textbox is a password box. Weird huh? There's a few proposed solutions for this to do with tabtip.exe or osk.exe but neither of these worked for me. The most effective solution was to:


Insert a reference to UIAutomation.dll
    In the form-load-handler of the application's main window, insert the following code:
      var asForm = System.Windows.Automation.AutomationElement.FromHandle(this.Handle);

      Friday, 13 January 2017

      cIgnore SSL HTTPS errors GetAsync Httplient .Net winforms

      I'm working on a Windows app at the moment and part of the job involves comms with a Rest api over https. During the development phase the SSL certs for the server aren't valid, and this causes GetAsync for the HttpClient to return a Taskstatus.Faulted, and the whole thing breaks. To overcome this you just need this line of code:

      ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;

      Monday, 21 November 2016

      Android material theme text input - changing colours of underline and floating label

      Android styling/theming is an unholy mess, and I battled once again today with trying to get an input field to look like this:


      This is how it's done - the important thing to note is that these style items go on your main app theme. Applying them directly to a specific input-field-only style/theme will not work.


      Thursday, 3 November 2016

      Android configuration qualifiers for alternative resources

      I discovered today that there's loads more configuration qualifiers for providing alternative Android resources than I was aware of. Here's a handy table, taken from here.


      Configuration
      Example Qualifier Values
      MCC and MNC
      Examples:mcc310
      mcc310-mnc004
      mcc208-mnc00
      etc.
      Language and region
      Examples:en
      fr
      en-rUS
      fr-rFR
      fr-rCA
      etc.
      Layout Direction
      ldrtl
      ldltr
      smallestWidth
      swdp

      Examples:
      sw320dp
      sw600dp
      sw720dp
      etc.
      Available width
      wdp

      Examples:
      w720dp
      w1024dp
      etc.
      Available height
      hdp

      Examples:
      h720dp
      h1024dp
      etc.
      Screen size
      small
      normal
      large
      xlarge
      Screen aspect
      long
      notlong
      Round screen
      round
      notround
      Screen orientation
      port
      land
      UI mode
      car
      desk
      television
      appliancewatch
      Night mode
      night
      notnight
      Screen pixel density (dpi)
      ldpi
      mdpi
      hdpi
      xhdpi
      xxhdpi
      xxxhdpi
      nodpi
      tvdpi
      anydpi
      Touchscreen type
      notouch
      finger
      Keyboard availability
      keysexposed
      keyshidden
      keyssoft
      Primary text input method
      nokeys
      qwerty
      12key
      Navigation key availability
      navexposed
      navhidden
      Primary non-touch navigation method
      nonav
      dpad
      trackball
      wheel
      Platform Version (API level)
      Examples:v3
      v4
      v7
      etc.

      Monday, 31 October 2016

      Creating a Toast equivalent in Xamarin iOS

      I love Android's toast - the UI widget that allows us to tell the user something. It's simple and accessible, and something iOS lacks unless you find a plugin of some sort.

      I've started a new app build recently, using Xamarin with native Android and iOS interfaces, and it was with great joy today that I found a Xamarin toast component for iOS.

      Really simple to use with a using ToastIOS statement, and then the following kind of call:
      Toast.MakeText("Toast!", Toast.LENGTH_LONG)
      .SetFontSize(10)
      .SetGravity(ToastGravity.Center)
      .Show(ToastType.None);