Skip to content

Commit

Permalink
Implement lights instead of checkboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
CarbonNeuron committed Jan 20, 2021
1 parent e52952a commit 4d5574e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 14 deletions.
6 changes: 6 additions & 0 deletions AUCapture-WPF/AUCapture-WPF.csproj
Expand Up @@ -45,6 +45,10 @@
<ItemGroup>
<None Remove="Resources\Hats\103-1.png" />
<None Remove="Resources\Hats\94-1.png" />
<None Remove="Resources\Misc\status-connected.png" />
<None Remove="Resources\Misc\status-disconnected.png" />
<None Remove="Resources\Misc\voteCancel.png" />
<None Remove="Resources\Misc\voteConfirm.png" />
<None Remove="Resources\Pets\1.png" />
<None Remove="Resources\Pets\10.png" />
<None Remove="Resources\Pets\11.png" />
Expand Down Expand Up @@ -191,6 +195,8 @@
<Resource Include="Resources\Hats\92-1.png" />
<Resource Include="Resources\Hats\93-1.png" />
<Resource Include="Resources\Hats\94-1.png" />
<Resource Include="Resources\Misc\status-connected.png" />
<Resource Include="Resources\Misc\status-disconnected.png" />
<Resource Include="Resources\Pants\0.png" />
<Resource Include="Resources\Pants\1.png" />
<Resource Include="Resources\Pants\10.png" />
Expand Down
25 changes: 14 additions & 11 deletions AUCapture-WPF/MainWindow.xaml
Expand Up @@ -39,6 +39,8 @@
<converters:VisabilityInverterConverter x:Key="VisabilityInverterConverter" />
<converters:BoolToVisibilityConverterInverted x:Key="BoolToVisibilityConverterInverted" />
<converters:BoolInverter x:Key="BoolInverter" />
<BitmapImage UriSource="Resources/Misc/status-connected.png" x:Key="status-connected"/>
<BitmapImage UriSource="Resources/Misc/status-disconnected.png" x:Key="status-disconnected"/>
</ResourceDictionary>
</mah:MetroWindow.Resources>
<mah:MetroWindow.LeftWindowCommands>
Expand Down Expand Up @@ -263,23 +265,24 @@

<Border BorderBrush="{DynamicResource MahApps.Brushes.Accent}" BorderThickness="1">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<iconPacks:PackIconUnicons VerticalAlignment="Center" VerticalContentAlignment="Center">
<iconPacks:PackIconUnicons.Style>
<Style TargetType="iconPacks:PackIconUnicons">
<Setter Property="Kind" Value="Multiply" />
<Setter Property="Foreground" Value="Red" />

<Image VerticalAlignment="Center" Stretch="None" HorizontalAlignment="Center">
<Image.Style>
<Style TargetType="Image">
<Setter Property="Source" Value="{StaticResource status-disconnected}" />
<Style.Triggers>
<DataTrigger
Binding="{Binding Path=Connected, Converter={StaticResource BoolToString}}"
Value="True">
<Setter Property="Kind" Value="Check" />
<Setter Property="Foreground" Value="LimeGreen" />
<Setter Property="Source" Value="{StaticResource status-connected}" />
</DataTrigger>
</Style.Triggers>
</Style>
</iconPacks:PackIconUnicons.Style>
</iconPacks:PackIconUnicons>
<Label Content="{Binding ConnectionName}" HorizontalContentAlignment="Right" />
</Image.Style>
</Image>


<Label Content="{Binding ConnectionName}" HorizontalContentAlignment="Right" VerticalAlignment="Center" VerticalContentAlignment="Center"/>

</StackPanel>

Expand All @@ -289,7 +292,7 @@
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid IsItemsHost="True" Columns="3" />
<UniformGrid IsItemsHost="True" Rows="1" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
Expand Down
5 changes: 2 additions & 3 deletions AUCapture-WPF/MainWindow.xaml.cs
Expand Up @@ -107,7 +107,6 @@ public MainWindow()
App.socket.AddHandler(App.handler);
};
context.ConnectionStatuses.Add(new ConnectionStatus{Connected = false, ConnectionName = "AutoMuteUs"});
context.ConnectionStatuses.Add(new ConnectionStatus{Connected = false, ConnectionName = "Among us"});
context.ConnectionStatuses.Add(new ConnectionStatus{Connected = false, ConnectionName = "User bot"});
GameMemReader.getInstance().GameStateChanged += GameStateChangedHandler;
GameMemReader.getInstance().ProcessHook += OnProcessHook;
Expand Down Expand Up @@ -224,7 +223,7 @@ private void HandlerOnOnReady(object? sender, DiscordHandler.ReadyEventArgs e)
private void OnProcessHook(object? sender, ProcessHookArgs e)
{
context.Connected = true;
context.ConnectionStatuses.First(x => x.ConnectionName == "Among us").Connected = true;
//context.ConnectionStatuses.First(x => x.ConnectionName == "Among us").Connected = true;
ProcessMemory.getInstance().process.Exited += ProcessOnExited;
}

Expand All @@ -233,7 +232,7 @@ private void ProcessOnExited(object? sender, EventArgs e)
Dispatcher.Invoke((Action) (() =>
{
context.Connected = false;
context.ConnectionStatuses.First(x => x.ConnectionName == "Among us").Connected = false;
//context.ConnectionStatuses.First(x => x.ConnectionName == "Among us").Connected = false;
}));
ProcessMemory.getInstance().process.Exited -= ProcessOnExited;
}
Expand Down
Binary file added AUCapture-WPF/Resources/Misc/status-connected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4d5574e

Please sign in to comment.