File tree Expand file tree Collapse file tree 1 file changed +10
-15
lines changed Expand file tree Collapse file tree 1 file changed +10
-15
lines changed Original file line number Diff line number Diff line change @@ -55,24 +55,19 @@ public string SDKName {
5555
5656 public string AppName {
5757 get {
58- var result = new TaskCompletionSource < string > ( ) ;
59- Action toRun = ( async ( ) => {
60- var file = await Package . Current . InstalledLocation . GetFileAsync ( "AppxManifest.xml" ) ;
61- string manifestXml = await FileIO . ReadTextAsync ( file ) ;
62-
63- var doc = XDocument . Parse ( manifestXml ) ;
64- var installedLocation = Windows . ApplicationModel . Package . Current . InstalledLocation ;
58+ var task = Package . Current . InstalledLocation . GetFileAsync ( "AppxManifest.xml" ) . AsTask ( ) . OnSuccess ( t => {
59+ return FileIO . ReadTextAsync ( t . Result ) . AsTask ( ) ;
60+ } ) . Unwrap ( ) . OnSuccess ( t => {
61+ var doc = XDocument . Parse ( t . Result ) ;
6562
6663 // Define the default namespace to be used
6764 var propertiesXName = XName . Get ( "Properties" , "http://schemas.microsoft.com/appx/2010/manifest" ) ;
68- var displayNameXName = XName . Get ( "DisplayName" , "http://schemas.microsoft.com/appx/2010/manifest" ) ;
69-
70- result . TrySetResult ( doc . Descendants ( propertiesXName ) . Single ( ) . Descendants ( displayNameXName ) . Single ( ) . Value ) ;
71- } ) ;
72- toRun ( ) ;
73- result . Task . Wait ( ) ;
74-
75- return result . Task . Result ;
65+ var displayNameXName = XName . Get ( "DisplayName" , "http://schemas.microsoft.com/appx/2010/manifest" ) ;
66+
67+ return doc . Descendants ( propertiesXName ) . Single ( ) . Descendants ( displayNameXName ) . Single ( ) . Value ;
68+ } ) ;
69+ task . Wait ( ) ;
70+ return task . Result ;
7671 }
7772 }
7873
You can’t perform that action at this time.
0 commit comments