Commit d5b75707 by liulongfei

1. NDI流IP获取逻辑调整

2. 单窗口全屏模式切换
parent 8c7fba49
......@@ -28,4 +28,30 @@
</Setter>
</Style>
<Style x:Key="CheckBox_One_Four" TargetType="CheckBox">
<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="CheckBox">
<Grid x:Name="bd" SnapsToDevicePixels="True" Background="Transparent" >
<Image x:Name="img_hide" Width="24" Height="24" VerticalAlignment="Center" HorizontalAlignment="Center"
Source="/VIZ.H2V.Module.Resource;component/Icons/full_four_24x24.png" Visibility="Visible"></Image>
<Image x:Name="img_show" Width="24" Height="24" VerticalAlignment="Center" HorizontalAlignment="Center"
Source="/VIZ.H2V.Module.Resource;component/Icons/full_one_24x24.png" Visibility="Hidden"></Image>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="img_hide" Property="Visibility" Value="Hidden"></Setter>
<Setter TargetName="img_show" Property="Visibility" Value="Visible"></Setter>
</Trigger>
<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
......@@ -266,5 +266,11 @@
<ItemGroup>
<Resource Include="Icons\touch_32x32.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Icons\full_one_24x24.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Icons\full_four_24x24.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
......@@ -45,6 +45,10 @@
<!-- 顶部 -->
<TextBox x:Name="tbFocus" Visibility="Collapsed"></TextBox>
<Grid Background="#ff12202d">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<CheckBox Height="30" Style="{StaticResource CheckBox_One_Four}" ToolTip="窗口模式"
IsChecked="{Binding Path=IsOneScreenMode,Mode=TwoWay}"></CheckBox>
</StackPanel>
<TextBlock Text="横转竖智能裁切系统" FontSize="12" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock>
<StackPanel Orientation="Horizontal" Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Top">
<CheckBox Height="30" Style="{StaticResource ResourceKey=CheckBox_Eye}"
......@@ -73,10 +77,11 @@
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<local:NDIView NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_1}" Grid.Row="0" Grid.Column="0" Margin="10,10,15,10"></local:NDIView>
<local:NDIView NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_2}" Grid.Row="0" Grid.Column="1" Margin="15,10,10,10"></local:NDIView>
<local:NDIView NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_3}" Grid.Row="1" Grid.Column="0" Margin="10,10,15,10"></local:NDIView>
<local:NDIView NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_4}" Grid.Row="1" Grid.Column="1" Margin="15,10,10,10"></local:NDIView>
<local:NDIView x:Name="cam2" NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_2}" Grid.Row="0" Grid.Column="1" Margin="15,10,10,10"></local:NDIView>
<local:NDIView x:Name="cam3" NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_3}" Grid.Row="1" Grid.Column="0" Margin="10,10,15,10"></local:NDIView>
<local:NDIView x:Name="cam4" NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_4}" Grid.Row="1" Grid.Column="1" Margin="15,10,10,10"></local:NDIView>
<!-- CAM_1 会作为单一窗口时的主窗口 -->
<local:NDIView x:Name="cam1" NDIKey="{x:Static Member=domain:NDIViewKeys.CAM_1}" Grid.Row="0" Grid.Column="0" Margin="10,10,15,10"></local:NDIView>
</Grid>
<!-- 底部 -->
<Border Grid.Row="2" Background="#ff12202d">
......
......@@ -15,6 +15,7 @@ using Gma.System.MouseKeyHook;
using System.Windows.Interop;
using log4net;
using System.Threading;
using System.Windows.Controls;
namespace VIZ.H2V.Module
{
......@@ -241,6 +242,50 @@ namespace VIZ.H2V.Module
#endregion
#region IsOneScreenMode -- 是否是单窗口模式
private bool isOneScreenMode;
/// <summary>
/// 是否是单窗口模式
/// </summary>
public bool IsOneScreenMode
{
get { return isOneScreenMode; }
set
{
isOneScreenMode = value;
this.RaisePropertyChanged(nameof(IsOneScreenMode));
this.ChangeScreenMode();
}
}
/// <summary>
/// 切换视图模式
/// </summary>
private void ChangeScreenMode()
{
NDIMainView view = this.GetView<NDIMainView>();
if (view == null)
return;
if (this.IsOneScreenMode)
{
view.cam1.SetValue(Grid.RowSpanProperty, 2);
view.cam1.SetValue(Grid.ColumnSpanProperty, 2);
}
else
{
view.cam1.SetValue(Grid.RowSpanProperty, 1);
view.cam1.SetValue(Grid.ColumnSpanProperty, 1);
}
SystemConfig config = ApplicationDomainEx.LiteDbContext.SystemConfig.FindAll().FirstOrDefault();
config.IsOneScreenMode = this.IsOneScreenMode;
ApplicationDomainEx.LiteDbContext.SystemConfig.Update(config);
}
#endregion
// ======================================================================================
// === Command ===
// ======================================================================================
......@@ -552,6 +597,8 @@ namespace VIZ.H2V.Module
this.isShowAlgorithmTargetBox = config.IsShowAlgorithmTargetBox;
this.RaisePropertyChanged(nameof(IsShowAlgorithmTargetBox));
this.IsOneScreenMode = config.IsOneScreenMode;
}
}
}
......@@ -341,7 +341,6 @@ namespace VIZ.H2V.Module
int delay = this.SelectedNDIDelayInfo == null ? 0 : this.SelectedNDIDelayInfo.Value;
// 保存配置
this.ViewConfig.StreamAddress = streamAddress;
this.ViewConfig.DisplayName = this.NdiDispalyName;
this.ViewConfig.StreamName = streamName;
this.ViewConfig.DelayFrame = delay;
......
......@@ -444,7 +444,27 @@ namespace VIZ.H2V.Module
{
clientIP = NetHelper.GetLocalFirstIPv4Address();
}
string streamIP = (this.Support.ViewConfig.StreamAddress ?? string.Empty).Split(':').FirstOrDefault()?.Trim();
// 从配置文件中获取流的目标
string streamIP = null;
NDIStream ndiStream = VideoStreamManager.Get<NDIStream>(this.Support.ViewKey);
// 尝试5次从流信息中获取流的IP
int count = 0;
while (count < 5 && !string.IsNullOrWhiteSpace(this.Support.ViewConfig.StreamName))
{
NDIStreamInfo streamInfo = ndiStream.StreamInfos.FirstOrDefault(p => p.FullName == this.Support.ViewConfig.StreamName);
if (streamInfo == null)
{
System.Threading.Thread.Sleep(1000);
++count;
continue;
}
streamIP = (streamInfo.Address ?? string.Empty).Split(':').FirstOrDefault()?.Trim();
break;
}
AlgorithmStrategy strategy = ApplicationDomainEx.CsvContext.AlgorithmStrategys.FirstOrDefault(p => p.Type == this.Support.ViewConfig.StrategyType);
if (strategy == null)
......
......@@ -12,7 +12,7 @@
xmlns:storage="clr-namespace:VIZ.H2V.Storage;assembly=VIZ.H2V.Storage"
xmlns:resource="clr-namespace:VIZ.H2V.Module.Resource;assembly=VIZ.H2V.Module.Resource"
d:DataContext="{d:DesignInstance Type=local:NDIViewModel}"
x:Name="uc"
x:Name="uc" Background="#ff172532"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="1000">
<UserControl.Resources>
......
......@@ -147,7 +147,7 @@ namespace VIZ.H2V.Module
/// </summary>
private void Loaded_InitModeChecked()
{
// 跟下模式属性
// 更新模式属性
this.UpdateModeProperty();
// 重启算法
......
......@@ -11,6 +11,7 @@ using VIZ.Framework.Storage;
using VIZ.H2V.Domain;
using VIZ.H2V.Storage;
using VIZ.H2V.Common;
using TDx.SpaceMouse.Navigation3D;
namespace VIZ.H2V.Module
{
......
......@@ -17,7 +17,7 @@ namespace VIZ.H2V.Storage
/// <summary>
/// UDP本机绑定IP
/// </summary>
[Ini(Section = "UDP", DefaultValue = "127.0.0.1", Type = typeof(string))]
[Ini(Section = "UDP", DefaultValue = "", Type = typeof(string))]
public string UDP_BINDING_IP { get; set; }
/// <summary>
......
......@@ -29,11 +29,6 @@ namespace VIZ.H2V.Storage
public string DisplayName { get; set; }
/// <summary>
/// NDI流地址
/// </summary>
public string StreamAddress { get; set; }
/// <summary>
/// NDI流名称
/// </summary>
public string StreamName { get; set; }
......
......@@ -81,6 +81,11 @@ namespace VIZ.H2V.Storage
public bool IsShowAlgorithmTargetBox { get; set; } = true;
/// <summary>
/// 是否是单视图模式
/// </summary>
public bool IsOneScreenMode { get; set; } = false;
/// <summary>
/// Tally信息 -- 窗口1
/// </summary>
public TallyInfo TallyInfo1 { get; set; } = new TallyInfo();
......
......@@ -43,7 +43,8 @@ namespace VIZ.H2V.UdpTestTool
UdpConnection conn = new UdpConnection();
conn.PackageProvider = new ConnSingleJsonPackageProvider();
string clientIP = ApplicationDomain.IniStorage.GetValue<UdpConfig, string>(p => p.UDP_BINDING_IP);
//string clientIP = ApplicationDomain.IniStorage.GetValue<UdpConfig, string>(p => p.UDP_BINDING_IP);
string clientIP = NetHelper.GetLocalFirstIPv4Address();
int clientPort = ApplicationDomain.IniStorage.GetValue<UdpConfig, int>(p => p.UDP_BINDING_PORT);
log.Info($"{DateTime.Now} -- ip: {clientIP}, port: {UdpTestApplicationDomain.Port}");
......
......@@ -63,8 +63,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VIZ.H2V.Common", "VIZ.H2V.C
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VIZ.Framework.MacTool", "..\VIZ.Framework\VIZ.Framework.MacTool\VIZ.Framework.MacTool.csproj", "{6B864E7B-164B-4B1E-B7D6-1563D824F567}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VIZ.H2V.ClipTestTool", "VIZ.H2V.ClipTestTool\VIZ.H2V.ClipTestTool.csproj", "{16CDC661-A7D8-49DA-A269-0F9F4E798977}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VIZ.Framework.Core.Navigation3D", "..\VIZ.Framework\VIZ.Framework.Core.Navigation3D\VIZ.Framework.Core.Navigation3D.vcxproj", "{D1AA6399-2000-42BA-A577-D50BC5FCA393}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "03-Driver", "03-Driver", "{EA9A2679-B43B-4D2C-A418-6CA223D55104}"
......@@ -307,18 +305,6 @@ Global
{6B864E7B-164B-4B1E-B7D6-1563D824F567}.Release|x64.Build.0 = Release|x64
{6B864E7B-164B-4B1E-B7D6-1563D824F567}.Release|x86.ActiveCfg = Release|Any CPU
{6B864E7B-164B-4B1E-B7D6-1563D824F567}.Release|x86.Build.0 = Release|Any CPU
{16CDC661-A7D8-49DA-A269-0F9F4E798977}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{16CDC661-A7D8-49DA-A269-0F9F4E798977}.Debug|Any CPU.Build.0 = Debug|Any CPU
{16CDC661-A7D8-49DA-A269-0F9F4E798977}.Debug|x64.ActiveCfg = Debug|x64
{16CDC661-A7D8-49DA-A269-0F9F4E798977}.Debug|x64.Build.0 = Debug|x64
{16CDC661-A7D8-49DA-A269-0F9F4E798977}.Debug|x86.ActiveCfg = Debug|Any CPU
{16CDC661-A7D8-49DA-A269-0F9F4E798977}.Debug|x86.Build.0 = Debug|Any CPU
{16CDC661-A7D8-49DA-A269-0F9F4E798977}.Release|Any CPU.ActiveCfg = Release|Any CPU
{16CDC661-A7D8-49DA-A269-0F9F4E798977}.Release|Any CPU.Build.0 = Release|Any CPU
{16CDC661-A7D8-49DA-A269-0F9F4E798977}.Release|x64.ActiveCfg = Release|Any CPU
{16CDC661-A7D8-49DA-A269-0F9F4E798977}.Release|x64.Build.0 = Release|Any CPU
{16CDC661-A7D8-49DA-A269-0F9F4E798977}.Release|x86.ActiveCfg = Release|Any CPU
{16CDC661-A7D8-49DA-A269-0F9F4E798977}.Release|x86.Build.0 = Release|Any CPU
{D1AA6399-2000-42BA-A577-D50BC5FCA393}.Debug|Any CPU.ActiveCfg = Debug|x64
{D1AA6399-2000-42BA-A577-D50BC5FCA393}.Debug|Any CPU.Build.0 = Debug|x64
{D1AA6399-2000-42BA-A577-D50BC5FCA393}.Debug|x64.ActiveCfg = Debug|x64
......@@ -355,7 +341,6 @@ Global
{8FC38D2A-D2E5-44D0-86E4-7136A6D19F2E} = {13A90A3F-66CC-445C-9900-39A23DA82C40}
{750ECE65-60DD-425A-B1D3-68E5158B6E9B} = {CB121805-63D4-4D8E-9F37-2C3CDE7733D1}
{6B864E7B-164B-4B1E-B7D6-1563D824F567} = {13A90A3F-66CC-445C-9900-39A23DA82C40}
{16CDC661-A7D8-49DA-A269-0F9F4E798977} = {13A90A3F-66CC-445C-9900-39A23DA82C40}
{D1AA6399-2000-42BA-A577-D50BC5FCA393} = {22C4088C-4CB2-488E-A7EE-102116434C09}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
......
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