Visually Located


Building a map app with the ArcGIS Runtime Map

This is the first in a series of posts that will go over the new ArcGIS Runtime SDK. This first post will discuss how to get started and create an app that has the ArcGIS Runtime Map. This first step is to download the SDK. The SDK is currently in beta so you will need to sign up for the beta program. It’s important to note that you will not be able to get the SDK from nuget. Esri packages their installers a little differently than you might be used it. The exe that you download is a zip of the actual installer. Run the ArcGIS_Runtime_SDK_for_DotNet_1022_536.exe (as of writing this the file is missing the exe extension, so you’ll need to add it) and you will be prompted for a location to unpackage the installer. Give it a location, once it completes it will run the actual Setup.exe. We’ll be building a Windows Store app with the SDK so you’ll need Visual Studio 2013. The SDK does not support Windows 8 apps, only Windows 8.1 apps. For Windows Phone and WPF you can use Visual S... [More]

Getting started with the ArcGIS Runtime (beta) Mapping SDK for .NET

Last Sunday (March 9) Esri announced the public beta release of their mapping SDK for .NET. This new SDK covers Windows Store, Windows Phone, and WPF. Can you believe it? All three platforms, and all using the same API. This is huge news if you develop mapping applications. Personally I find it painful that in Windows Phone 7 you would use the Bing Maps (Silverlight) SDK. In Windows Phone 8 you were encouraged to use the new Nokia Maps SDK, while on Windows Store you had the Bing Maps SDK, but it was a different SDK than the Windows Phone 7 one. So that’s three different SDKs to use. I have no idea who thought this was a sane idea. Esri has been working hard on this new SDK. During the Devsummit last year (2014), Esri announced the beta of a new SDK that would target Windows Store. At that time, they already had a Windows Phone SDK and a WPF SDK. Both were very similar with a few extras on the WPF side. While working on this new beta for Windows Store, they decided it would be much be... [More]

Extending your app theme into the SystemTray

I have seen a lot of apps recently in which the developers think about the theme of their app. They have nice colors, either in text, or background or both. Sidebar: I recently read in an MSDN blog that “Backgrounds are discouraged. They are allowed for brand reasons and to support contrast. Instead, use any accent colors on the text foreground”. I personally like when apps do this rather than just the plain white or black text/background offered by default. This makes the app stand out from the rest. Heck, even Microsoft has violated this rule with their bing apps. I have a dark theme for my phone, yet the bing apps seem to favor a white background. One area I notice where people are not applying their theme is in the system tray. They spend a lot of time and effort theming their pages, yet neglect this area. This is actually not surprising as the system tray is easy to overlook when creating your apps. It is placed in by default, it’s very small (32 pixels), and when using the... [More]

Add a persistent element to every page of your phone apps

Adding ad controls to apps is a pretty common thing. Some apps have ads on every page of the app. Some apps only have ads on some pages. When you want to have ads on one page you have to manually add the control to each page. Wouldn’t it be cool to only add it once and it shows up on all of your pages? This is exactly what someone recently asked on Stack Overflow. This is possible to do and quite simple. First, add a new style to your App.xaml resources and name it AdPhoneApplicationFrameStyle. <Style x:Key="AdPhoneApplicationFrameStyle" TargetType="toolkit:TransitionFrame"> <Setter Property="IsTabStop" Value="False"/> <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/> <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeNormal}"/> <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilyNormal}"/> <Setter Property="HorizontalAlignm... [More]

Asynchronous Predicates, Actions and Funcs

I love the built in Predicate, Action, and Func delegates. They provide simple ways for methods to be passed to other objects. Suppose you had an interface that processes some results. In the Process method, it has a parameter that specifies if a given item is valid and ready for processing public interface IProcessResults { IEnumerable<IProcessedItem> Process(IEnumerable<IItem> items, Predicate<IItem> isValid = null); } If the predicate existed, the implementing class would call that method to determine if an item is valid or not. This is all well and good, but we live in async world now. Windows Store APIs enforce async everywhere they can. Windows Phone and the .Net APIs are not quite there, but do provide everything needed so that you may be able to make your app Fast and Fluid. Why should we be held back by these synchronous delegate methods? Let’s see if we can take the existing APIs, and make them asynchronous. ... [More]

Place your app title in the System Tray

I’ve been using the new Bing apps a lot and I really like how the app name is in the SystemTray. This looks awesome and frees up valuable space for your app! I have found that sometimes I remove the app title from pages to allow for more content. Accomplishing this for your apps is soooo simple! All you need to do is comment out the TextBlock that you are using for your title, and add the following bit of xaml to your page (outside of any grids and such) <shell:SystemTray.ProgressIndicator> <shell:ProgressIndicator Text="My Application" IsVisible="True" IsIndeterminate="False"/> </shell:SystemTray.ProgressIndicator> Make sure you have set the SystemTray to be visible by setting the IsVisible property to true. You still get the advantage of the text going away when the user taps the tray. If you do this, you will need to rethink how you show that the app is loading. The ProgressIndicator is suppose to be used to show tha... [More]

Crop and resize any image to create a lockscreen for your phone with the [RTM] Nokia Imaging SDK

Awhile back I blogged about this same topic but with the beta version of the Nokia Imaging SDK. When Nokia released the RTM of their Imaging SDK, this functionality changed. We’ll take a look at how to accomplish this same functionality with the new Imaging SDK.The good news we will be able to reuse the GetRandomImage method that picked a photo from the phones library. private Picture GetRandomImage() { var rand = new Random(DateTime.Now.Millisecond); MediaLibrary library = new MediaLibrary(); var album = library.RootPictureAlbum; int albumIndex = rand.Next(0, album.Albums.Count - 1); album = album.Albums[albumIndex]; var pictureIndex = rand.Next(0, album.Pictures.Count - 1); var picture = album.Pictures[pictureIndex]; return picture; } We will also be able to reuse the GetCropArea method without any change... [More]

Synching the scroll position of two LongListSelectors

I was looking at Stackoverflow and found a question asking about how to sync two LongListSelectors so that their scroll position was always the same. I thought this was so cool that it was worth sharing it with the masses. First create a new class called MyLongListSelector. Unlike the ListBox, the LLS does not use a ScrollViewer to scroll the content. Instead, it uses a ViewportControl. We need to override the OnApplyTemplate and hook into the ViewportChanged event of the ViewportControl . public class MyLongListSelector : LongListSelector { private ViewportControl _viewport;   public override void OnApplyTemplate() { base.OnApplyTemplate();   _viewport = (ViewportControl)GetTemplateChild("ViewportControl"); _viewport.ViewportChanged += OnViewportChanged; } } Within the event handler for the ViewportChanged event, we’ll se... [More]

Strongly type your settings saved in IsolatedStorageSettings

When creating an app you��ll need some way to save user settings. In Windows Phone (and Windows Store) Apps there are four possible ways to save settings. Key/Value pairs in IsolatedStorageSettings Save a file in IsolatedStorage Save values in a local database Save values in the cloud Usually everyone starts by saving values into IsolatedStorageSettings, and for the most part, it’s probably the best way to go. If you are creating a music app, you can not use IsolatedStorageSettings. The AudioPlayerAgent simply will not get the correct setting values. If you are creating an app with a background agent, you should consider not using IsolatedStorageSettings for the same reason as before. You are less likely to have a problem with incorrect values with a normal background agent than you are when using an audio agent. While using the IsolatedStorageSettings can be easy, the code can get ugly fast. You may have usage scattered throughout your code. public MainPage... [More]

Creating simple page transitions using Storyboards: Fly away transition

This is the third post is a series about creating simple page transitions using Storyboards. We’ve created two basic page transitions with the  slide and turnstile transition. Now it’s time to get a little more complex. The mail app has what I like to call a “fly away” transition. When you tap an email, the subject flies away and the email slides up. This transition is a little more complex. Instead of animating the entire page, we only animate one control that is contained within one item of a ListBox. When the selection changes we need to animate the “header” of the selected item. The problem is that the SelectedItem of a ListBox is the bound item, and not the UI representation of that item. Good news is if we are displaying items with any type of ItemsControl, we can get the container for the bound item. An ItemsControl has a ItemContainerGenerator property that returns an instance of an ItemContainerGenerator. The ItemContainerGenerator has a ContainerFromItem method that r... [More]