@@ -18,6 +18,7 @@ namespace LocalDrop
1818{
1919 public sealed partial class NavItemReceiver : Page
2020 {
21+ private int port = int . Parse ( MySettings . ReadJsonToDictionary ( ) [ "port" ] . ToString ( ) ) ;
2122 WiFiDirectAdvertisementPublisher _publisher = new WiFiDirectAdvertisementPublisher ( ) ;
2223 DeviceWatcher ? _deviceWatcher = null ;
2324 bool _fWatcherStarted = false ;
@@ -209,7 +210,7 @@ private async void ConnectionRequestedHandler(
209210 Debug . WriteLine ( $ "LocalServiceName:{ pair . LocalServiceName } RemoteServiceName:{ pair . RemoteServiceName } ") ;
210211 Debug . WriteLine ( $ "LocalHostName:{ pair . LocalHostName } RemoteHostName:{ pair . RemoteHostName } ") ;
211212
212- await receiver . StartAsync ( 27431 ) ;
213+ await receiver . StartAsync ( port ) ;
213214
214215 }
215216 }
@@ -285,10 +286,13 @@ private void SaveHistory()
285286 {
286287 try
287288 {
288- var localFolder = ApplicationData . Current . LocalFolder ;
289- var historyFile = Path . Combine ( localFolder . Path , HistoryFileName ) ;
290- var json = JsonConvert . SerializeObject ( ReceivedFiles ) ;
291- File . WriteAllText ( historyFile , json ) ;
289+ DispatcherQueue . TryEnqueue ( ( ) =>
290+ {
291+ var localFolder = ApplicationData . Current . LocalFolder ;
292+ var historyFile = Path . Combine ( localFolder . Path , HistoryFileName ) ;
293+ var json = JsonConvert . SerializeObject ( ReceivedFiles ) ;
294+ File . WriteAllText ( historyFile , json ) ;
295+ } ) ;
292296 }
293297 catch ( Exception ex )
294298 {
0 commit comments