WpfCoreTools 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package WpfCoreTools --version 1.0.0
NuGet\Install-Package WpfCoreTools -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WpfCoreTools" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WpfCoreTools --version 1.0.0
#r "nuget: WpfCoreTools, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install WpfCoreTools as a Cake Addin
#addin nuget:?package=WpfCoreTools&version=1.0.0

// Install WpfCoreTools as a Cake Tool
#tool nuget:?package=WpfCoreTools&version=1.0.0

icon

WpfCoreTools

Lightweight package with some utilities for .NET Core wpf applications.

release nuget release_date downloads license

Dependencies

net5 net6 coretools

Overview

Utils

GraphicUtils

This static class contains the following functions:

  • Point GetCursorPos()
    Returns the current cursor position on display.

GDIUtils

This static class contains the following functions:

  • Color GetPixelColor(Point pos, [bool takeScreenshotWhenPossible = false])
    Returns the color of the pixel at a specified position.

    • pos: Position of the pixel from to get the color.
    • takeScreenshotWhenPossible: Take a screenshot when possible to get the pixel color (this may be slower and is supported only in Windows).
  • Color GetPixelColorAtCursorPos([bool takeScreenshotWhenPossible = false])
    Returns the color of the pixel at the current cursor position on display.

    • takeScreenshotWhenPossible: Take a screenshot when possible to get the pixel color (this may be slower and is supported only in Windows).
  • BitmapSource? CaptureScreenshot(Point pos, Size size)
    Captures a screenshot from a specified position, with a specified size (returns null if an error occurred).

    • pos: Top-left corner of the screenshot.
    • size: Size of the screenshot.
  • BitmapSource? CaptureScreenshotAtCursorPos(Size size, Size offset)
    Captures a screenshot from the current cursor position on display, with a specified size, and offset (returns null if an error occurred).

    • size: Size of the screenshot.
    • offset: Offset of the screenshot.
  • BitmapSource? CaptureScreenshotAtCursorPos(Size size)
    Captures a screenshot from the current cursor position on display, with a specified size (returns null if an error occurred).

    • size: Size of the screenshot.

SystemUtils

This static class contains the following functions:

  • Window? GetActiveWindow() Returns the current active window (returns null if there is no active window).

  • FileInfo GetExecutingFile()
    Returns the current application executing file.

  • DirectoryInfo GetExecutingDirectory()
    Returns the current application executing directory.

Tools

IDialog

This interface defines an object that can return a result, and contains the following functions:

  • object? GetResult() Gets the result as object.

DialogWindow

This class is a decorator that incapsulates a Window to be displayed as dialog and, in the end, return an object as result.

Constructors:

  • DialogWindow(Window window)

    • window: The Window to handle.

Functions:

  • object? Show()
    Displays the dialog and, in the end, return an object as result.

ClipConverter

This class is a converter that clips elements that are out of a control, and contains the following functions:

  • public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
    Calculates and returns a clip with the specified parameters.

    • values: This parameter is an array that must contain the property of the control to clip. There are 2 mandatory arguments, Width and Height of the control, and 2 optional arguments, CornerRadius and BorderThickness of the control.
    • targetType: Unused.
    • parameter: Unused.
    • culture: Unused.
  • object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
    Unsupported.

Extensions

BitmapSourceExtensions

This static class provides a set of BitmapSource extensions:

  • Bitmap? ToBitmap()
    Converts the BitmapSource to a Bitmap.

  • BitmapSource? ToBitmapSource()
    Converts the Bitmap to a BitmapSource.

ColorExtensions

This static class provides a set of Color extensions:

  • Color Invert()
    Inverts the color by subtracting every value R, G, B from 255.

  • System.Windows.Media.Color ToMediaColor()
    Converts the System.Drawing.Color to a System.Windows.Media.Color.

  • System.Drawing.Color ToDrawingColor()
    Converts the System.Windows.Media.Color to a System.Drawing.Color.

DependencyObjectExtensions

This static class provides a set of DependencyObject extensions:

  • bool IsNull(DependencyProperty dependencyProperty)
    Checks if the DependencyProperty is null.

    • dependencyProperty: DependencyProperty to check if is null.
  • bool IsNotNull(DependencyProperty dependencyProperty)
    Checks if the DependencyProperty is not null.

    • dependencyProperty: DependencyProperty to check if is not null.

PointExtensions

This static class provides a set of Point extensions:

  • System.Windows.Point ToWindowsPoint()
    Converts the System.Drawing.Point to a System.Windows.Point.

  • System.Drawing.Point ToDrawingPoint()
    Converts the System.Windows.Point to a System.Drawing.Point.

SizeExtensions

This static class provides a set of Size extensions:

  • Size Add(Size b)
    Sums a Size to the current Size.

    • b: Size to sum to the current.
  • Size Subtract(Size b)
    Subtracts a Size from the current Size.

    • b: Size to subtract from the current.
  • Size Invert()
    Inverts the Size by replacing every value with its negative.

  • System.Windows.Size ToWindowsSize()
    Converts the System.Drawing.Size to a System.Windows.Size.

  • System.Drawing.Size ToDrawingSize()
    Converts the System.Windows.Size to a System.Drawing.Size.

  • Size UniformSize(double dim)
    Initializes a new Size with uniform dimensions.

    • dim: Dimensions.

StoryboardExtensions

This static class provides a set of Storyboard extensions:

  • Task BeginAsync()
    Applies the animations associated with this Storyboard to their targets and initiates them asyncronously.

ThicknessExtensions

This static class provides a set of Thickness extensions:

  • Thickness Add(Thickness b)
    Sums a Thickness to the current Thickness.

    • b: Thickness to sum to the current.
  • Thickness Subtract(Thickness b)
    Subtracts a Thickness from the current Thickness.

    • b: Thickness to subtract from the current.
  • Thickness Invert()
    Inverts the Thickness by replacing every value with its negative.

License

Copyright (C) 2021-2022 devpelux (Salvatore Peluso)
Licensed under MIT license.

mit

Product Compatible and additional computed target framework versions.
.NET net5.0-windows7.0 is compatible.  net6.0-windows was computed.  net6.0-windows7.0 is compatible.  net7.0-windows was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 145 11/6/2023
1.6.0 337 2/16/2023
1.5.0 766 5/20/2022
1.4.0 423 5/13/2022
1.3.0.3 428 4/28/2022
1.2.0 421 4/22/2022
1.1.1 426 4/22/2022
1.1.0 461 1/7/2022
1.0.0 471 12/30/2021