@@ -532,47 +532,7 @@ public ToolbarViewModel(
532532 canvas . Restore ( ) ;
533533 }
534534
535- ImportImageCommand = ReactiveCommand . CreateFromTask ( async ( ) =>
536- {
537- try
538- {
539- var result = await FilePicker . Default . PickAsync ( new PickOptions
540- {
541- PickerTitle = "Select an image to import" ,
542- FileTypes = FilePickerFileType . Images
543- } ) ;
544-
545- if ( result != null )
546- {
547- string path = result . FullPath ;
548-
549- // On platforms where FullPath is not available, copy to cache
550- if ( string . IsNullOrEmpty ( path ) )
551- {
552- path = Path . Combine ( FileSystem . CacheDirectory , result . FileName ) ;
553- using var sourceStream = await result . OpenReadAsync ( ) ;
554- using var destStream = File . Create ( path ) ;
555- await sourceStream . CopyToAsync ( destStream ) ;
556- }
557-
558- // Load with downsampling (max 2048x2048)
559- var bitmap = await this . bitmapCacheManager . GetBitmapAsync ( path , 2048 , 2048 ) ;
560- if ( bitmap != null )
561- {
562- var drawableImage = new DrawableImage ( bitmap )
563- {
564- SourcePath = path
565- } ;
566-
567- this . layerFacade . CurrentLayer ? . Elements . Add ( drawableImage ) ;
568- this . messageBus . SendMessage ( new CanvasInvalidateMessage ( ) ) ;
569- this . layerFacade . SaveState ( ) ;
570- }
571- }
572- }
573- catch ( Exception ex )
574- {
575- System . Diagnostics . Debug . WriteLine ( $ "Error importing image: { ex . Message } ") ;
535+ i = j ;
576536 }
577537 }
578538
@@ -591,13 +551,12 @@ public ToolbarViewModel(
591551 using var data = image . Encode ( SKEncodedImageFormat . Png , 100 ) ;
592552 using var stream = data . AsStream ( ) ;
593553
594- var result = await this . fileSaver . SaveAsync ( "lunadraw_canvas.png" , stream ) ;
595- }
596- catch ( Exception ex )
597- {
598- System . Diagnostics . Debug . WriteLine ( $ "Error saving image: { ex . Message } ") ;
599- }
600- } ) ;
601- }
602- }
603- }
554+ var result = await this . fileSaver . SaveAsync ( "lunadraw_canvas.png" , stream ) ;
555+ }
556+ catch ( Exception ex )
557+ {
558+ System . Diagnostics . Debug . WriteLine ( $ "Error saving image: { ex . Message } ") ;
559+ }
560+ } ) ;
561+ }
562+ }
0 commit comments