mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-28 20:23:25 +08:00
zxing.net引用 更新
This commit is contained in:
@@ -127,12 +127,6 @@
|
|||||||
<ProjectReference Include="..\AIStudio.Wpf.SFC\AIStudio.Wpf.SFC.csproj" />
|
<ProjectReference Include="..\AIStudio.Wpf.SFC\AIStudio.Wpf.SFC.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="zxing.core">
|
|
||||||
<HintPath>..\AIStudio.Wpf.DiagramDesigner.Additionals\DLL\zxing.core.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Resource Include="Icons\App.ico" />
|
<Resource Include="Icons\App.ico" />
|
||||||
<Resource Include="Images\AlignObjectsBottom.png" />
|
<Resource Include="Images\AlignObjectsBottom.png" />
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
<PackageReference Include="MahApps.Metro.IconPacks" Version="4.8.0" />
|
<PackageReference Include="MahApps.Metro.IconPacks" Version="4.8.0" />
|
||||||
<PackageReference Include="AIStudio.Wpf.Svg2XamlExtension" Version="1.2.2" />
|
<PackageReference Include="AIStudio.Wpf.Svg2XamlExtension" Version="1.2.2" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||||
|
<PackageReference Include="ZXing.Net" Version="0.16.8" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -31,10 +32,4 @@
|
|||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="zxing.core">
|
|
||||||
<HintPath>DLL\zxing.core.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,20 +1,13 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Navigation;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
using WpfAnimatedGif;
|
using WpfAnimatedGif;
|
||||||
using ZXing;
|
using ZXing;
|
||||||
|
#if !NET5_0_OR_GREATER
|
||||||
using ZXing.Presentation;
|
using ZXing.Presentation;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace AIStudio.Wpf.DiagramDesigner.Additionals.Controls
|
namespace AIStudio.Wpf.DiagramDesigner.Additionals.Controls
|
||||||
{
|
{
|
||||||
@@ -29,7 +22,7 @@ namespace AIStudio.Wpf.DiagramDesigner.Additionals.Controls
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static readonly DependencyProperty TextProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty TextProperty = DependencyProperty.Register(
|
||||||
"Text", typeof(string), typeof(Barcode), new FrameworkPropertyMetadata(
|
nameof(Text), typeof(string), typeof(Barcode), new FrameworkPropertyMetadata(
|
||||||
string.Empty,
|
string.Empty,
|
||||||
FrameworkPropertyMetadataOptions.AffectsMeasure |
|
FrameworkPropertyMetadataOptions.AffectsMeasure |
|
||||||
FrameworkPropertyMetadataOptions.AffectsRender, OnFormattedTextInvalidated));
|
FrameworkPropertyMetadataOptions.AffectsRender, OnFormattedTextInvalidated));
|
||||||
@@ -41,7 +34,7 @@ namespace AIStudio.Wpf.DiagramDesigner.Additionals.Controls
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static readonly DependencyProperty FormatProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty FormatProperty = DependencyProperty.Register(
|
||||||
"Format", typeof(BarcodeFormat), typeof(Barcode), new FrameworkPropertyMetadata(
|
nameof(Format), typeof(BarcodeFormat), typeof(Barcode), new FrameworkPropertyMetadata(
|
||||||
BarcodeFormat.QR_CODE,
|
BarcodeFormat.QR_CODE,
|
||||||
FrameworkPropertyMetadataOptions.AffectsMeasure |
|
FrameworkPropertyMetadataOptions.AffectsMeasure |
|
||||||
FrameworkPropertyMetadataOptions.AffectsRender, OnFormattedTextInvalidated));
|
FrameworkPropertyMetadataOptions.AffectsRender, OnFormattedTextInvalidated));
|
||||||
@@ -53,7 +46,7 @@ namespace AIStudio.Wpf.DiagramDesigner.Additionals.Controls
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static readonly DependencyProperty SizeProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty SizeProperty = DependencyProperty.Register(
|
||||||
"Size", typeof(double), typeof(Barcode), new FrameworkPropertyMetadata(
|
nameof(Size), typeof(double), typeof(Barcode), new FrameworkPropertyMetadata(
|
||||||
512d,
|
512d,
|
||||||
FrameworkPropertyMetadataOptions.AffectsMeasure |
|
FrameworkPropertyMetadataOptions.AffectsMeasure |
|
||||||
FrameworkPropertyMetadataOptions.AffectsRender, OnFormattedTextInvalidated));
|
FrameworkPropertyMetadataOptions.AffectsRender, OnFormattedTextInvalidated));
|
||||||
@@ -65,7 +58,7 @@ namespace AIStudio.Wpf.DiagramDesigner.Additionals.Controls
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static readonly DependencyProperty IconProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty IconProperty = DependencyProperty.Register(
|
||||||
"Icon", typeof(string), typeof(Barcode), new FrameworkPropertyMetadata(null, OnIconChanged));
|
nameof(Icon), typeof(string), typeof(Barcode), new FrameworkPropertyMetadata(null, OnIconChanged));
|
||||||
|
|
||||||
public string Icon
|
public string Icon
|
||||||
{
|
{
|
||||||
@@ -112,6 +105,20 @@ namespace AIStudio.Wpf.DiagramDesigner.Additionals.Controls
|
|||||||
|
|
||||||
private void OnFormattedTextInvalidated()
|
private void OnFormattedTextInvalidated()
|
||||||
{
|
{
|
||||||
|
#if NET5_0_OR_GREATER
|
||||||
|
var writer = new BarcodeWriter<Geometry>()
|
||||||
|
{
|
||||||
|
Format = Format,
|
||||||
|
Options = new ZXing.Common.EncodingOptions
|
||||||
|
{
|
||||||
|
Height = (int)this.Size,
|
||||||
|
Width = (int)this.Size,
|
||||||
|
Margin = 0
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var image = writer.Write(Text ?? "AIStudio画板");
|
||||||
|
imageBarcodeEncoderGeometry.Data = image;
|
||||||
|
#else
|
||||||
var writer = new BarcodeWriterGeometry
|
var writer = new BarcodeWriterGeometry
|
||||||
{
|
{
|
||||||
Format = Format,
|
Format = Format,
|
||||||
@@ -124,6 +131,7 @@ namespace AIStudio.Wpf.DiagramDesigner.Additionals.Controls
|
|||||||
};
|
};
|
||||||
var image = writer.Write(Text ?? "AIStudio画板");
|
var image = writer.Write(Text ?? "AIStudio画板");
|
||||||
imageBarcodeEncoderGeometry.Data = image;
|
imageBarcodeEncoderGeometry.Data = image;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user