mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-16 06:06:36 +08:00
截屏嵌入,查找待优化
This commit is contained in:
@@ -109,6 +109,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AIStudio.Wpf.ComeCapture" Version="1.1.0" />
|
||||
<PackageReference Include="Costura.Fody" Version="5.7.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
||||
@@ -377,6 +377,15 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
|
||||
return this._aboutCommand ?? (this._aboutCommand = new DelegateCommand(() => this.AboutExecuted()));
|
||||
}
|
||||
}
|
||||
|
||||
private ICommand _screenshotCommand;
|
||||
public ICommand ScreenshotCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._screenshotCommand ?? (this._screenshotCommand = new DelegateCommand(() => this.ScreenshotExecuted()));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
public ItemActionCallback ClosingTabItemHandler
|
||||
@@ -676,6 +685,12 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
|
||||
aboutWindow.ShowDialog();
|
||||
}
|
||||
|
||||
private void ScreenshotExecuted()
|
||||
{
|
||||
AIStudio.Wpf.ComeCapture.MainWindow window = new AIStudio.Wpf.ComeCapture.MainWindow();
|
||||
window.Show();
|
||||
}
|
||||
|
||||
#region 方法
|
||||
private Color[] GenerateStandardGradients()
|
||||
{
|
||||
|
||||
@@ -1465,47 +1465,7 @@
|
||||
Width="190" />
|
||||
</Fluent:SplitButton.ToolTip>
|
||||
</Fluent:SplitButton>
|
||||
</Fluent:RibbonGroupBox>
|
||||
<Fluent:RibbonGroupBox Header="其它"
|
||||
IsLauncherVisible="True" >
|
||||
<Fluent:Button Header="搜索" Width="50" VerticalAlignment="Top" Command="{Binding PageViewModel.DiagramViewModel.SearchDownCommand}">
|
||||
<Fluent:Button.LargeIcon>
|
||||
<iconPacks:PackIconFontAwesome Kind="SearchSolid" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
</Fluent:Button.LargeIcon>
|
||||
</Fluent:Button>
|
||||
<Border BorderBrush="Gray" BorderThickness="1" CornerRadius="3" VerticalAlignment="Top" Margin="0,8,0,0">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="24"/>
|
||||
<RowDefinition Height="24"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox x:Name="txtsearch" Text="{Binding PageViewModel.DiagramViewModel.SearchText}" VerticalContentAlignment="Center" BorderThickness="0" Background="Transparent">
|
||||
<TextBox.InputBindings>
|
||||
<KeyBinding Key="Enter" Command="{Binding PageViewModel.DiagramViewModel.SearchDownCommand}" CommandParameter="{Binding ElementName=txtsearch,Path=Text}"/>
|
||||
</TextBox.InputBindings>
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="LostFocus">
|
||||
<i:InvokeCommandAction Command="{Binding PageViewModel.DiagramViewModel.SearchDownCommand}" CommandParameter="{Binding ElementName=txtsearch,Path=Text}"/>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</TextBox>
|
||||
<Line X1="0" Y1="0" X2="0" Y2="100" Stroke="Gray" StrokeThickness="0.5" HorizontalAlignment="Right"></Line>
|
||||
<Button Grid.Column="1" Padding="6,0" Style="{StaticResource FlatButtonStyle}" Command="{Binding PageViewModel.DiagramViewModel.SearchUpCommand}" CommandParameter="{Binding ElementName=txtsearch,Path=Text}">
|
||||
<Path Width="10" Height="10" Stretch="Uniform" Fill="Black" Data="M17,13.41,12.71,9.17a1,1,0,0,0-1.42,0L7.05,13.41a1,1,0,0,0,0,1.42,1,1,0,0,0,1.41,0L12,11.29l3.54,3.54a1,1,0,0,0,.7.29,1,1,0,0,0,.71-.29A1,1,0,0,0,17,13.41Z"></Path>
|
||||
</Button>
|
||||
<Button Grid.Column="2" Padding="6,0" Style="{StaticResource FlatButtonStyle}" Command="{Binding PageViewModel.DiagramViewModel.SearchDownCommand}" CommandParameter="{Binding ElementName=txtsearch,Path=Text}">
|
||||
<Path Width="10" Height="10" Stretch="Uniform" Fill="Black" Data="M17,9.17a1,1,0,0,0-1.41,0L12,12.71,8.46,9.17a1,1,0,0,0-1.41,0,1,1,0,0,0,0,1.42l4.24,4.24a1,1,0,0,0,1.42,0L17,10.59A1,1,0,0,0,17,9.17Z"></Path>
|
||||
</Button>
|
||||
<Line X1="0" Y1="0" X2="150" Y2="0" Stroke="Gray" StrokeThickness="0.5" VerticalAlignment="Bottom" Grid.ColumnSpan="3"></Line>
|
||||
<TextBlock Grid.Row="1" Grid.ColumnSpan="3" Margin="2,0,0,0" VerticalAlignment="Center" Text="{Binding PageViewModel.DiagramViewModel.SearchInfo}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Fluent:RibbonGroupBox>
|
||||
</Fluent:RibbonGroupBox>
|
||||
</Fluent:RibbonTabItem>
|
||||
<Fluent:RibbonTabItem Header="页面布局">
|
||||
<Fluent:RibbonGroupBox Header="页面"
|
||||
@@ -2263,7 +2223,12 @@
|
||||
Text="全选"
|
||||
Width="190" />
|
||||
</Fluent:SplitButton.ToolTip>
|
||||
</Fluent:SplitButton>
|
||||
</Fluent:SplitButton>
|
||||
</Fluent:RibbonGroupBox>
|
||||
</Fluent:RibbonTabItem>
|
||||
<Fluent:RibbonTabItem Header="视图">
|
||||
<Fluent:RibbonGroupBox Header="适应窗口"
|
||||
IsLauncherVisible="True" >
|
||||
<Fluent:Button Header="居中" Width="50" VerticalAlignment="Top" Command="{Binding PageViewModel.DiagramViewModel.CenterMoveCommand}">
|
||||
<Fluent:Button.LargeIcon>
|
||||
<iconPacks:PackIconMaterial Kind="ImageFilterCenterFocus" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
@@ -2288,6 +2253,60 @@
|
||||
<Path Width="18" Height="18" Stretch="Uniform" Fill="Black" Data="M819.198 910.218 204.799 910.218c-50.267 0-91.022-40.75-91.022-91.02L113.777 204.822c0-50.29 40.755-91.045 91.022-91.045l614.398 0c50.27 0 91.02 40.755 91.02 91.045l0 614.376C910.218 869.468 869.468 910.218 819.198 910.218zM841.953 227.554c0-25.122-20.385-45.51-45.51-45.51L227.554 182.044c-25.122 0-45.51 20.387-45.51 45.51l0 568.889c0 25.125 20.387 45.535 45.51 45.535l568.889 0c25.125 0 45.51-20.39 45.51-45.535L841.953 227.554zM603.268 400.952l-57.14-57.115 0 335.802 55.505-55.5c13.335-13.31 34.93-13.335 48.265 0 13.33 13.335 13.33 34.95 0 48.29l-105.77 105.765c-1.615 3.415-3.525 6.78-6.37 9.625-7.1 7.08-16.475 10.1-25.76 9.67-9.262 0.46-18.66-2.59-25.76-9.69-2.842-2.85-4.8-6.15-6.347-9.58l-105.79-105.79c-13.335-13.34-13.335-34.955 0-48.29 13.332-13.31 34.927-13.335 48.262 0l55.502 55.5L477.865 343.837l-57.117 57.115c-13.335 13.357-34.952 13.335-48.287 0s-13.335-34.93 0-48.265l115.395-115.37c13.332-13.335 34.927-13.357 48.262 0l115.395 115.37c13.335 13.335 13.335 34.952 0 48.265C638.198 414.286 616.583 414.286 603.268 400.952z"></Path>
|
||||
</Fluent:Button.LargeIcon>
|
||||
</Fluent:Button>
|
||||
</Fluent:RibbonGroupBox>
|
||||
</Fluent:RibbonTabItem>
|
||||
<Fluent:RibbonTabItem Header="高级">
|
||||
<Fluent:RibbonGroupBox Header="查找"
|
||||
IsLauncherVisible="True" >
|
||||
<Fluent:Button Header="搜索" Width="50" VerticalAlignment="Top" Command="{Binding PageViewModel.DiagramViewModel.SearchDownCommand}">
|
||||
<Fluent:Button.LargeIcon>
|
||||
<iconPacks:PackIconFontAwesome Kind="SearchSolid" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
</Fluent:Button.LargeIcon>
|
||||
</Fluent:Button>
|
||||
<Border BorderBrush="Gray" BorderThickness="1" CornerRadius="3" VerticalAlignment="Top" Margin="0,8,0,0">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="24"/>
|
||||
<RowDefinition Height="24"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox x:Name="txtsearch" Text="{Binding PageViewModel.DiagramViewModel.SearchText}" VerticalContentAlignment="Center" BorderThickness="0" Background="Transparent">
|
||||
<TextBox.InputBindings>
|
||||
<KeyBinding Key="Enter" Command="{Binding PageViewModel.DiagramViewModel.SearchDownCommand}" CommandParameter="{Binding ElementName=txtsearch,Path=Text}"/>
|
||||
</TextBox.InputBindings>
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="LostFocus">
|
||||
<i:InvokeCommandAction Command="{Binding PageViewModel.DiagramViewModel.SearchDownCommand}" CommandParameter="{Binding ElementName=txtsearch,Path=Text}"/>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</TextBox>
|
||||
<Line X1="0" Y1="0" X2="0" Y2="100" Stroke="Gray" StrokeThickness="0.5" HorizontalAlignment="Right"></Line>
|
||||
<Button Grid.Column="1" Padding="6,0" Style="{StaticResource FlatButtonStyle}" Command="{Binding PageViewModel.DiagramViewModel.SearchUpCommand}" CommandParameter="{Binding ElementName=txtsearch,Path=Text}">
|
||||
<Path Width="10" Height="10" Stretch="Uniform" Fill="Black" Data="M17,13.41,12.71,9.17a1,1,0,0,0-1.42,0L7.05,13.41a1,1,0,0,0,0,1.42,1,1,0,0,0,1.41,0L12,11.29l3.54,3.54a1,1,0,0,0,.7.29,1,1,0,0,0,.71-.29A1,1,0,0,0,17,13.41Z"></Path>
|
||||
</Button>
|
||||
<Button Grid.Column="2" Padding="6,0" Style="{StaticResource FlatButtonStyle}" Command="{Binding PageViewModel.DiagramViewModel.SearchDownCommand}" CommandParameter="{Binding ElementName=txtsearch,Path=Text}">
|
||||
<Path Width="10" Height="10" Stretch="Uniform" Fill="Black" Data="M17,9.17a1,1,0,0,0-1.41,0L12,12.71,8.46,9.17a1,1,0,0,0-1.41,0,1,1,0,0,0,0,1.42l4.24,4.24a1,1,0,0,0,1.42,0L17,10.59A1,1,0,0,0,17,9.17Z"></Path>
|
||||
</Button>
|
||||
<Line X1="0" Y1="0" X2="150" Y2="0" Stroke="Gray" StrokeThickness="0.5" VerticalAlignment="Bottom" Grid.ColumnSpan="3"></Line>
|
||||
<TextBlock Grid.Row="1" Grid.ColumnSpan="3" Margin="2,0,0,0" VerticalAlignment="Center" Text="{Binding PageViewModel.DiagramViewModel.SearchInfo}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Fluent:RibbonGroupBox>
|
||||
<Fluent:RibbonGroupBox Header="其他">
|
||||
<Fluent:Button Header="截屏" Width="50" VerticalAlignment="Top" Command="{Binding ScreenshotCommand}">
|
||||
<Fluent:Button.LargeIcon>
|
||||
<Path Width="18" Height="18" Stretch="Uniform" Fill="Black" Data="M810.666667 597.333333h-85.333334v128h-128v85.333334h128v128h85.333334v-128h128v-85.333334h-128zM128 768a42.666667 42.666667 0 0 0 42.666667 42.666667h128v-85.333334H213.333333v-85.333333H128v128zM810.666667 170.666667a42.666667 42.666667 0 0 0-42.666667-42.666667h-128v85.333333h85.333333v85.333334h85.333334V170.666667zM213.333333 213.333333h85.333334V128H170.666667a42.666667 42.666667 0 0 0-42.666667 42.666667v128h85.333333V213.333333zM128 384h85.333333v170.666667H128z m597.333333 0h85.333334v128h-85.333334zM384 128h170.666667v85.333333H384z m0 597.333333h128v85.333334H384z"/>
|
||||
</Fluent:Button.LargeIcon>
|
||||
<Fluent:Button.ToolTip>
|
||||
<Fluent:ScreenTip Title="Screen"
|
||||
Text="截屏"
|
||||
Width="190" />
|
||||
</Fluent:Button.ToolTip>
|
||||
</Fluent:Button>
|
||||
</Fluent:RibbonGroupBox>
|
||||
</Fluent:RibbonTabItem>
|
||||
<Fluent:RibbonTabItem Header="帮助">
|
||||
|
||||
@@ -188,7 +188,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
(this.ScrollViewer.ViewportHeight * fitViewModel.PaddingRate) / fitViewModel.BoundingRect.Height
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
double xOffset, yOffset;
|
||||
xOffset = fitViewModel.BoundingRect.Left * ZoomValue - (this.ScrollViewer.ViewportWidth - fitViewModel.BoundingRect.Width * ZoomValue) / 2;
|
||||
yOffset = fitViewModel.BoundingRect.Top * ZoomValue - (this.ScrollViewer.ViewportHeight - fitViewModel.BoundingRect.Height * ZoomValue) / 2;
|
||||
@@ -240,6 +240,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
|
||||
}
|
||||
|
||||
private static object thisLock = new Object();
|
||||
private void ZoomSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||
{
|
||||
double scale = e.NewValue / e.OldValue;
|
||||
|
||||
@@ -214,7 +214,7 @@
|
||||
Maximum="{Binding MaximumZoomValue,RelativeSource={RelativeSource Mode=TemplatedParent},Mode=TwoWay}"
|
||||
SmallChange="0.25"
|
||||
LargeChange="0.25"
|
||||
Value="{Binding ZoomValue,RelativeSource={RelativeSource Mode=TemplatedParent},Mode=TwoWay}"
|
||||
Value="{Binding ZoomValue,RelativeSource={RelativeSource Mode=TemplatedParent},Mode=TwoWay,Delay=500}"
|
||||
IsSnapToTickEnabled="True"
|
||||
IsMoveToPointEnabled="False" />
|
||||
|
||||
|
||||
@@ -424,7 +424,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
}
|
||||
|
||||
private double _minimumZoomValue = 0.01;
|
||||
private double _minimumZoomValue = 0.1;
|
||||
[Browsable(false)]
|
||||
public double MinimumZoomValue
|
||||
{
|
||||
@@ -2669,17 +2669,26 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
#region 适应大小
|
||||
private void ExecuteFitAutoCommand(object parameter)
|
||||
{
|
||||
FitViewModel = new FitViewModel() { BoundingRect = DiagramViewModelHelper.GetBoundingRectangle(Items.OfType<DesignerItemViewModelBase>()), FitMode = FitMode.FitAuto };
|
||||
if (Items.Any())
|
||||
{
|
||||
FitViewModel = new FitViewModel() { BoundingRect = DiagramViewModelHelper.GetBoundingRectangle(Items.OfType<DesignerItemViewModelBase>()), FitMode = FitMode.FitAuto };
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecuteFitWidthCommand(object parameter)
|
||||
{
|
||||
FitViewModel = new FitViewModel() { BoundingRect = DiagramViewModelHelper.GetBoundingRectangle(Items.OfType<DesignerItemViewModelBase>()), FitMode = FitMode.FitWidth };
|
||||
if (Items.Any())
|
||||
{
|
||||
FitViewModel = new FitViewModel() { BoundingRect = DiagramViewModelHelper.GetBoundingRectangle(Items.OfType<DesignerItemViewModelBase>()), FitMode = FitMode.FitWidth };
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecuteFitHeightCommand(object parameter)
|
||||
{
|
||||
FitViewModel = new FitViewModel() { BoundingRect = DiagramViewModelHelper.GetBoundingRectangle(Items.OfType<DesignerItemViewModelBase>()), FitMode = FitMode.FitHeight };
|
||||
if (Items.Any())
|
||||
{
|
||||
FitViewModel = new FitViewModel() { BoundingRect = DiagramViewModelHelper.GetBoundingRectangle(Items.OfType<DesignerItemViewModelBase>()), FitMode = FitMode.FitHeight };
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -2884,8 +2893,8 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
Dictionary<SelectableDesignerItemViewModelBase, Tuple<object, object, object, object>> infos
|
||||
= items.ToDictionary(p => p, p => new Tuple<object, object, object, object>(
|
||||
p.FontViewModel.GetPropertyValue("FontColor"),
|
||||
p.ColorViewModel.GetPropertyValue("FillColor"),
|
||||
p.FontViewModel.GetPropertyValue("FontColor"),
|
||||
p.ColorViewModel.GetPropertyValue("FillColor"),
|
||||
p.ColorViewModel.GetPropertyValue("LineColor"),
|
||||
p.ColorViewModel.GetPropertyValue("LineWidth")));
|
||||
DoCommandManager.DoNewCommand(this.ToString(),
|
||||
|
||||
Reference in New Issue
Block a user