Skip to content
This repository has been archived by the owner on Jun 22, 2021. It is now read-only.

Commit

Permalink
Added new Dark theme
Browse files Browse the repository at this point in the history
  • Loading branch information
Ciaran Fisher committed Nov 26, 2015
1 parent 09d15c1 commit 20bd172
Show file tree
Hide file tree
Showing 9 changed files with 3,190 additions and 7 deletions.
8 changes: 7 additions & 1 deletion RadioGui/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
xmlns:local="clr-namespace:RadioGui"
StartupUri="MainWindow.xaml">
<Application.Resources>


<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Themes\Styles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

</Application.Resources>
</Application>
6 changes: 3 additions & 3 deletions RadioGui/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:RadioGui"


Style="{StaticResource {x:Type Window}}"
Topmost="True"

Opacity="1.0"
Opacity="1.0"

ResizeMode="CanResizeWithGrip"

Expand Down
4 changes: 3 additions & 1 deletion RadioGui/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public MainWindow()

InitializeComponent();


// this.SourceInitialized += MainWindow_SourceInitialized;

if (Is_SimpleRadio_running())
Expand All @@ -66,10 +65,13 @@ public MainWindow()
this.containerPanel.MouseLeftButtonDown += WrapPanel_MouseLeftButtonDown;

radio1.radioId = 0;
// this.radio1.radioControlContainer.MouseLeftButtonDown += WrapPanel_MouseLeftButtonDown;

radio2.radioId = 1;
// this.radio2.radioControlContainer.MouseLeftButtonDown += WrapPanel_MouseLeftButtonDown;

radio3.radioId = 2;
// this.radio3.radioControlContainer.MouseLeftButtonDown += WrapPanel_MouseLeftButtonDown;

SetupActiveRadio();
SetupRadioStatus();
Expand Down
7 changes: 5 additions & 2 deletions RadioGui/RadioControlGroup.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:RadioGui"

Name="radioControlContainer"
Width="120" Height="70"
>
<WrapPanel>
Expand All @@ -26,7 +27,9 @@
<Button HorizontalAlignment="Center" x:Name="down10" Content="" Width="15" Height="10" Margin="30,0,0,0" ToolTip="-10MHZ" Click="down10_Click" IsEnabled="False"/>
<Button HorizontalAlignment="Center" x:Name="down1" Content="" Width="15" Height="10" ToolTip="-1MHz" Click="down1_Click" IsEnabled="False"/>
<Button HorizontalAlignment="Center" x:Name="down01" Content="" Width="15" Height="10" Margin="0,0,0,0" ToolTip="-0.1MHz" Click="down01_Click" IsEnabled="False"/>
<Slider x:Name="radioVolume" Width="125" Margin="2" Maximum="100" IsEnabled="False" Height="15" Thumb.DragCompleted="radioVolume_DragCompleted" Thumb.DragStarted="radioVolume_DragStarted" />

<Slider x:Name="radioVolume" Width="125" Margin="2" Maximum="100" IsEnabled="False" Height="15" Thumb.DragCompleted="radioVolume_DragCompleted" Thumb.DragStarted="radioVolume_DragStarted" >

</Slider>

</WrapPanel>
</UserControl>
6 changes: 6 additions & 0 deletions RadioGui/RadioGui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Themes\LeftMarginMultiplierConverter.cs" />
<Compile Include="Themes\TreeViewItemExtensions.cs" />
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand All @@ -131,6 +133,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Styles.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
Expand Down
31 changes: 31 additions & 0 deletions RadioGui/Themes/LeftMarginMultiplierConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;

namespace DarkBlendTheme
{
public class LeftMarginMultiplierConverter : IValueConverter
{
public double Length { get; set; }

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var item = value as TreeViewItem;
if (item == null)
return new Thickness(0);

return new Thickness(Length * item.GetDepth(), 0, 0, 0);
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new System.NotImplementedException();
}
}
}
3,096 changes: 3,096 additions & 0 deletions RadioGui/Themes/Styles.xaml

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions RadioGui/Themes/TreeViewItemExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;

namespace DarkBlendTheme
{
public static class TreeViewItemExtensions
{
public static int GetDepth(this TreeViewItem item)
{
TreeViewItem parent;
while ((parent = GetParent(item)) != null)
{
return GetDepth(parent) + 1;
}
return 0;
}

private static TreeViewItem GetParent(TreeViewItem item)
{
var parent = VisualTreeHelper.GetParent(item);

while (!(parent is TreeViewItem || parent is TreeView))
{
if (parent == null) return null;
parent = VisualTreeHelper.GetParent(parent);
}
return parent as TreeViewItem;
}
}
}
1 change: 1 addition & 0 deletions RadioGui/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net452" />
<package id="WPFThemes.DarkBlend" version="1.0.8" targetFramework="net452" />
</packages>

0 comments on commit 20bd172

Please sign in to comment.