Merge pull request #624 from mono/linq-opt
[Perf] Misc method groups instead of linq where applicable.
This commit is contained in:
Коммит
9e7be822c1
|
@ -134,7 +134,7 @@ namespace Xwt.GtkBackend
|
|||
|
||||
TreePosition toggledItem = null;
|
||||
|
||||
var pathParts = path.Split (':').Select (part => int.Parse (part));
|
||||
var pathParts = path.Split (':').Select (int.Parse);
|
||||
|
||||
foreach (int pathPart in pathParts) {
|
||||
toggledItem = treeFrontend.DataSource.GetChild (toggledItem, pathPart);
|
||||
|
|
|
@ -342,7 +342,7 @@ namespace Xwt.GtkBackend
|
|||
|
||||
TreePosition toggledItem = null;
|
||||
|
||||
var pathParts = path.Split (':').Select (part => int.Parse (part));
|
||||
var pathParts = path.Split (':').Select (int.Parse);
|
||||
|
||||
foreach (int pathPart in pathParts) {
|
||||
toggledItem = treeFrontend.DataSource.GetChild (toggledItem, pathPart);
|
||||
|
|
|
@ -892,7 +892,7 @@ namespace Xwt.WPFBackend
|
|||
|
||||
void CheckDrop (object sender, System.Windows.DragEventArgs e)
|
||||
{
|
||||
var types = e.Data.GetFormats ().Select (t => t.ToXwtTransferType ()).ToArray ();
|
||||
var types = e.Data.GetFormats ().Select (DataConverter.ToXwtTransferType).ToArray ();
|
||||
var pos = e.GetPosition (Widget).ToXwtPoint ();
|
||||
var proposedAction = DetectDragAction (e.KeyStates);
|
||||
|
||||
|
@ -942,7 +942,7 @@ namespace Xwt.WPFBackend
|
|||
|
||||
WidgetDragLeaveHandler (sender, e);
|
||||
|
||||
var types = e.Data.GetFormats ().Select (t => t.ToXwtTransferType ()).ToArray ();
|
||||
var types = e.Data.GetFormats ().Select (DataConverter.ToXwtTransferType).ToArray ();
|
||||
var pos = e.GetPosition (Widget).ToXwtPoint ();
|
||||
var actualEffect = currentDragEffect;
|
||||
|
||||
|
|
|
@ -579,7 +579,7 @@ namespace Xwt.Mac
|
|||
public void SetDragTarget (TransferDataType[] types, DragDropAction dragAction)
|
||||
{
|
||||
SetupForDragDrop (Widget.GetType ());
|
||||
var dtypes = types.Select (t => ToNSDragType (t)).ToArray ();
|
||||
var dtypes = types.Select (ToNSDragType).ToArray ();
|
||||
Widget.RegisterForDraggedTypes (dtypes);
|
||||
}
|
||||
|
||||
|
@ -596,7 +596,7 @@ namespace Xwt.Mac
|
|||
var backend = ob.Backend;
|
||||
|
||||
NSDraggingInfo di = (NSDraggingInfo) Runtime.GetNSObject (dragInfo);
|
||||
var types = di.DraggingPasteboard.Types.Select (t => ToXwtDragType (t)).ToArray ();
|
||||
var types = di.DraggingPasteboard.Types.Select (ToXwtDragType).ToArray ();
|
||||
var pos = new Point (di.DraggingLocation.X, di.DraggingLocation.Y);
|
||||
|
||||
if ((backend.currentEvents & WidgetEvent.DragOverCheck) != 0) {
|
||||
|
@ -642,7 +642,7 @@ namespace Xwt.Mac
|
|||
var backend = ob.Backend;
|
||||
|
||||
NSDraggingInfo di = (NSDraggingInfo) Runtime.GetNSObject (dragInfo);
|
||||
var types = di.DraggingPasteboard.Types.Select (t => ToXwtDragType (t)).ToArray ();
|
||||
var types = di.DraggingPasteboard.Types.Select (ToXwtDragType).ToArray ();
|
||||
var pos = new Point (di.DraggingLocation.X, di.DraggingLocation.Y);
|
||||
|
||||
if ((backend.currentEvents & WidgetEvent.DragDropCheck) != 0) {
|
||||
|
|
|
@ -309,7 +309,7 @@ namespace Xwt.Drawing
|
|||
}
|
||||
return new ThemedImage (newImages);
|
||||
} else {
|
||||
var img = new Image (Toolkit.CurrentEngine.ImageBackendHandler.CreateMultiSizeIcon (allImages.Select (i => i.GetBackend ())));
|
||||
var img = new Image (Toolkit.CurrentEngine.ImageBackendHandler.CreateMultiSizeIcon (allImages.Select (ExtensionMethods.GetBackend)));
|
||||
|
||||
if (allImages.All (i => i.NativeRef.HasNativeSource)) {
|
||||
var sources = allImages.Select (i => i.NativeRef.NativeSource).ToArray ();
|
||||
|
@ -323,7 +323,7 @@ namespace Xwt.Drawing
|
|||
{
|
||||
if (Toolkit.CurrentEngine == null)
|
||||
throw new ToolkitNotInitializedException ();
|
||||
return new Image (Toolkit.CurrentEngine.ImageBackendHandler.CreateMultiResolutionImage (images.Select (i => i.GetBackend ())));
|
||||
return new Image (Toolkit.CurrentEngine.ImageBackendHandler.CreateMultiResolutionImage (images.Select (ExtensionMethods.GetBackend)));
|
||||
}
|
||||
|
||||
public static Image FromFile (string file)
|
||||
|
|
|
@ -860,7 +860,7 @@ namespace Xwt
|
|||
/// <param name='types'>Types of data that can be dropped on this widget.</param>
|
||||
public void SetDragDropTarget (params Type[] types)
|
||||
{
|
||||
Backend.SetDragTarget (types.Select (t => TransferDataType.FromType (t)).ToArray (), DragDropAction.All);
|
||||
Backend.SetDragTarget (types.Select (TransferDataType.FromType).ToArray (), DragDropAction.All);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -880,7 +880,7 @@ namespace Xwt
|
|||
/// <param name='dragAction'>Bitmask of possible actions for a drop on this widget</param>
|
||||
public void SetDragDropTarget (DragDropAction dragAction, params Type[] types)
|
||||
{
|
||||
Backend.SetDragTarget (types.Select (t => TransferDataType.FromType (t)).ToArray(), dragAction);
|
||||
Backend.SetDragTarget (types.Select (TransferDataType.FromType).ToArray(), dragAction);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -898,7 +898,7 @@ namespace Xwt
|
|||
/// <param name='types'>Types of data that can be dragged from this widget</param>
|
||||
public void SetDragSource (params Type[] types)
|
||||
{
|
||||
Backend.SetDragSource (types.Select (t => TransferDataType.FromType (t)).ToArray(), DragDropAction.All);
|
||||
Backend.SetDragSource (types.Select (TransferDataType.FromType).ToArray(), DragDropAction.All);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -918,7 +918,7 @@ namespace Xwt
|
|||
/// <param name='dragAction'>Bitmask of possible actions for a drag from this widget</param>
|
||||
public void SetDragSource (DragDropAction dragAction, params Type[] types)
|
||||
{
|
||||
Backend.SetDragSource (types.Select (t => TransferDataType.FromType (t)).ToArray(), dragAction);
|
||||
Backend.SetDragSource (types.Select (TransferDataType.FromType).ToArray(), dragAction);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Загрузка…
Ссылка в новой задаче