Untitled
unknown
plain_text
2 years ago
1.4 kB
4
Indexable
var result = await FilePicker.PickAsync(new PickOptions { PickerTitle = "Select main image", FileTypes = FilePickerFileType.Images }); if (result == null) return; FileInfo fi = new(result.FullPath); var size = fi.Length; if (size > 524288) { var snackbarOptions = new SnackbarOptions { BackgroundColor = Color.FromRgb(32, 32, 40), TextColor = Colors.WhiteSmoke, ActionButtonTextColor = Colors.White, CornerRadius = new CornerRadius(10), Font = Font.SystemFontOfSize(10), ActionButtonFont = Font.SystemFontOfSize(10) }; const string text = "The image you have selected is more than 0.50MB please ensure that the size of the image is less than the maximum size. Thank you!"; const string actionButtonText = "Got it!"; var duration = TimeSpan.FromSeconds(10); var snackbar = Snackbar.Make(text, null, actionButtonText, duration, snackbarOptions); await snackbar.Show(cancellationTokenSource.Token); return; } var stream = await result.OpenReadAsync(); _mainimgResult = result; mainimage.Source = ImageSource.FromStream(() => stream);
Editor is loading...