Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

format code with dotnet-format #355

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion MauiMaps/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:mauiMaps="clr-namespace:MauiMaps"
xmlns:models="clr-namespace:MauiMaps.Models"
x:DataType="mauiMaps:MainPageViewModel">
x:DataType="mauiMaps:MainPageViewModel"
Shell.NavBarIsVisible="False">

<Grid>
<Map
Expand Down
4 changes: 2 additions & 2 deletions MauiMaps/Platforms/Android/CustomInfoWindowClickListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public CustomInfoWindowClickListener(CustomMapHandler mapHandler)

public void OnInfoWindowClick(Android.Gms.Maps.Model.Marker marker)
{
var pin = mapHandler.Markers.FirstOrDefault(x => x.Value.Id == marker.Id);
pin.Key?.SendInfoWindowClick();
var pin = mapHandler.Markers.FirstOrDefault(x => x.marker.Id == marker.Id);
pin.pin?.SendInfoWindowClick();
}
}
8 changes: 4 additions & 4 deletions MauiMaps/Platforms/Android/CustomMapHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public CustomMapHandler(IPropertyMapper? mapper = null, CommandMapper? commandMa
{
}

public Dictionary<IMapPin, Marker> Markers { get; } = new();
public List<(IMapPin pin, Marker marker)> Markers { get; } = new();

protected override void ConnectHandler(MapView platformView)
{
Expand All @@ -40,7 +40,7 @@ protected override void ConnectHandler(MapView platformView)
{
foreach (var marker in mapHandler.Markers)
{
marker.Value.Remove();
marker.marker.Remove();
}

mapHandler.Markers.Clear();
Expand All @@ -65,7 +65,7 @@ private void AddPins(IEnumerable<IMapPin> mapPins)
{
cp.ImageSource.LoadImage(MauiContext, result =>
{
if (result?.Value is BitmapDrawable bitmapDrawable && bitmapDrawable.Bitmap is not null)
if (result?.Value is BitmapDrawable { Bitmap: not null } bitmapDrawable)
{
markerOption.SetIcon(BitmapDescriptorFactory.FromBitmap(GetMaximumBitmap(bitmapDrawable.Bitmap, 100, 100)));
}
Expand All @@ -85,7 +85,7 @@ private void AddMarker(GoogleMap map, IMapPin pin, MarkerOptions markerOption)
{
var marker = map.AddMarker(markerOption);
pin.MarkerId = marker.Id;
Markers.Add(pin, marker);
Markers.Add((pin, marker));
}

private static Bitmap GetMaximumBitmap(in Bitmap sourceImage, in float maxWidth, in float maxHeight)
Expand Down
4 changes: 2 additions & 2 deletions MauiMaps/Platforms/Android/CustomMarkerClickListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public CustomMarkerClickListener(CustomMapHandler mapHandler)

public bool OnMarkerClick(Android.Gms.Maps.Model.Marker marker)
{
var pin = mapHandler.Markers.FirstOrDefault(x => x.Value.Id == marker.Id);
pin.Key?.SendMarkerClick();
var pin = mapHandler.Markers.FirstOrDefault(x => x.marker.Id == marker.Id);
pin.pin?.SendMarkerClick();
marker.ShowInfoWindow();
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion MauiMarkdown/MauiMarkdown.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</ItemGroup>

<ItemGroup Condition="$(NetVersion) != 'net7.0'">
<PackageReference Include="Microsoft.Maui.Graphics.Text.Markdig" Version="8.0.0-preview.6.8686" />
<PackageReference Include="Microsoft.Maui.Graphics.Text.Markdig" Version="8.0.0-preview.7.8842" />
</ItemGroup>
<ItemGroup Condition="$(NetVersion) == 'net7.0'">
<PackageReference Include="Microsoft.Maui.Graphics.Text.Markdig" Version="7.0.92" />
Expand Down
31 changes: 26 additions & 5 deletions MauiPaint/Platforms/Windows/DragDropHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,35 @@ namespace MauiPaint;
using System.Diagnostics;
using System.Text;
using Windows.Foundation;
using Windows.Storage.Streams;
using DragStartingEventArgs = Microsoft.UI.Xaml.DragStartingEventArgs;

public static class DragDropHelper
{
private static readonly Dictionary<UIElement, TypedEventHandler<UIElement, DragStartingEventArgs>> DragStartingEventHandlers = new();
private static readonly Dictionary<UIElement, DragEventHandler> DragEventHandlers = new();

public static void RegisterDrag(UIElement element, Func<CancellationToken, Task<Stream>> content)
{
element.CanDrag = true;
element.DragStarting += async (s, e) =>

async void DragStartingHandler(UIElement s, DragStartingEventArgs e)
{
var stream = await content.Invoke(CancellationToken.None);
var storageFile = await CreateStorageFile(stream);
e.Data.SetStorageItems(new List<IStorageItem>()
{
storageFile
});
};
}

DragStartingEventHandlers[element] = DragStartingHandler;
element.DragStarting += DragStartingHandler;
}

public static void RegisterDrop(UIElement element, Func<Stream, Task>? content)
{
element.AllowDrop = true;
element.Drop += async (s, e) =>
async void DropHandler(object s, DragEventArgs e)
{
if (e.DataView.Contains(StandardDataFormats.StorageItems))
{
Expand All @@ -48,18 +55,32 @@ public static void RegisterDrop(UIElement element, Func<Stream, Task>? content)
}
}
}
};
}

element.Drop += DropHandler;
DragEventHandlers[element] = DropHandler;
element.DragOver += OnDragOver;
}

public static void UnRegisterDrag(UIElement element)
{
element.CanDrag = false;
if (DragStartingEventHandlers.TryGetValue(element, out var dragStartingEventHandler))
{
element.DragStarting -= dragStartingEventHandler;
DragStartingEventHandlers.Remove(element);
}
}

public static void UnRegisterDrop(UIElement element)
{
element.AllowDrop = false;
if (DragEventHandlers.TryGetValue(element, out var dragEventHandler))
{
element.Drop -= dragEventHandler;
DragEventHandlers.Remove(element);
}

element.DragOver -= OnDragOver;
}

Expand Down
2 changes: 1 addition & 1 deletion md/thankyou.mdpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
## Thank You

Special thanks to my friends and sponsors: @PeterFucci, Gerald Versluis (jfversluis), @renatolopes, Glen Herman, Olexii, Brady, Yury Michurin, VToegel, Aleksander Rokic, Jeffrey Williams, TimKyn.
Special thanks to my friends and sponsors: @PeterFucci, Gerald Versluis (jfversluis), @renatolopes, Glen Herman, Olexii, Brady, Yury Michurin, VToegel, Aleksander Rokic, Jeffrey Williams, TimKyn, Standa Mikeš, Aaron Schaefer.
Loading