Commit 17170478 by liulongfei

1. 3D鼠标初始化增强

2. 主页添加初始化3D鼠标按钮
parent f19b1f91
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="Button_Navigation3D" TargetType="Button">
<Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter>
<Setter Property="Width" Value="50"></Setter>
<Setter Property="Height" Value="40"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="bd" BorderBrush="Transparent" BorderThickness="1" Background="Transparent">
<Image Width="18" Height="18" HorizontalAlignment="Center" VerticalAlignment="Center"
Source="/VIZ.H2V.Module.Resource;component/Icons/navigation3d_24x24.png"></Image>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="bd" Property="Background" Value="#22ffffff"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
\ No newline at end of file
......@@ -74,6 +74,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Style\Button\Button_WindowTop.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Style\CheckBox\CheckBox_Setting.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
......@@ -201,5 +205,8 @@
<Resource Include="Icons\center_24x24.png" />
<Resource Include="Icons\center_over_24x24.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Icons\navigation3d_24x24.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
......@@ -13,6 +13,7 @@
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/VIZ.H2V.Module.Resource;component/Style/Button/Button_WindowTop.xaml"></ResourceDictionary>
<ResourceDictionary Source="/VIZ.Framework.Common.Resource;component/Style/Button/Button_WindowTop.xaml"></ResourceDictionary>
<ResourceDictionary Source="/VIZ.Framework.Common.Resource;component/Style/ListBox/ListBox_None.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
......@@ -37,9 +38,14 @@
<Grid Background="#ff12202d">
<TextBlock Text="横转竖智能裁切系统" FontSize="12" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock>
<StackPanel Orientation="Horizontal" Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Top">
<Button Command="{Binding Path=SettingCommand}" Style="{StaticResource Button_Setting}" Height="30"></Button>
<Button Command="{Binding Path=MinCommand}" Style="{StaticResource Button_Min}" Height="30"></Button>
<Button Command="{Binding Path=CloseCommand}" Style="{StaticResource Button_Close}" Height="30"></Button>
<Button Command="{Binding Path=InitNavigation3DCommand}" ToolTip="初始化摇杆"
Style="{StaticResource Button_Navigation3D}" Height="30"></Button>
<Button Command="{Binding Path=SettingCommand}" ToolTip="系统设置"
Style="{StaticResource Button_Setting}" Height="30"></Button>
<Button Command="{Binding Path=MinCommand}" ToolTip="最小化"
Style="{StaticResource Button_Min}" Height="30"></Button>
<Button Command="{Binding Path=CloseCommand}" ToolTip="关闭"
Style="{StaticResource Button_Close}" Height="30"></Button>
</StackPanel>
</Grid>
<!-- 主体 -->
......
......@@ -12,6 +12,7 @@ using VIZ.H2V.Storage;
using VIZ.H2V.Domain;
using System.Diagnostics;
using Gma.System.MouseKeyHook;
using System.Windows.Interop;
namespace VIZ.H2V.Module
{
......@@ -56,7 +57,7 @@ namespace VIZ.H2V.Module
this.MinCommand = new VCommand(this.Min);
this.CloseCommand = new VCommand(this.Close);
this.SettingCommand = new VCommand(this.Setting);
this.KeyDownCommand = new VCommand<KeyEventArgs>(this.KeyDown);
this.InitNavigation3DCommand = new VCommand(this.InitNavigation3D);
}
/// <summary>
......@@ -225,22 +226,23 @@ namespace VIZ.H2V.Module
#endregion
#region KeyDownCommand -- 按键命令
#region InitNavigation3DCommand -- 初始化3D鼠标命令
/// <summary>
/// 按键命令
/// 初始化3D鼠标命令
/// </summary>
public VCommand<KeyEventArgs> KeyDownCommand { get; set; }
public VCommand InitNavigation3DCommand { get; set; }
/// <summary>
/// 按键
/// 初始化3D鼠标
/// </summary>
/// <param name="e">按键事件</param>
private void KeyDown(KeyEventArgs e)
private void InitNavigation3D()
{
string hotkey = HotkeyHelper.GetHotkey(e);
Navigation3DHelper.dispose_3D_Mouse();
WindowInteropHelper windowInteropHelper = new WindowInteropHelper(this.GetWindow());
bool result = Navigation3DHelper.init_3D_Mouse(windowInteropHelper.Handle);
Debug.WriteLine(hotkey);
MessageBoxEx.ShowDialog(result ? "摇杆初始化成功!" : "摇杆初始化失败!");
}
#endregion
......
......@@ -82,7 +82,9 @@ namespace VIZ.H2V.Module
Navigation3DMapping mapping = mappingList.FirstOrDefault(p => value >= p.MinValue && value < p.MaxValue);
if (mapping == null)
{
return 0;
}
return (int)(mapping.MappingValue * symbol * ApplicationDomainEx.Navigation3DMapping.Multiple);
}
......
......@@ -39,6 +39,8 @@ namespace VIZ.H2V
AppSetup.AppendLoad(new AppSetup_Monitor());
// 初始化3D鼠标
AppSetup.AppendLoad(new AppSetup_Navigation3D());
// 调试窗口
//AppSetup.AppendLoad(new AppSetup_DebugWindow());
// 执行启动流程
AppSetupContext context = AppSetup.Setup();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment