-
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Avalonia] Update setting wallpaper to include all settings
- Loading branch information
Showing
5 changed files
with
268 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
using System.Runtime.InteropServices; | ||
|
||
namespace PicView.Avalonia.Wallpaper; | ||
|
||
public enum WallpaperStyle | ||
{ | ||
Tile, | ||
Center, | ||
Stretch, | ||
Fit, | ||
Fill | ||
} | ||
|
||
public static class WallpaperManager | ||
{ | ||
public static int GetWallpaperStyle(WallpaperStyle style) | ||
{ | ||
switch (style) | ||
{ | ||
case WallpaperStyle.Tile: | ||
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) | ||
{ | ||
return -1; | ||
} | ||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) | ||
{ | ||
return 0; | ||
} | ||
break; | ||
case WallpaperStyle.Center: | ||
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) | ||
{ | ||
return -1; | ||
} | ||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) | ||
{ | ||
return 1; | ||
} | ||
break; | ||
case WallpaperStyle.Stretch: | ||
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) | ||
{ | ||
return -1; | ||
} | ||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) | ||
{ | ||
return 2; | ||
} | ||
break; | ||
case WallpaperStyle.Fit: | ||
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) | ||
{ | ||
return -1; | ||
} | ||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) | ||
{ | ||
return 3; | ||
} | ||
break; | ||
case WallpaperStyle.Fill: | ||
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) | ||
{ | ||
return -1; | ||
} | ||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) | ||
{ | ||
return 4; | ||
} | ||
break; | ||
default: | ||
return 3; | ||
} | ||
return 0; | ||
} | ||
} |