Skip to content

Instantly share code, notes, and snippets.

@mbcrump
Last active September 23, 2016 23:22
Show Gist options
  • Save mbcrump/c233cf23248eb4d8d975df4eb7abb08f to your computer and use it in GitHub Desktop.
Save mbcrump/c233cf23248eb4d8d975df4eb7abb08f to your computer and use it in GitHub Desktop.

##Mobilize.NET SL Bridge

Install the bits

Mapping can be found on GitHub

Coding4Fun

  1. Open WeatherForecastSample and show it running inside the 8.1 Emulator

  2. Right-click the solution and select "Convert to UWP". Make note that it is using the Coding4Fun toolkit.

  3. Open the output and let them know there is a MigrationLog and UpgradeReport in the UWP folder that they can refer back to.

  4. Switch to x64 and local machine

  5. Run the app and it will show that there are 4 errors on the "Show" method.

  6. Comment out the last show line and add the following:

    private void ApplicationBarMenuItem_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { var aboutprompt = new WindowsPhoneUWP.UpgradeHelpers.AboutPrompt(); var aboutPromptItem = new WindowsPhoneUWP.UpgradeHelpers.AboutPromptItem() { AuthorName = "Michael Crump", Role = "PMM", EmailAddress = "[email protected]", WebSiteUrl = "http://microsoft.com/" }; aboutprompt.Show(aboutPromptItem); }

  7. Build again and it will show another error.

Switch to the MainPage.xaml and remove the reference to the Coding4Fun toolkit

As well as this line :

<Controls:MemoryCounter></Controls:MemoryCounter>
  1. The app should now run and make sure you click on the About button.

##Desktop App Converter

Install the tool

Manual Packaging Scenario. - You may have an application that doesn't have an installer (such as InstallShield). You may copy your app on a USB key and distribute it that way. Or you may even use xcopy.exe to distribute your app.

  1. Run the Visual Studio project and hit a breakpoint on a UWP Feature.

  2. Copy the bin/Debug folder over to C:\Win32App

  3. Copy AppxManifest to bin/Debug folder

  4. Copy Assets Folder that has Images

  5. Examine the Mapping file

  6. Examine the Certs folder

  7. Run the following from VS Command Prompt as Admin

    Makeappx Pack /F C:\Win32App\MyHealth.Client.Mapping.txt /P C:\Win32App\myapp.appx

    Certutil -AddStore Root C:\Win32App\Certs\DesktopBridgeIgnite.cer

    signtool.exe sign -f C:\Win32App\Certs\DesktopBridgeIgnite.pfx -fd SHA256 -v C:\Win32App\myapp.appx

  8. Install the app

##Hosted Web Apps

  1. Open Visual Studio and create a Hosted Web App - > Under JavaScript -> Windows

###Demo 1

https://seksenov.github.io/ContosoTravel/

Add it to content URI's and allow it

Hit Func and F12 (or CTRL F12)

Enter "Enjoy your trip" in the search box and replace the text to "Have fun in".

###Demo 2

Open Visual Studio and create a Hosted Web App - > Under JavaScript -> Windows

  1. Point the URL to http://codepen.io/mbcrump/pen/kXqyNx?editors=101

  2. Switch to the content URIs

http://codepen.io/

http://*.codepen.io/

Set access to ALL

  1. Add this code to the app:

    function cameraCapture() { var FileToSave; var cam = new Windows.Media.Capture.CameraCaptureUI(); var folder = Windows.Storage.KnownFolders.picturesLibrary;

    cam.captureFileAsync(Windows.Media.Capture.CameraCaptureUIMode.photo).then(function(file) { if (file) {

           FileToSave = file;
           folder.createFileAsync("photo.jpg", Windows.Storage.CreationCollisionOption.replaceExisting)
               .then(function(file) {
                   FileToSave.copyAndReplaceAsync(file);
    
               });
    
       } else {
    
       }
    

    }, function(err) { displayError(err); });

    }

  2. Run the app

The JS code was able to display an interactive Toast on Windows directly calling the native APIs and by hooking into the activation event it will be able to capture the response as well.

##Windows Bridge for iOS

  1. Download WinObjC from GitHub

  2. Download Calculator code

Read the blog post here : https://blogs.windows.com/buildingapps/2016/02/18/using-the-ios-bridge-to-bring-storyboards-and-auto-layout-to-windows-10/

  1. Open cmd prompt and navigate to

    cd C:\Presentations\Bringing your code to Windows\4.iOS Bridge\Calculator\Calculator

  2. Run

    "C:\Presentations\Bringing your code to Windows\4.iOS Bridge\winobjc\bin\vsimporter.exe"

Try out the iOS App Analyzer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment