Started implementing BrowserOverlay.
This commit is contained in:
parent
3ef6bd79e1
commit
a3d464197d
|
|
@ -6,6 +6,7 @@
|
||||||
xmlns:local="clr-namespace:VRDash"
|
xmlns:local="clr-namespace:VRDash"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
KeyDown="Window_KeyDown"
|
KeyDown="Window_KeyDown"
|
||||||
|
Closing="Window_Closing"
|
||||||
Title="VRDash" Height="700" Width="800">
|
Title="VRDash" Height="700" Width="800">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
|
|
|
||||||
|
|
@ -181,8 +181,20 @@ namespace VRDash
|
||||||
var overlayInfo = attrs.Single(x => x.OverlayType == overlay.GetType());
|
var overlayInfo = attrs.Single(x => x.OverlayType == overlay.GetType());
|
||||||
UI.IOverlayEditor editor = (UI.IOverlayEditor)Activator.CreateInstance(overlayInfo.Info.EditorType, new object[] { overlay.OverlayConfig });
|
UI.IOverlayEditor editor = (UI.IOverlayEditor)Activator.CreateInstance(overlayInfo.Info.EditorType, new object[] { overlay.OverlayConfig });
|
||||||
OverlayEditorInfo overlayEditor = new OverlayEditorInfo(new UI.OverlayEditor(editor), overlay);
|
OverlayEditorInfo overlayEditor = new OverlayEditorInfo(new UI.OverlayEditor(editor), overlay);
|
||||||
IOverlayListViewItem lvi = (IOverlayListViewItem)Activator.CreateInstance(overlayInfo.Info.ListViewType, new object[] { overlayEditor });
|
IOverlayListViewItem lvi = null;
|
||||||
OverlayManager.Overlays.Add(lvi);
|
if (overlayInfo.Info.ListViewType != null)
|
||||||
|
{
|
||||||
|
lvi = (IOverlayListViewItem)Activator.CreateInstance(overlayInfo.Info.ListViewType, new object[] { overlayEditor });
|
||||||
|
OverlayManager.Overlays.Add(lvi);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
this.GetLogger().Warn($"No list view item for {overlayEditor.Overlay.GetType()}!");
|
||||||
|
#else
|
||||||
|
throw new Exception($"No list view item for {overlayEditor.Overlay.GetType()}!");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
};
|
};
|
||||||
w.Content = uc;
|
w.Content = uc;
|
||||||
w.Width = 500;
|
w.Width = 500;
|
||||||
|
|
@ -220,15 +232,24 @@ namespace VRDash
|
||||||
|
|
||||||
private void Window_KeyDown(object sender, KeyEventArgs e)
|
private void Window_KeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
if(e.Key == Key.F1)
|
//if(e.Key == Key.F1)
|
||||||
|
//{
|
||||||
|
// var conf = new MonitorOverlayConfig();
|
||||||
|
// conf.Name = "Test Browser";
|
||||||
|
// conf.Key = "asdfasdf";
|
||||||
|
// conf.Location = new Overlay.Config.OverlayLocation.DashboardLocation();
|
||||||
|
// var overlay = new Overlay.BrowserOverlay(conf);
|
||||||
|
// overlay.Create();
|
||||||
|
// overlay.Show();
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||||
|
{
|
||||||
|
foreach(var overlayLVI in OverlayManager.Overlays)
|
||||||
{
|
{
|
||||||
var conf = new MonitorOverlayConfig();
|
overlayLVI.Dispose();
|
||||||
conf.Name = "Test Browser";
|
overlayLVI.OverlayInfo.Overlay.Dispose();
|
||||||
conf.Key = "asdfasdf";
|
|
||||||
conf.Location = new Overlay.Config.OverlayLocation.DashboardLocation();
|
|
||||||
var overlay = new Overlay.BrowserOverlay(conf);
|
|
||||||
overlay.Create();
|
|
||||||
overlay.Show();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,15 @@
|
||||||
xmlns:local="clr-namespace:VRDash.Overlay"
|
xmlns:local="clr-namespace:VRDash.Overlay"
|
||||||
xmlns:cefSharp="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf"
|
xmlns:cefSharp="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="BrowserOverlay" Height="450" Width="800">
|
Title="BrowserOverlay" Height="450" Width="800"
|
||||||
|
Closing="Window_Closing">
|
||||||
<Grid>
|
<Grid>
|
||||||
<cefSharp:ChromiumWebBrowser x:Name="cwbBrowser" IsBrowserInitializedChanged="cwbBrowser_IsBrowserInitializedChanged" Paint="cwbBrowser_Paint"/>
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<Button x:Name="btnTest" Grid.Row="0" Click="btnTest_Click"> Test</Button>
|
||||||
|
<cefSharp:ChromiumWebBrowser x:Name="cwbBrowser" Grid.Row="1" IsBrowserInitializedChanged="cwbBrowser_IsBrowserInitializedChanged" Paint="cwbBrowser_Paint"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,9 @@ using SharpDX.Direct3D11;
|
||||||
using SharpDX.DXGI;
|
using SharpDX.DXGI;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
@ -17,12 +19,15 @@ using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
using Valve.VR;
|
using Valve.VR;
|
||||||
using VRDash.Overlay.Config;
|
using VRDash.Overlay.Config;
|
||||||
|
using VRDash.UI;
|
||||||
|
using VRDash.Utilities;
|
||||||
|
|
||||||
namespace VRDash.Overlay
|
namespace VRDash.Overlay
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for BrowserOverlay.xaml
|
/// Interaction logic for BrowserOverlay.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[OverlayInfo("Browser Overlay", typeof(BrowserOverlayConfig), typeof(BrowserOverlayEditor), typeof(UI.BrowserOverlayListViewItem))]
|
||||||
public partial class BrowserOverlay : Window, IOverlay
|
public partial class BrowserOverlay : Window, IOverlay
|
||||||
{
|
{
|
||||||
ulong m_OverlayHandle = OpenVR.k_ulOverlayHandleInvalid;
|
ulong m_OverlayHandle = OpenVR.k_ulOverlayHandleInvalid;
|
||||||
|
|
@ -31,9 +36,8 @@ namespace VRDash.Overlay
|
||||||
ulong m_ThumbnailHandle = OpenVR.k_ulOverlayHandleInvalid;
|
ulong m_ThumbnailHandle = OpenVR.k_ulOverlayHandleInvalid;
|
||||||
|
|
||||||
public IOverlayConfig OverlayConfig { get { return Config; } }
|
public IOverlayConfig OverlayConfig { get { return Config; } }
|
||||||
|
|
||||||
//CHANGEME to the BrowserOverlayCOnfig you make later
|
public BrowserOverlayConfig Config { get; }
|
||||||
public IOverlayConfig Config { get; }
|
|
||||||
|
|
||||||
public int CurrentFPS { get; private set; } = 0;
|
public int CurrentFPS { get; private set; } = 0;
|
||||||
|
|
||||||
|
|
@ -44,12 +48,13 @@ namespace VRDash.Overlay
|
||||||
public event EventHandler Update;
|
public event EventHandler Update;
|
||||||
|
|
||||||
bool m_Created = false;
|
bool m_Created = false;
|
||||||
|
|
||||||
//CHANGEME to the BrowserOverlayCOnfig you make later
|
public BrowserOverlay(BrowserOverlayConfig config)
|
||||||
public BrowserOverlay(IOverlayConfig config)
|
|
||||||
{
|
{
|
||||||
Config = config;
|
Config = config;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
this.Show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Factory1 m_Factory = null;
|
Factory1 m_Factory = null;
|
||||||
|
|
@ -89,7 +94,23 @@ namespace VRDash.Overlay
|
||||||
|
|
||||||
public void Destroy()
|
public void Destroy()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
m_ScreenTexture.Dispose();
|
||||||
|
m_Device.ImmediateContext.ClearState();
|
||||||
|
m_Device.ImmediateContext.Flush();
|
||||||
|
m_Device.Dispose();
|
||||||
|
m_Adapter.Dispose();
|
||||||
|
m_Factory.Dispose();
|
||||||
|
CurrentFPS = 0;
|
||||||
|
|
||||||
|
var err = OpenVR.Overlay.DestroyOverlay(m_OverlayHandle);
|
||||||
|
|
||||||
|
if (err != EVROverlayError.None)
|
||||||
|
{
|
||||||
|
throw new Exception($"Error destroying overlay: {err}");
|
||||||
|
}
|
||||||
|
|
||||||
|
m_OverlayHandle = OpenVR.k_ulOverlayHandleInvalid;
|
||||||
|
m_ThumbnailHandle = OpenVR.k_ulOverlayHandleInvalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
|
@ -97,6 +118,7 @@ namespace VRDash.Overlay
|
||||||
if (IsDisposed) { return; }
|
if (IsDisposed) { return; }
|
||||||
Destroy();
|
Destroy();
|
||||||
IsDisposed = true;
|
IsDisposed = true;
|
||||||
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetOverlayName()
|
public string GetOverlayName()
|
||||||
|
|
@ -128,7 +150,14 @@ namespace VRDash.Overlay
|
||||||
{
|
{
|
||||||
if ((bool)e.NewValue)
|
if ((bool)e.NewValue)
|
||||||
{
|
{
|
||||||
cwbBrowser.LoadHtml("<iframe frameborder=\"0\"\r\n scrolling=\"no\"\r\n id=\"chat_embed\"\r\n src=\"https://www.twitch.tv/embed/meteos/chat\"\r\n height=\"500\"\r\n width=\"350\">\r\n</iframe>");
|
if (Config.ContentType == BrowserOverlayConfig.BrowserOverlayContentType.Url && !String.IsNullOrWhiteSpace(Config.Content))
|
||||||
|
{
|
||||||
|
cwbBrowser.Load(Config.Content);
|
||||||
|
}
|
||||||
|
else if(Config.ContentType == BrowserOverlayConfig.BrowserOverlayContentType.Html && !String.IsNullOrWhiteSpace(Config.Content))
|
||||||
|
{
|
||||||
|
cwbBrowser.LoadHtml(Config.Content);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -137,6 +166,13 @@ namespace VRDash.Overlay
|
||||||
private void cwbBrowser_Paint(object sender, CefSharp.Wpf.PaintEventArgs e)
|
private void cwbBrowser_Paint(object sender, CefSharp.Wpf.PaintEventArgs e)
|
||||||
{
|
{
|
||||||
if (!m_Created) { return; }
|
if (!m_Created) { return; }
|
||||||
|
|
||||||
|
if (m_Device.IsDisposed)
|
||||||
|
{
|
||||||
|
this.GetLogger().Debug("m_Device is disposed. This should only happen on removal.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Update?.Invoke(this, null);
|
Update?.Invoke(this, null);
|
||||||
|
|
||||||
if (m_ScreenTexture == null || (m_LastWidth != e.Width || m_LastHeight != e.Height))
|
if (m_ScreenTexture == null || (m_LastWidth != e.Width || m_LastHeight != e.Height))
|
||||||
|
|
@ -187,7 +223,7 @@ namespace VRDash.Overlay
|
||||||
{
|
{
|
||||||
int count = 4 * e.Width * e.Height;
|
int count = 4 * e.Width * e.Height;
|
||||||
|
|
||||||
//Stride compensation. Sometimes the BMP and DX texture strides are different. This fixes it.
|
//Stride compensation. Sometimes the browser stride and DX texture strides are different. This fixes it.
|
||||||
if (databox.RowPitch == stride)
|
if (databox.RowPitch == stride)
|
||||||
{
|
{
|
||||||
m_Stream.Write(e.Buffer, 0, count);
|
m_Stream.Write(e.Buffer, 0, count);
|
||||||
|
|
@ -237,5 +273,20 @@ namespace VRDash.Overlay
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private void btnTest_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
//Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||||
|
{
|
||||||
|
if (!IsDisposed)
|
||||||
|
{
|
||||||
|
e.Cancel = true;
|
||||||
|
Hide();
|
||||||
|
cwbBrowser.GetBrowserHost().WasHidden(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using VRDash.Overlay.Config.OverlayLocation;
|
||||||
|
|
||||||
|
namespace VRDash.Overlay.Config
|
||||||
|
{
|
||||||
|
public class BrowserOverlayConfig : IOverlayConfig
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Key { get; set; }
|
||||||
|
public float OverlayWidth { get; set; } = 2.5f;
|
||||||
|
public IOverlayLocation Location { get; set; }
|
||||||
|
public string Content { get; set; }
|
||||||
|
public BrowserOverlayContentType ContentType { get; set; }
|
||||||
|
|
||||||
|
public void Initialize(IOverlay overlay)
|
||||||
|
{
|
||||||
|
//Nothing needs to be done here
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum BrowserOverlayContentType
|
||||||
|
{
|
||||||
|
Url=0,
|
||||||
|
Html=1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -76,7 +76,7 @@ namespace VRDash.Overlay.Config.OverlayLocation
|
||||||
//Location = Matrix3x4.Add(Matrix3x4.CreateFromQuaternion(quat), Location);
|
//Location = Matrix3x4.Add(Matrix3x4.CreateFromQuaternion(quat), Location);
|
||||||
//Location = Matrix3x4.Add(Matrix3x4.CreateScale(ScaleX, ScaleY, ScaleZ), Location);
|
//Location = Matrix3x4.Add(Matrix3x4.CreateScale(ScaleX, ScaleY, ScaleZ), Location);
|
||||||
|
|
||||||
if (m_Overlay.OverlayHandle == OpenVR.k_ulOverlayHandleInvalid || m_ControllerIndex == OpenVR.k_unTrackedDeviceIndexInvalid) { return; }
|
if (m_Overlay.OverlayHandle == OpenVR.k_ulOverlayHandleInvalid) { return; }
|
||||||
|
|
||||||
//Index changed, need to update the overlay
|
//Index changed, need to update the overlay
|
||||||
if (controllerIndex != m_ControllerIndex)
|
if (controllerIndex != m_ControllerIndex)
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,17 @@ namespace VRDash.Overlay.Config.OverlayLocation
|
||||||
ulong thumbnailHandle = 0;
|
ulong thumbnailHandle = 0;
|
||||||
|
|
||||||
//Actually create the overlay
|
//Actually create the overlay
|
||||||
EVROverlayError err = OpenVR.Overlay.CreateDashboardOverlay(key, name, ref overalyHandle, ref thumbnailHandle);
|
try
|
||||||
|
|
||||||
if (err != EVROverlayError.None)
|
|
||||||
{
|
{
|
||||||
throw new Exception($"Error creating overlay: {err}");
|
EVROverlayError err = OpenVR.Overlay.CreateDashboardOverlay(key, name, ref overalyHandle, ref thumbnailHandle);
|
||||||
|
if (err != EVROverlayError.None)
|
||||||
|
{
|
||||||
|
throw new Exception($"Error creating overlay: {err}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
this.GetLogger(overlay).Error("Unable to create new OpenVR overlay.", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
OverlayHandles handles = new OverlayHandles(overalyHandle, thumbnailHandle);
|
OverlayHandles handles = new OverlayHandles(overalyHandle, thumbnailHandle);
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,8 @@ namespace VRDash.Overlay
|
||||||
|
|
||||||
internal ulong m_OverlayHandle;
|
internal ulong m_OverlayHandle;
|
||||||
public ulong OverlayHandle { get { return m_OverlayHandle; } }
|
public ulong OverlayHandle { get { return m_OverlayHandle; } }
|
||||||
internal ulong m_ThumbnailIcon;
|
internal ulong m_ThumbnailHandle;
|
||||||
public ulong ThumbnailIcon { get { return m_ThumbnailIcon; } }
|
public ulong ThumbnailIcon { get { return m_ThumbnailHandle; } }
|
||||||
|
|
||||||
public IOverlayConfig OverlayConfig { get { return Config; } }
|
public IOverlayConfig OverlayConfig { get { return Config; } }
|
||||||
public MonitorOverlayConfig Config { get; }
|
public MonitorOverlayConfig Config { get; }
|
||||||
|
|
@ -105,7 +105,7 @@ namespace VRDash.Overlay
|
||||||
}
|
}
|
||||||
|
|
||||||
m_OverlayHandle = OpenVR.k_ulOverlayHandleInvalid;
|
m_OverlayHandle = OpenVR.k_ulOverlayHandleInvalid;
|
||||||
m_ThumbnailIcon = OpenVR.k_ulOverlayHandleInvalid;
|
m_ThumbnailHandle = OpenVR.k_ulOverlayHandleInvalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EventPump()
|
private void EventPump()
|
||||||
|
|
@ -126,7 +126,7 @@ namespace VRDash.Overlay
|
||||||
|
|
||||||
Config.OverlayLocation.OverlayHandles overlayHandles = Config.Location.CreateOverlay(Config.Key, Config.Name, this);
|
Config.OverlayLocation.OverlayHandles overlayHandles = Config.Location.CreateOverlay(Config.Key, Config.Name, this);
|
||||||
m_OverlayHandle = overlayHandles.OverlayHandle;
|
m_OverlayHandle = overlayHandles.OverlayHandle;
|
||||||
m_ThumbnailIcon = overlayHandles.ThumbnailHandle;
|
m_ThumbnailHandle = overlayHandles.ThumbnailHandle;
|
||||||
|
|
||||||
overlay.SetOverlayFlag(m_OverlayHandle, VROverlayFlags.SendVRDiscreteScrollEvents, true);
|
overlay.SetOverlayFlag(m_OverlayHandle, VROverlayFlags.SendVRDiscreteScrollEvents, true);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
<UserControl x:Class="VRDash.UI.BrowserOverlayEditor"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:VRDash.UI"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="100" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center" >Name:</TextBlock>
|
||||||
|
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Config.Name}" Margin="5,5,5,0"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center" >Content Type:</TextBlock>
|
||||||
|
<ComboBox x:Name="cbContentType" Grid.Row="1" Grid.Column="1" SelectedItem="{Binding Config.ContentType}" Margin="5,5,5,5" SelectionChanged="cbContentType_SelectionChanged"/>
|
||||||
|
|
||||||
|
<TextBlock x:Name="lblContent" Grid.Row="2" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,0,5,0">Content:</TextBlock>
|
||||||
|
<TextBox x:Name="tbContent" Grid.Row="2" Grid.Column="1" Text="{Binding Config.Content}" TextWrapping="Wrap" AcceptsReturn="True" Height="Auto" Margin="5,0,5,0" />
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using VRDash.Overlay.Config;
|
||||||
|
|
||||||
|
namespace VRDash.UI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for BrowserOverlayConfigEditor.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class BrowserOverlayEditor : UserControl, IOverlayEditor
|
||||||
|
{
|
||||||
|
public BrowserOverlayEditor(BrowserOverlayConfig config)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
DataContext = this;
|
||||||
|
OverlayConfig = config;
|
||||||
|
cbContentType.ItemsSource = Enum.GetValues(typeof(BrowserOverlayConfig.BrowserOverlayContentType));
|
||||||
|
|
||||||
|
UpdateGui();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IOverlayConfig Config { get { return OverlayConfig; } }
|
||||||
|
public BrowserOverlayConfig OverlayConfig { get; private set; }
|
||||||
|
|
||||||
|
public string[] ValidateInput()
|
||||||
|
{
|
||||||
|
List<string> issues = new List<string>();
|
||||||
|
|
||||||
|
if (String.IsNullOrWhiteSpace(Config.Name))
|
||||||
|
{
|
||||||
|
issues.Add("Please enter a name.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(cbContentType.SelectedIndex < 0)
|
||||||
|
{
|
||||||
|
issues.Add("Please select a content type.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return issues.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateGui()
|
||||||
|
{
|
||||||
|
if (cbContentType.SelectedItem != null)
|
||||||
|
{
|
||||||
|
var contentType = (BrowserOverlayConfig.BrowserOverlayContentType)cbContentType.SelectedItem;
|
||||||
|
tbContent.Text = "";
|
||||||
|
if (contentType == BrowserOverlayConfig.BrowserOverlayContentType.Html)
|
||||||
|
{
|
||||||
|
tbContent.AcceptsReturn = true;
|
||||||
|
tbContent.MinHeight = 400;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tbContent.AcceptsReturn = false;
|
||||||
|
tbContent.MinHeight = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
lblContent.Text = cbContentType.SelectedItem.ToString() + ":";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cbContentType_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
UpdateGui();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
<UserControl x:Class="VRDash.UI.BrowserOverlayListViewItem"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:VRDash.UI"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800"
|
||||||
|
MouseDoubleClick="UserControl_MouseDoubleClick">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<TextBlock x:Name="tbName" Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Left" VerticalAlignment="Center" FontWeight="Bold">Name</TextBlock>
|
||||||
|
<TextBlock x:Name="tbFPS" Grid.Row="1" Grid.Column="1" Margin="0,0,10,0">Loading...</TextBlock>
|
||||||
|
<TextBlock x:Name="tbURL" Grid.Row="1" Grid.Column="2" FontStyle="Italic">Loading...</TextBlock>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
using VRDash.Overlay;
|
||||||
|
|
||||||
|
namespace VRDash.UI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for BrowserOverlayListViewItem.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class BrowserOverlayListViewItem : UserControl,IDisposable,IOverlayListViewItem
|
||||||
|
{
|
||||||
|
public BrowserOverlay Overlay { get { return (BrowserOverlay)OverlayInfo.Overlay; } }
|
||||||
|
|
||||||
|
public OverlayEditorInfo OverlayInfo { get; private set; }
|
||||||
|
|
||||||
|
DispatcherTimer m_Timer = null;
|
||||||
|
public BrowserOverlayListViewItem(OverlayEditorInfo overlayInfo)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
OverlayInfo = overlayInfo;
|
||||||
|
|
||||||
|
m_Timer = new DispatcherTimer(new TimeSpan(0, 0, 0, 0, 300), DispatcherPriority.Normal, OnTimerTick, this.Dispatcher);
|
||||||
|
m_Timer.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TestShit()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnTimerTick(object x, object y)
|
||||||
|
{
|
||||||
|
tbName.Text = Overlay.OverlayConfig.Name;
|
||||||
|
tbFPS.Text = $"{Overlay.CurrentFPS} FPS";
|
||||||
|
tbURL.Text = "Placeholder";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
m_Timer?.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UserControl_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
Overlay.Show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -105,6 +105,7 @@
|
||||||
<Compile Include="Overlay\BrowserOverlay.xaml.cs">
|
<Compile Include="Overlay\BrowserOverlay.xaml.cs">
|
||||||
<DependentUpon>BrowserOverlay.xaml</DependentUpon>
|
<DependentUpon>BrowserOverlay.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Overlay\Config\BrowserOverlayConfig.cs" />
|
||||||
<Compile Include="Overlay\Config\OverlayLocation\ControllerLocation.cs" />
|
<Compile Include="Overlay\Config\OverlayLocation\ControllerLocation.cs" />
|
||||||
<Compile Include="Overlay\Config\OverlayLocation\DashboardLocation.cs" />
|
<Compile Include="Overlay\Config\OverlayLocation\DashboardLocation.cs" />
|
||||||
<Compile Include="Overlay\Config\OverlayLocation\IOverlayLocation.cs" />
|
<Compile Include="Overlay\Config\OverlayLocation\IOverlayLocation.cs" />
|
||||||
|
|
@ -127,6 +128,12 @@
|
||||||
<Compile Include="UI\ActionEditors\ResizeWindowActionEditor.xaml.cs">
|
<Compile Include="UI\ActionEditors\ResizeWindowActionEditor.xaml.cs">
|
||||||
<DependentUpon>ResizeWindowActionEditor.xaml</DependentUpon>
|
<DependentUpon>ResizeWindowActionEditor.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="UI\BrowserOverlayEditor.xaml.cs">
|
||||||
|
<DependentUpon>BrowserOverlayEditor.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="UI\BrowserOverlayListViewItem.xaml.cs">
|
||||||
|
<DependentUpon>BrowserOverlayListViewItem.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="UI\CreateNewOverlay.xaml.cs">
|
<Compile Include="UI\CreateNewOverlay.xaml.cs">
|
||||||
<DependentUpon>CreateNewOverlay.xaml</DependentUpon>
|
<DependentUpon>CreateNewOverlay.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
@ -142,7 +149,7 @@
|
||||||
<Compile Include="UI\OverlayEditor.xaml.cs">
|
<Compile Include="UI\OverlayEditor.xaml.cs">
|
||||||
<DependentUpon>OverlayEditor.xaml</DependentUpon>
|
<DependentUpon>OverlayEditor.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="UI\ProcessSelectorEditor.xaml.cs">
|
<Compile Include="UI\SelectorEditors\ProcessSelectorEditor.xaml.cs">
|
||||||
<DependentUpon>ProcessSelectorEditor.xaml</DependentUpon>
|
<DependentUpon>ProcessSelectorEditor.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="UI\WindowOverlayEditor.xaml.cs">
|
<Compile Include="UI\WindowOverlayEditor.xaml.cs">
|
||||||
|
|
@ -154,7 +161,7 @@
|
||||||
<Compile Include="UI\WindowOverlayListViewItem.xaml.cs">
|
<Compile Include="UI\WindowOverlayListViewItem.xaml.cs">
|
||||||
<DependentUpon>WindowOverlayListViewItem.xaml</DependentUpon>
|
<DependentUpon>WindowOverlayListViewItem.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="UI\WindowSelectorEditor.xaml.cs">
|
<Compile Include="UI\SelectorEditors\WindowSelectorEditor.xaml.cs">
|
||||||
<DependentUpon>WindowSelectorEditor.xaml</DependentUpon>
|
<DependentUpon>WindowSelectorEditor.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Utilities\OpenTKExtensions.cs" />
|
<Compile Include="Utilities\OpenTKExtensions.cs" />
|
||||||
|
|
@ -183,6 +190,14 @@
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="UI\BrowserOverlayEditor.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="UI\BrowserOverlayListViewItem.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="UI\CreateNewOverlay.xaml">
|
<Page Include="UI\CreateNewOverlay.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|
@ -199,7 +214,7 @@
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="UI\ProcessSelectorEditor.xaml">
|
<Page Include="UI\SelectorEditors\ProcessSelectorEditor.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
|
@ -215,7 +230,7 @@
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="UI\WindowSelectorEditor.xaml">
|
<Page Include="UI\SelectorEditors\WindowSelectorEditor.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue