init
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
using System.ComponentModel;
|
||||
using DTS.Common.Converters;
|
||||
|
||||
namespace DTS.Common.Enums
|
||||
{
|
||||
[TypeConverter(typeof(EnumDescriptionTypeConverter))]
|
||||
public enum MigrationResult
|
||||
{
|
||||
OK,
|
||||
ExceptionThrown,
|
||||
WarningAllowStreamingModesWasNotMigrated
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace DTS.Common.Utils
|
||||
{
|
||||
public class MouseUtilities
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private struct Win32Point
|
||||
{
|
||||
public int X;
|
||||
public int Y;
|
||||
};
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern bool GetCursorPos(ref Win32Point pt);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern bool GetPhysicalCursorPos(ref Win32Point pt);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern bool ScreenToClient(IntPtr hwnd, ref Win32Point pt);
|
||||
|
||||
public static Point GetMousePosition(Visual relativeTo)
|
||||
{
|
||||
var mouse = new Win32Point();
|
||||
GetCursorPos(ref mouse);
|
||||
|
||||
var presentationSource =
|
||||
(System.Windows.Interop.HwndSource)PresentationSource.FromVisual(relativeTo);
|
||||
|
||||
var factor = 2D - presentationSource.CompositionTarget.TransformToDevice.M22;
|
||||
|
||||
ScreenToClient(presentationSource.Handle, ref mouse);
|
||||
|
||||
var transform = relativeTo.TransformToAncestor(presentationSource.RootVisual);
|
||||
|
||||
var offset = transform.Transform(new Point(0, 0));
|
||||
if( factor > 0 )
|
||||
{
|
||||
offset.Y = offset.Y + offset.Y*(presentationSource.CompositionTarget.TransformToDevice.M22 - 1);
|
||||
}
|
||||
return new Point(mouse.X - offset.X, mouse.Y - offset.Y);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
using DTS.Common.Base;
|
||||
// ReSharper disable CheckNamespace
|
||||
|
||||
namespace DTS.Common.Interface
|
||||
{
|
||||
public interface IViewerMainView : IBaseView { }
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
@@ -0,0 +1,6 @@
|
||||
using DTS.Common.Base;
|
||||
|
||||
namespace DTS.Common.Interface
|
||||
{
|
||||
public interface IPowerAndBatteryView : IBaseView { }
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace DTS.Common.Converters
|
||||
{
|
||||
/// <summary>
|
||||
/// converts between two values and a bool (a >= b)
|
||||
/// currently only handles two ints or two doubles
|
||||
/// </summary>
|
||||
public class GreaterEqualThanToBoolConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
if ( value is int a && parameter is int b)
|
||||
{
|
||||
return a >= b;
|
||||
}
|
||||
if (value is double dA && parameter is double dB)
|
||||
{
|
||||
return dA >= dB;
|
||||
}
|
||||
if (value is ushort uShortA && parameter is ushort uShortB)
|
||||
{
|
||||
return uShortA >= uShortB;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user