Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions Parse/PlatformHooks.WinRT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,19 @@ public string SDKName {

public string AppName {
get {
var result = new TaskCompletionSource<string>();
Action toRun = (async () => {
var file = await Package.Current.InstalledLocation.GetFileAsync("AppxManifest.xml");
string manifestXml = await FileIO.ReadTextAsync(file);

var doc = XDocument.Parse(manifestXml);
var installedLocation = Windows.ApplicationModel.Package.Current.InstalledLocation;
var task = Package.Current.InstalledLocation.GetFileAsync("AppxManifest.xml").AsTask().OnSuccess(t => {
return FileIO.ReadTextAsync(t.Result).AsTask();
}).Unwrap().OnSuccess(t => {
var doc = XDocument.Parse(t.Result);

// Define the default namespace to be used
var propertiesXName = XName.Get("Properties", "http://schemas.microsoft.com/appx/2010/manifest");
var displayNameXName = XName.Get("DisplayName", "http://schemas.microsoft.com/appx/2010/manifest");

result.TrySetResult(doc.Descendants(propertiesXName).Single().Descendants(displayNameXName).Single().Value);
});
toRun();
result.Task.Wait();

return result.Task.Result;
var displayNameXName = XName.Get("DisplayName", "http://schemas.microsoft.com/appx/2010/manifest");

return doc.Descendants(propertiesXName).Single().Descendants(displayNameXName).Single().Value;
});
task.Wait();
return task.Result;
}
}

Expand Down