Skip to content
Merged
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
6 changes: 3 additions & 3 deletions Demos/MinoriDemo/MinoriDemo.Core/MinoriDemo.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="MvvmCross" Version="9.3.1" />
<PackageReference Include="MvvmCross.Plugin.Messenger" Version="9.3.1" />
<PackageReference Include="System.Drawing.Common" Version="9.0.3" />
<PackageReference Include="MvvmCross" Version="10.1.2" />
<PackageReference Include="MvvmCross.Plugin.Messenger" Version="10.1.2" />
<PackageReference Include="System.Drawing.Common" Version="10.0.2" />
<PackageReference Include="System.Drawing.Primitives" Version="4.3.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ public static class QuadTreeExtension
{
public static void Dump<T>(this IMesQuadTree<T> source, LogWriter w) where T : class
{
if (source.Root != null)
{
source.Root.Dump(w);
}
source.Root?.Dump(w);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public HlsColor(Color color)
min = Math.Min(Math.Min(r, g), b);
sum = max + min;

Luminosity = (((sum * HLSMax) + RGBMax) / (2 * RGBMax));
Luminosity = ((sum * HLSMax) + RGBMax) / (2 * RGBMax);

dif = max - min;
if (dif == 0)
Expand All @@ -62,7 +62,7 @@ public HlsColor(Color color)
{
Hue = g == max
? (HLSMax / 3) + Rdelta - Bdelta
: ((2 * HLSMax) / 3) + Gdelta - Rdelta;
: (2 * HLSMax / 3) + Gdelta - Rdelta;
}

if (Hue < 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class LogWriter : IDisposable

public LogWriter(TextWriter w)
{
XmlWriterSettings s = new XmlWriterSettings
XmlWriterSettings s = new()
{
Indent = true
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private void AllocateNodes()

// Fill a sparse grid of rectangular color palette nodes with each tile being 50x30.
// with hue across x-axis and saturation on y-axis, brightness is fixed at 100;
Random r = new Random(Environment.TickCount);
Random r = new(Environment.TickCount);
Graph.VirtualChildren.Clear();
Double w = _tileWidth + _tileMargin;
Double h = _tileHeight + _tileMargin;
Expand All @@ -152,8 +152,8 @@ private void AllocateNodes()
Double x = r.NextDouble() * width;
Double y = r.NextDouble() * height;

PointF pos = new PointF((Single)(_tileMargin + x), (Single)(_tileMargin + y));
SizeF size = new SizeF(r.Next((Int32)_tileWidth, (Int32)_tileWidth * 5),
PointF pos = new((Single)(_tileMargin + x), (Single)(_tileMargin + y));
SizeF size = new(r.Next((Int32)_tileWidth, (Int32)_tileWidth * 5),
r.Next((Int32)_tileHeight, (Int32)_tileHeight * 5));
TestShapeType type = (TestShapeType)r.Next(0, (Int32)TestShapeType.Last);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

<ItemGroup>
<PackageReference Include="Dirkster.ColorPickerLib" Version="1.6.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.3" />
<PackageReference Include="System.Text.Json" Version="9.0.3" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.2" />
<PackageReference Include="System.Text.Json" Version="10.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

<ItemGroup>
<PackageReference Include="Dirkster.ColorPickerLib" Version="1.6.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.3" />
<PackageReference Include="System.Text.Json" Version="9.0.3" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.2" />
<PackageReference Include="System.Text.Json" Version="10.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class ThemeHelper
/// <returns></returns>
public IDictionary<String, SolidColorBrush> GetBrushes()
{
SortedDictionary<String, SolidColorBrush> results = new SortedDictionary<String, SolidColorBrush>();
SortedDictionary<String, SolidColorBrush> results = [];

// Get theme dict
ResourceDictionary theme = CurrentThemeDictionary;
Expand Down Expand Up @@ -71,7 +71,7 @@ public String ExportString()
throw new InvalidOperationException("CurrentThemeDictionary");
}

StringBuilder export = new StringBuilder();
StringBuilder export = new();
export.AppendLine("<ResourceDictionary");
export.AppendLine(" xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"");
export.AppendLine(" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public System.Drawing.Color BaseColor
baseColor = value;

// use hls color for shading
HlsColor hls = new HlsColor(baseColor);
HlsColor hls = new(baseColor);
System.Drawing.Color c1 = hls.Darker(0.25f);
System.Drawing.Color c2 = hls.Lighter(0.25f);

Expand Down Expand Up @@ -125,18 +125,18 @@ public Object CreateVisual(IMesVirtualCanvasControl parent)
{
case TestShapeType.Curve:
{
PathGeometry g = new PathGeometry();
PathFigure f = new PathFigure
PathGeometry g = new();
PathFigure f = new()
{
StartPoint = _points[0]
};
g.Figures.Add(f);
for (Int32 i = 0, n = _points.Length; i < n; i += 3)
{
BezierSegment s = new BezierSegment(_points[i], _points[i + 1], _points[i + 2], true);
BezierSegment s = new(_points[i], _points[i + 1], _points[i + 2], true);
f.Segments.Add(s);
}
Path p = new Path
Path p = new()
{
Data = g,

Expand All @@ -154,9 +154,9 @@ public Object CreateVisual(IMesVirtualCanvasControl parent)
}
case TestShapeType.Ellipse:
{
Canvas c = new Canvas();
Canvas c = new();

Ellipse e = new Ellipse();
Ellipse e = new();
c.Width = e.Width = _bounds.Width;
c.Height = e.Height = _bounds.Height;
c.Children.Add(e);
Expand All @@ -165,7 +165,7 @@ public Object CreateVisual(IMesVirtualCanvasControl parent)
Double x = (_bounds.Width - s.Width) / 2;
Double y = (_bounds.Height - s.Height) / 2;

TextBlock text = new TextBlock
TextBlock text = new()
{
Text = Label
};
Expand All @@ -187,13 +187,13 @@ public Object CreateVisual(IMesVirtualCanvasControl parent)
}
case TestShapeType.Rectangle:
{
Border b = new Border
Border b = new()
{
CornerRadius = new CornerRadius(3),
Width = _bounds.Width,
Height = _bounds.Height
};
TextBlock text = new TextBlock
TextBlock text = new()
{
Text = Label,
VerticalAlignment = VerticalAlignment.Center,
Expand Down Expand Up @@ -241,7 +241,7 @@ public Size MeasureText(IMesVirtualCanvasControl parent, String label)
_typeface = new Typeface(fontFamily, fontStyle, fontWeight, fontStretch);
_parent = parent;
}
FormattedText ft = new FormattedText(label, CultureInfo.CurrentUICulture,
FormattedText ft = new(label, CultureInfo.CurrentUICulture,
FlowDirection.LeftToRight, _typeface, _fontSize, Brushes.Black);
return new Size(ft.Width, ft.Height);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private void Export_Click(Object sender, RoutedEventArgs e)
MessageBox.Show("Select a theme to export");
return;
}
SaveFileDialog saveFile = new SaveFileDialog
SaveFileDialog saveFile = new()
{
InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
Filter = "Resource Dictionary (*.xaml)|*.xaml",
Expand Down Expand Up @@ -132,7 +132,7 @@ private void Search_Click(Object sender, RoutedEventArgs e)
IEnumerable<KeyValuePair<String, SolidColorBrush>> select = brushes
.Where(x => x.Key.ToLower().Contains(search.Text.ToLower()));

SortedDictionary<String, SolidColorBrush> result = new SortedDictionary<String, SolidColorBrush>();
SortedDictionary<String, SolidColorBrush> result = [];
foreach (KeyValuePair<String, SolidColorBrush> item in select) { result[item.Key] = item.Value; }

UpdateList(result);
Expand Down
4 changes: 2 additions & 2 deletions Demos/MinoriDemo/MinoriDemo.WPF/MinoriDemo.WPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.3" />
<PackageReference Include="System.Text.Json" Version="9.0.3" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.2" />
<PackageReference Include="System.Text.Json" Version="10.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Demos/MinoriDemo/MinoriDemo.Wpf/MinoriDemo.Wpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.3" />
<PackageReference Include="System.Text.Json" Version="9.0.3" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.2" />
<PackageReference Include="System.Text.Json" Version="10.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Demos/SimpleDemo/SimpleDemo.Core/SimpleDemo.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MvvmCross" Version="9.3.1" />
<PackageReference Include="MvvmCross.Plugin.Messenger" Version="9.3.1" />
<PackageReference Include="MvvmCross" Version="10.1.2" />
<PackageReference Include="MvvmCross.Plugin.Messenger" Version="10.1.2" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.3" />
<PackageReference Include="System.Text.Json" Version="9.0.3" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.2" />
<PackageReference Include="System.Text.Json" Version="10.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.3" />
<PackageReference Include="System.Text.Json" Version="9.0.3" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.2" />
<PackageReference Include="System.Text.Json" Version="10.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions Demos/SimpleDemo/SimpleDemo.WPF/SimpleDemo.WPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.3" />
<PackageReference Include="MvvmCross.Platforms.Wpf" Version="9.3.1" />
<PackageReference Include="System.Text.Json" Version="9.0.3" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.2" />
<PackageReference Include="MvvmCross.Platforms.Wpf" Version="10.1.2" />
<PackageReference Include="System.Text.Json" Version="10.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions Demos/SimpleDemo/SimpleDemo.Wpf/SimpleDemo.Wpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.3" />
<PackageReference Include="MvvmCross.Platforms.Wpf" Version="9.3.1" />
<PackageReference Include="System.Text.Json" Version="9.0.3" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="10.0.2" />
<PackageReference Include="MvvmCross.Platforms.Wpf" Version="10.1.2" />
<PackageReference Include="System.Text.Json" Version="10.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,15 @@ private static void OnContentChanged(DependencyObject d, DependencyPropertyChang

if (e.OldValue != null)
{
if (hwndHost._source != null)
{
hwndHost._source.RootVisual = null;
}
hwndHost._source?.RootVisual = null;

hwndHost.RemoveLogicalChild(e.OldValue);
}

if (e.NewValue != null)
{
hwndHost.AddLogicalChild(e.NewValue);
if (hwndHost._source != null)
{
hwndHost._source.RootVisual = (Visual)e.NewValue;
}
hwndHost._source?.RootVisual = (Visual)e.NewValue;
}
}

Expand All @@ -59,7 +53,7 @@ protected override IEnumerator LogicalChildren

protected override HandleRef BuildWindowCore(HandleRef hwndParent)
{
HwndSourceParameters param = new HwndSourceParameters("MinoriEditorStudioClippingHwndHost", (Int32)Width, (Int32)Height)
HwndSourceParameters param = new("MinoriEditorStudioClippingHwndHost", (Int32)Width, (Int32)Height)
{
ParentWindow = hwndParent.Handle,
WindowStyle = NativeMethods.WS_VISIBLE | NativeMethods.WS_CHILD,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public static class MesHwndMouse
{
public static Point GetCursorPosition()
{
NativeMethods.NativePoint point = new NativeMethods.NativePoint();
NativeMethods.NativePoint point = new();
NativeMethods.GetCursorPos(ref point);
return new Point(point.X, point.Y);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public abstract class MesHwndWrapper : HwndHost
private Point _previousPosition;

// Track the mouse state
private readonly MesHwndMouseState _mouseState = new MesHwndMouseState();
private readonly MesHwndMouseState _mouseState = new();

// Tracking whether we've "capture" the mouse
private bool _isMouseCaptured;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private static LayoutAnchorablePane CreateAnchorablePane(LayoutRoot layout, Orie
String paneName, InsertPosition position)
{
LayoutPanel parent = layout.Descendents().OfType<LayoutPanel>().First(d => d.Orientation == orientation);
LayoutAnchorablePane toolsPane = new LayoutAnchorablePane { Name = paneName };
LayoutAnchorablePane toolsPane = new() { Name = paneName };
if (position == InsertPosition.Start)
{
parent.InsertChildAt(0, toolsPane);
Expand Down
16 changes: 7 additions & 9 deletions Modules/MinoriEditorShell.Platforms.Wpf/Core/MesWpfSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@ public abstract class MesWpfSetup : MvxWpfSetup
/// </summary>
/// <param name="root">Control of the main windows for wpf</param>
/// <returns></returns>
protected override IMvxWpfViewPresenter CreateViewPresenter(ContentControl root)
{
protected override IMvxWpfViewPresenter CreateViewPresenter(ContentControl root) =>
// This handles main window.
return new MesWpfPresenter(root);
}
new MesWpfPresenter(root);

/// <summary>
/// Load any additional plugins, calling parent
Expand Down Expand Up @@ -117,7 +115,7 @@ public override void InitializeSecondary() {
_messenger = Mvx.IoCProvider.Resolve<MvvmCross.Plugin.Messenger.IMvxMessenger>();
Properties.Settings.Default.PropertyChanged += (s, e) =>
{
MesSettingsChangedMessage message = new MesSettingsChangedMessage(
MesSettingsChangedMessage message = new(
s, e.PropertyName,
Properties.Settings.Default.PropertyValues[e.PropertyName]);
_messenger.Publish(message);
Expand All @@ -127,12 +125,12 @@ public override void InitializeSecondary() {
public abstract class MesWpfSetup<TApplication> : MesWpfSetup where TApplication : class, IMvxApplication, new()
{
protected override IMvxApplication CreateApp(IMvxIoCProvider iocProvider) => iocProvider.IoCConstruct<TApplication>();
public override IEnumerable<Assembly> GetViewModelAssemblies() => new[] { typeof(TApplication).GetTypeInfo().Assembly };
public override IEnumerable<Assembly> GetViewModelAssemblies() => [typeof(TApplication).GetTypeInfo().Assembly];
}

///// <summary>
///// By default, we are configured to use MEF
///// </summary>
/// <summary>
/// By default, we are configured to use MEF
/// </summary>
//protected override void Configure()
//{
// // Add all assemblies to AssemblySource (using a temporary DirectoryCatalog).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public override void CanClose(System.Action<bool> callback)
}
#endif

private void UpdateDisplayName() => DisplayName = (IsDirty) ? FileName + "*" : FileName;
private void UpdateDisplayName() => DisplayName = IsDirty ? FileName + "*" : FileName;

public async Task New(String fileName)
{
Expand Down
Loading
Loading