Skip to content

Commit

Permalink
Auto Program Launch upon Startup and Closing
Browse files Browse the repository at this point in the history
  • Loading branch information
KrisIsBackAU committed Apr 1, 2023
1 parent b48e49b commit 504bfef
Show file tree
Hide file tree
Showing 31 changed files with 783 additions and 100 deletions.
5 changes: 4 additions & 1 deletion Oculus VR Dash Manager/App.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="OVR_Dash_Manager.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
Expand Down Expand Up @@ -58,6 +58,9 @@
<setting name="Auto_Audio_Change_DefaultCommunication" serializeAs="String">
<value>False</value>
</setting>
<setting name="Auto_Programs_JSON" serializeAs="String">
<value>[]</value>
</setting>
</OVR_Dash_Manager.Properties.Settings>
</userSettings>
</configuration>
1 change: 0 additions & 1 deletion Oculus VR Dash Manager/Dashes/OVR_Dash.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ public bool Activate_Dash()

if (Installed)
{

try
{
if (!String.IsNullOrEmpty(ProcessToStop))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:OVR_Dash_Manager.Forms.Auto_Program_Launch"
Title="Auto Program Launch Settings" Height="450" Width="800" Loaded="Window_Loaded" Closing="Window_Closing">
Title="Auto Program Launch Settings" Height="500" Width="1000" Loaded="Window_Loaded" Closing="Window_Closing" WindowStartupLocation="CenterScreen">

<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
Expand All @@ -15,31 +15,45 @@
</Window.Resources>

<Grid x:Name="gd_Settings" Background="#FF212121">
<ListView x:Name="lv_Programs" Margin="10,45,10,10" AlternationCount="2" >
<ListView x:Name="lv_Programs" Margin="10,45,10,10" AlternationCount="2" SelectionMode="Single">
<ListView.View>
<GridView>
<GridViewColumn Header="Icon" Width="50">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Image x:Name="img_Icon" Width="16" Height="16" />
<Image x:Name="img_Icon" Width="16" Height="16" Source="{Binding Program_Icon}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="File Name" Width="Auto" DisplayMemberBinding="{Binding File_Name}" />
<GridViewColumn Header="Startup Launch" Width="100">
<GridViewColumn.CellTemplate>
<DataTemplate>
<CheckBox x:Name="chkbx_Auto_Launch_On_Startup" Content="" IsChecked="{Binding Startup_Launch, Mode=TwoWay}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="File Name" Width="Auto"/>
<GridViewColumn Header="File Path" Width="Auto"/>
<GridViewColumn Header="Auto Launch On Startup" Width="50">
<GridViewColumn Header="Closing Launch" Width="100">
<GridViewColumn.CellTemplate>
<DataTemplate>
<CheckBox x:Name="chkbx_Auto_Launch_On_Startup" Content="Launch on Startup" />
<CheckBox x:Name="chkbx_Auto_Launch_On_Closing" Content="" IsChecked="{Binding Closing_Launch, Mode=TwoWay}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Program Found" Width="100">
<GridViewColumn.CellTemplate>
<DataTemplate>
<CheckBox x:Name="chkbx_Program_Found" IsEnabled="False" Content="" IsChecked="{Binding Program_Found}" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>

<GridViewColumn Header="File Path" Width="Auto" DisplayMemberBinding="{Binding Folder_Path}" />
</GridView>
</ListView.View>
</ListView>
<Button x:Name="btn_Add_Program" Content="Add Program" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="115" Height="23" Click="btn_Add_Program_Click"/>
<Button x:Name="btn_Remove_Program" Content="Remove Program" HorizontalAlignment="Left" Margin="150,10,0,0" VerticalAlignment="Top" Width="140" Height="23" Click="btn_Remove_Program_Click"/>
<Button x:Name="btn_Open_Program_Folder" Content="Open Program Folder" HorizontalAlignment="Left" Margin="316,10,0,0" VerticalAlignment="Top" Width="180" Height="23" Click="btn_Remove_Program_Click"/>

<Button x:Name="btn_Add_Program" Content="Add Program" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="115" Height="23" Click="btn_Add_Program_Click" />
<Button x:Name="btn_Remove_Program" Content="Remove Program" HorizontalAlignment="Left" Margin="150,10,0,0" VerticalAlignment="Top" Width="140" Height="23" Click="btn_Remove_Program_Click" />
<Button x:Name="btn_Open_Program_Folder" Content="Open Program Folder" HorizontalAlignment="Left" Margin="316,10,0,0" VerticalAlignment="Top" Width="180" Height="23" Click="btn_Open_Program_Folder_Click" />
</Grid>
</Window>
</Window>
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
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.Shapes;

namespace OVR_Dash_Manager.Forms.Auto_Program_Launch
{
Expand All @@ -19,29 +9,59 @@ namespace OVR_Dash_Manager.Forms.Auto_Program_Launch
/// </summary>
public partial class frm_Auto_Program_Launch_Settings : Window
{
private Boolean Programs_Removed = false;

public frm_Auto_Program_Launch_Settings()
{
InitializeComponent();
}

private void btn_Add_Program_Click(object sender, RoutedEventArgs e)
{

String FilePath = Functions.File_Browser.Open_Single();
if (!String.IsNullOrEmpty(FilePath))
{
Software.Auto_Launch_Programs.Add_New_Program(FilePath);
lv_Programs.Items.Refresh();
}
}

private void btn_Remove_Program_Click(object sender, RoutedEventArgs e)
{

if (lv_Programs.SelectedItem is Software.Auto_Program Program)
{
Programs_Removed = true;
Software.Auto_Launch_Programs.Remove_Program(Program);
lv_Programs.Items.Refresh();
}
}

private void Window_Loaded(object sender, RoutedEventArgs e)
{

lv_Programs.ItemsSource = Software.Auto_Launch_Programs.Programs;
lv_Programs.Items.Refresh();
}

private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
bool Changed = Programs_Removed;

if (Changed == false & Software.Auto_Launch_Programs.Programs != null)
Changed = Software.Auto_Launch_Programs.Programs.Count(a => a.Changed) > 0;

if (Changed)
{
if (MessageBox.Show(this, "Programs Have Been Changed - Are you Sure you want to save changes ?", "Confirm Saving Changes", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
Software.Auto_Launch_Programs.Save_Program_List(); // Save it
else
Software.Auto_Launch_Programs.Generate_List(); // Regenerate and ignore changes
}
}

private void btn_Open_Program_Folder_Click(object sender, RoutedEventArgs e)
{
if (lv_Programs.SelectedItem is Software.Auto_Program Program)
Functions.Process_Functions.StartProcess("explorer.exe", Program.Folder_Path);
}
}
}
}
21 changes: 13 additions & 8 deletions Oculus VR Dash Manager/Forms/Settings/frm_Settings_v2.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:OVR_Dash_Manager.Forms.Settings"
mc:Ignorable="d"
Title="Settings" Width="863" Height="875.24" ResizeMode="CanMinimize" WindowStartupLocation="CenterScreen" Loaded="Window_Loaded" Closing="Window_Closing">
Title="Settings" Width="863" Height="924.74" ResizeMode="CanMinimize" WindowStartupLocation="CenterScreen" Loaded="Window_Loaded" Closing="Window_Closing">

<Window.Resources>
<ResourceDictionary>
Expand All @@ -16,7 +16,7 @@
</Window.Resources>

<Grid x:Name="gd_Settings" Background="#FF212121">
<GroupBox Header="Dash Manager Settings" Margin="10,10,10,0" Height="177" VerticalAlignment="Top">
<GroupBox Header="Dash Manager Settings" Margin="10,0" Height="177" VerticalAlignment="Top">
<Grid Margin="0">
<local:uc_Setting Setting="AlwaysOnTop" Margin="10,3,0,0" HorizontalAlignment="Left" Width="150" Height="30" VerticalAlignment="Top" />
<Label Content="Keep Dash Manager On Top" Margin="166,3,10,0" VerticalAlignment="Top" Height="30" />
Expand All @@ -26,7 +26,7 @@
<Label Content="Ignore SteamVR Status for Hover Button Actions" HorizontalAlignment="Left" Margin="166,79,0,0" VerticalAlignment="Top" Height="30" />
</Grid>
</GroupBox>
<GroupBox Header="Oculus Settings" Margin="10,192,10,0" Height="280" VerticalAlignment="Top">
<GroupBox Header="Oculus Settings" Margin="10,177,10,0" Height="280" VerticalAlignment="Top">
<Grid Margin="0">
<local:uc_Setting Setting="RunOculusClientOnStartup" Margin="10,8,0,0" HorizontalAlignment="Left" Width="150" Height="30" VerticalAlignment="Top" />
<Label Content="Start Oculus Client Software - When Dash Manager Launches" Margin="165,8,10,0" VerticalAlignment="Top" Height="30" />
Expand All @@ -41,28 +41,33 @@
<Label Content="^ (EXPERIMENTAL, REQUIRES Developer Mode) - REQUIRES OCULUS DEVELOPER ACCOUNT" Margin="165,195,10,0" VerticalAlignment="Top" Height="30" />
</Grid>
</GroupBox>
<GroupBox Header="Steam / SteamVR Settings" Margin="10,477,10,0" Height="135" VerticalAlignment="Top">
<GroupBox Header="Steam / SteamVR Settings" Margin="10,457,10,0" Height="135" VerticalAlignment="Top">
<Grid Margin="0">
<local:uc_Setting Setting="SteamVRFocusFix" Margin="10,3,0,0" HorizontalAlignment="Left" Width="150" Height="30" VerticalAlignment="Top" />
<Label Content="Fix SteamVR Admin Program Focus Issue When it Occurs (Task View Glitch)" Margin="166,3,10,0" VerticalAlignment="Top" Height="30" />
<local:uc_Setting Setting="ExitLinkOn_UserExit_SteamVR" Margin="10,41,0,0" HorizontalAlignment="Left" Width="150" Height="30" VerticalAlignment="Top" />
<Label Content="Exit Oculus Link when User Closes Steam VR (Stable Link Connection Recommended)" Margin="166,41,10,0" VerticalAlignment="Top" Height="30" />
</Grid>
</GroupBox>
<GroupBox Header="Automatic Audio Switcher" Margin="10,617,10,11">
<GroupBox Header="Automatic Audio Switcher" Margin="10,592,10,0" Height="191" VerticalAlignment="Top">
<Grid Margin="0">
<local:uc_Setting Setting="Automatic_Audio_Switching" HorizontalAlignment="Left" Width="150" Height="30" VerticalAlignment="Top" />
<Label Content="Automatically Switch Audio on Program Launch (to Quest Speaker) &amp; Program Close (to Normal Speaker)" VerticalAlignment="Top" Height="30" Margin="155,0,10,0" />
<local:uc_Setting Setting="Auto_Audio_Change_DefaultCommunication" HorizontalAlignment="Left" Width="150" Height="30" VerticalAlignment="Top" Margin="0,32,0,0" />
<Label Content="Change Default Communications Device As Well" VerticalAlignment="Top" Height="30" Margin="155,33,10,0" />
<ComboBox x:Name="cbo_NormalSpeaker" Margin="155,68,170,0" VerticalAlignment="Top" DisplayMemberPath="Name" SelectionChanged="cbo_NormalSpeaker_SelectionChanged"/>
<ComboBox x:Name="cbo_NormalSpeaker" Margin="155,68,170,0" VerticalAlignment="Top" DisplayMemberPath="Name" SelectionChanged="cbo_NormalSpeaker_SelectionChanged" />
<Label Content="Normal Speaker" VerticalAlignment="Top" Height="30" Margin="0,68,0,0" HorizontalAlignment="Left" Width="150" />
<ComboBox x:Name="cbo_QuestSpeaker" Margin="155,103,170,0" VerticalAlignment="Top" DisplayMemberPath="Name" SelectionChanged="cbo_QuestSpeaker_SelectionChanged"/>
<ComboBox x:Name="cbo_QuestSpeaker" Margin="155,103,170,0" VerticalAlignment="Top" DisplayMemberPath="Name" SelectionChanged="cbo_QuestSpeaker_SelectionChanged" />
<Label Content="Quest Speaker" VerticalAlignment="Top" Height="30" Margin="0,103,0,0" HorizontalAlignment="Left" Width="150" />
<Button x:Name="btn_Set_Default_Normal" Margin="650,68,10,0" Content="Set As Current" Click="btn_Set_Default_Normal_Click" Height="30" VerticalAlignment="Top" />
<Button x:Name="btn_Set_Default_Quest" Margin="650,103,10,0" Content="Set As Current" Click="btn_Set_Default_Quest_Click" Height="30" VerticalAlignment="Top" />
</Grid>
</GroupBox>

<GroupBox Header="Auto Launch Programs" Margin="10,788,10,10">
<Grid Margin="0">
<Button x:Name="btn_Open_Auto_Launch_Settings" Margin="0,0,665,0" Content="Open Settings" Click="btn_Open_Auto_Launch_Settings_Click" Height="30" VerticalAlignment="Top" />
<Label Content="Allows Programs to be started upon Dash Manage Startup &amp; Closing" VerticalAlignment="Top" Height="30" Margin="155,0,10,0" />
</Grid>
</GroupBox>
</Grid>
</Window>
18 changes: 9 additions & 9 deletions Oculus VR Dash Manager/Forms/Settings/frm_Settings_v2.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using PlaybackDeviceSwitcher;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Windows;
using System.Linq;
using System.Windows.Controls;

namespace OVR_Dash_Manager.Forms.Settings
Expand All @@ -12,8 +9,8 @@ namespace OVR_Dash_Manager.Forms.Settings
/// </summary>
public partial class frm_Settings_v2 : Window
{
bool Audio_DevicesChanged = false;
bool FireEvents = false;
private bool Audio_DevicesChanged = false;
private bool FireEvents = false;

public frm_Settings_v2()
{
Expand All @@ -38,7 +35,6 @@ private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs
{
if (MessageBox.Show(this, "Automatic Audio Devices Changed - Are you sure you want to save this ?", "Confirm Automatic Audio Device Change", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
{

Software.Windows_Audio_v2.IDevice_Ext NormalSpeaker = Software.Windows_Audio_v2.Speakers.FirstOrDefault(a => a.Normal_Speaker);
Software.Windows_Audio_v2.IDevice_Ext QuestSpeaker = Software.Windows_Audio_v2.Speakers.FirstOrDefault(a => a.Quest_Speaker);

Expand Down Expand Up @@ -145,7 +141,11 @@ private void cbo_QuestSpeaker_SelectionChanged(object sender, SelectionChangedEv
CheckSpeaker(Speaker, true, false, true);
}
}
}


private void btn_Open_Auto_Launch_Settings_Click(object sender, RoutedEventArgs e)
{
Auto_Program_Launch.frm_Auto_Program_Launch_Settings pShow = new Auto_Program_Launch.frm_Auto_Program_Launch_Settings();
pShow.ShowDialog();
}
}
}
10 changes: 5 additions & 5 deletions Oculus VR Dash Manager/Forms/Settings/uc_Setting.xaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<UserControl x:Class="OVR_Dash_Manager.Forms.Settings.uc_Setting"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:OVR_Dash_Manager.Forms.Settings"
mc:Ignorable="d" Loaded="UserControl_Loaded">

<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
Expand All @@ -17,10 +17,10 @@
<Grid x:Name="gd_Settings" Background="#FF212121">
<UniformGrid Rows="1" Margin="0">
<UniformGrid.Resources>
<Style TargetType="RadioButton" BasedOn="{StaticResource {x:Type ToggleButton}}"/>
<Style TargetType="RadioButton" BasedOn="{StaticResource {x:Type ToggleButton}}" />
</UniformGrid.Resources>
<RadioButton x:Name="btn_Disabled" Content="Disabled" Checked="btn_Disabled_Checked" VerticalContentAlignment="Center" FontSize="13" HorizontalContentAlignment="Center" />
<RadioButton x:Name="btn_Enabled" Content="Enabled" Checked="btn_Enabled_Checked" VerticalContentAlignment="Center" FontSize="13" HorizontalContentAlignment="Center" />
</UniformGrid>
</Grid>
</UserControl>
</UserControl>
2 changes: 1 addition & 1 deletion Oculus VR Dash Manager/Forms/frm_Diagnostics.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</ListView.View>
</ListView>
<Label Content="Devices Detected" HorizontalAlignment="Left" Margin="10,0,0,157" VerticalAlignment="Bottom" />
<Button x:Name="btn_OculusDebugTool" Content="Oculus Debug Tool" HorizontalAlignment="Right" Margin="0,0,10,156" VerticalAlignment="Bottom" Width="170" Click="btn_OculusDebugTool_Click"/>
<Button x:Name="btn_OculusDebugTool" Content="Oculus Debug Tool" HorizontalAlignment="Right" Margin="0,0,10,156" VerticalAlignment="Bottom" Width="170" Click="btn_OculusDebugTool_Click" />
<Label Content="OpenXR Runtime:" HorizontalAlignment="Left" Margin="10,337,0,0" VerticalAlignment="Top" />
<Label x:Name="lbl_OpenXR_RunTime" Content="Label" Margin="174,337,10,0" VerticalAlignment="Top" />
<Label Content="Fast Switch Enabled:" HorizontalAlignment="Left" Margin="10,370,0,0" VerticalAlignment="Top" />
Expand Down
2 changes: 1 addition & 1 deletion Oculus VR Dash Manager/Forms/frm_Settings.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Title="Settings" Height="370" Width="905" ResizeMode="CanMinimize" WindowStartupLocation="CenterScreen" Loaded="Window_Loaded">

<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
Expand Down
3 changes: 1 addition & 2 deletions Oculus VR Dash Manager/Forms/frm_SteamVR_Settings.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@
</Window.Resources>

<Grid Background="#FF212121">

</Grid>
</Window>
</Window>
2 changes: 1 addition & 1 deletion Oculus VR Dash Manager/Forms/frm_SteamVR_Settings.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ public frm_SteamVR_Settings()
InitializeComponent();
}
}
}
}
Loading

1 comment on commit 504bfef

@Eliminater74
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Bro, Love the work you did, This was a great idea. I hope you didnt mind, but I forked this project, and enhanced it some. Made some changes to make it a bit cleaner and smoother. still working on parts of it.. but for the most part. I got it optimized a bit more. Hope your OK with this. BTW, I optimized the OculusKiller some time back check the pull request out over there.. you might like my version of the code..

Please sign in to comment.