Agenda Windows Phone History WP 7.0 Silverlight WP 7.5 Silverlight WP 8.0 Silverlight WP 8.1 Silverlight WP 8.1 WinRT Why stay on Windows Phone Silverlight?
Download
Report
Transcript Agenda Windows Phone History WP 7.0 Silverlight WP 7.5 Silverlight WP 8.0 Silverlight WP 8.1 Silverlight WP 8.1 WinRT Why stay on Windows Phone Silverlight?
Agenda
Windows Phone History
WP 7.0
Silverlight
WP 7.5
Silverlight
WP 8.0
Silverlight
WP 8.1
Silverlight
WP 8.1
WinRT
Why stay on Windows Phone Silverlight?
Why Retarget to Windows Phone Silverlight 8.1
2-517: What’s new with Windows Phone Silverlight Apps! (Sam Jarwan, Harini Kannan)
Why choose the Windows Runtime?
3-591: Using Visual Studio to build XAML universal apps (Navit Saxena)
Introducing the Windows Runtime
Windows Runtime
Asynchronous Programming
async void Button_Click(object sender, EventArgs e)
{
var service = new WebService();
this.Data = await services.FetchDataAsync();
this.Flag = FlagStates.Green;
}
Asynchronous Programming
private async void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
// TODO: Save application state
deferral.Complete();
}
Microsoft Virtual Academy: C# Fundamentals (http://aka.ms/CSFun)
// create folder
// Windows.ApplicationModel.Package.Current.InstalledLocation;
var folder = Windows.Storage.ApplicationData.Current.LocalFolder;
var subfolder = await folder.CreateFolderAsync("MyFolder",
Windows.Storage.CreationCollisionOption.OpenIfExists);
// create file
var file = await subfolder.CreateFileAsync("MyFile.txt",
Windows.Storage.CreationCollisionOption.ReplaceExisting);
// write
await Windows.Storage.FileIO.WriteTextAsync(file, "Hello Build!");
// read
var content = await Windows.Storage.FileIO.ReadTextAsync(file);
// email
var email = new EmailMessage();
email.Subject = "File is attached";
email.To.Add(new EmailRecipient("[email protected]"));
email.Attachments.Add(new EmailAttachment(file.Name, file));
await EmailManager.ShowComposeNewEmailAsync(email);
Windows.Storage.ApplicationData
What, no MessageBox?
var ok = new UICommand("ok", x => { /* TODO */ });
var cancel = new UICommand("cancel");
var dialog = new MessageDialog("message", "title");
dialog.Commands.Add(ok);
dialog.Commands.Add(cancel);
await dialog.ShowAsync();
If you use Microsoft.Phone.Tasks
MarketplaceReviewTask
Launch URI: zune:reviewapp?appid=app[app ID]
MarketplaceSearchTask
Launch URI: zune:search?publisher=[publisher ID]*
WebBrowserTask
Windows.System.Launcher.LaunchUriAsync(Uri)
AddressChooserTask
Windows.ApplicationModel.Contacts.ContactPicker
PhoneCallTask
Windows.ApplicationModel.Calls.PhoneCallManager
SmsComposeTask
Windows.ApplicationModel.Chat.ChatMessageManager
If you use Microsoft.Phone.BackgroundAgent
2-518: Background Tasks for Windows Phone (Shawn Henry)
If you use Live Tiles
2-253: Get your App Tapped (Matt Hidinger)
If you use Navigation & Back button
Frame.Navigate(typeof(MapPage), “Seattle, WA”);
Windows.Phone.UI.Input.HardwareButtons.BackPressed;
var frame = Window.Current.Content as Frame;
if (frame != null && frame.CanGoBack)
{
frame.GoBack();
e.Handled = true;
}
2-537: Navigation Model for Windows XAML Applications (Roberth Karman)
If you use the Networking API
//var client = new System.Net.Http.HttpClient();
var client = new Windows.Web.Http.HttpClient();
var response = await client.GetAsync(new Uri("http://server"));
response.EnsureSuccessStatusCode();
var json = await response.Content.ReadAsStringAsync();
If you use Localization
2-543: Apps Without Borders (Cameron Lerum)
If you use Orientation
using Windows.UI.ViewManagement;
Window.Current.SizeChanged += (s, e) =>
{
var view = ApplicationView.GetForCurrentView();
var orientation = view.Orientation;
if (orientation == ApplicationViewOrientation.Landscape)
VisualStateManager.GoToState(this, "Landscape", true);
else
VisualStateManager.GoToState(this, "Portrait", true);
};
FileOpenPicker
private void OpenFile_Click(object sender, RoutedEventArgs e)
{
FileOpenPicker picker = new FileOpenPicker();
picker.FileTypeFilter.Add(".mp4");
picker.PickSingleFileAndContinue();
}
#mstechdays
Code/Développement
FileOpenPicker Continuation
protected override void OnActivated(IActivatedEventArgs e)
{
switch (e.Kind)
{
case ActivationKind.PickFileContinuation:
var args = e as FileOpenPickerContinuationEventArgs;
this.OnContinueFileOpenPicker(args);
break;
}
}
#mstechdays
Code/Développement
Share Contract
private void ShareButton_Click(object sender, RoutedEventArgs e)
{
var manager = DataTransferManager.GetForCurrentView();
manager.DataRequested
+= DataTransferManager_DataRequested;
DataTransferManager.ShowShareUI();
}
#mstechdays
Code/Développement
Share Contract
private void DataTransferManager_DataRequested(
DataTransferManager sender, DataRequestedEventArgs e)
{
e.Request.Data.Properties.Title = "Share Contract";
e.Request.Data.SetText("Hello World");
}
#mstechdays
Code/Développement
Review