Skip to content

Commit

Permalink
Added opacity to main window
Browse files Browse the repository at this point in the history
  • Loading branch information
Imaginary-Narwhal committed Aug 15, 2021
1 parent 3bd2c80 commit a3ae263
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 16 deletions.
Binary file modified .vs/EZCounter/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file modified .vs/EZCounter/v17/.futdcache.v1
Binary file not shown.
2 changes: 1 addition & 1 deletion EZCounter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<UseWPF>true</UseWPF>
<ApplicationIcon />
<StartupObject />
<Version>1.3.0</Version>
<Version>1.3.1</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
12 changes: 12 additions & 0 deletions Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@
<Setting Name="timerSound" Type="System.String" Scope="User">
<Value Profile="(Default)">None</Value>
</Setting>
<Setting Name="transparency" Type="System.Double" Scope="User">
<Value Profile="(Default)">1</Value>
</Setting>
</Settings>
</SettingsFile>
1 change: 0 additions & 1 deletion ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public class MainViewModel : ICustomPropertyNotify
private ObservableCollection<Counter> records;
private Counter selectedItem;
private decimal timerCounter;


public decimal TimerCounter { get=> timerCounter; set => SetProperty(ref timerCounter, value); }
public Counter Current { get => current; set => SetProperty(ref current, value); }
Expand Down
3 changes: 2 additions & 1 deletion Views/MainView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
mc:Ignorable="d"
Topmost="True" Background="#121212"
Height="65" Width="240" Name="TehWindow"
Opacity="{Binding Source={x:Static properties:Settings.Default}, Path=transparency}"
ResizeMode="NoResize" WindowStyle="None" MouseDown="Window_MouseDown"
Loaded="Window_Loaded" LocationChanged="Moving" Closing="OnClose" >
Loaded="Window_Loaded" LocationChanged="Moving" Closing="OnClose" AllowsTransparency="True">
<Window.Resources>
<Style x:Key="{x:Type ContextMenu}" TargetType="{x:Type ContextMenu}">
<Setter Property="OverridesDefaultStyle" Value="True"/>
Expand Down
31 changes: 29 additions & 2 deletions Views/MainView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public partial class MainView : Window
public MainView()
{
vm = new MainViewModel();
Properties.Settings.Default.listOpen = true;

InitializeComponent();

Expand All @@ -41,6 +40,33 @@ public MainView()
private void Window_Loaded(object sender, RoutedEventArgs e)
{
MoveListView();
if (Properties.Settings.Default.anchorListTop)
{
if (!Properties.Settings.Default.listOpen)
{
lWindow.Visibility = Visibility.Collapsed;
toggleListImage.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/upArrow.png"));
}
else
{

lWindow.Visibility = Visibility.Visible;
toggleListImage.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/downArrow.png"));
}
}
else
{
if (!Properties.Settings.Default.listOpen)
{
lWindow.Visibility = Visibility.Collapsed;
toggleListImage.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/downArrow.png"));
}
else
{
lWindow.Visibility = Visibility.Visible;
toggleListImage.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/upArrow.png"));
}
}
}

public void MoveListView()
Expand Down Expand Up @@ -161,7 +187,8 @@ private void ToggleListView(object sender, RoutedEventArgs e)
lWindow.Visibility = Visibility.Visible;
toggleListImage.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/upArrow.png"));
}
}
}
Properties.Settings.Default.Save();
}
}
}
29 changes: 18 additions & 11 deletions Views/SettingsView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
<RowDefinition Height="35"/>
<RowDefinition Height="35"/>
<RowDefinition Height="35"/>
<RowDefinition Height="35"/>
<RowDefinition Height="35"/>
<RowDefinition Height="35"/>
<RowDefinition Height="35"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
Expand All @@ -49,13 +45,23 @@
VerticalContentAlignment="Center"/>
</StackPanel>

<Label Grid.Row="1" Foreground="#b6b5b5" FontSize="12pt">Transparency:</Label>
<Slider
Grid.Row="1"
Grid.Column="1"
VerticalAlignment="Center"
Margin="10,0,10,0"
Minimum=".1"
Maximum="1"
Value="{Binding Source={x:Static properties:Settings.Default}, Path=transparency}"
ValueChanged="SliderChange"/>

<Label Grid.Row="1" Grid.ColumnSpan="2" Foreground="#B6B5B5" FontSize="12pt">Timer settings:</Label>
<Label Grid.Row="2" Grid.ColumnSpan="2" Foreground="#B6B5B5" FontSize="12pt">Timer settings:</Label>
<CheckBox FlowDirection="RightToLeft" Background="#B6B5B5"
FontSize="12pt" VerticalContentAlignment="Center"
VerticalAlignment="Center"
Content="?On"
Grid.Row="2" Grid.Column="0"
Grid.Row="3" Grid.Column="0"
Margin="0,0,10,0"
Foreground="#B6B5B5"
x:Name="TimerCheck"
Expand All @@ -67,7 +73,7 @@
</CheckBox.Resources>
</CheckBox>
<StackPanel Grid.Column="1"
Grid.Row="2"
Grid.Row="3"
Orientation="Horizontal"
Margin="10,5,0,5"
Visibility="{Binding IsChecked, ElementName=TimerCheck, Converter={StaticResource bool2Vis}}">
Expand All @@ -87,23 +93,24 @@

<Label
Foreground="#B6B5B5" FontSize="12pt"
Grid.Row="3"
Grid.Row="4"
Content="Timer Sound:" HorizontalContentAlignment="Right"
Visibility="{Binding IsChecked, ElementName=TimerCheck, Converter={StaticResource bool2Vis}}"
/>
<ComboBox
SelectionChanged="ChangedSound"
SelectedItem="{Binding SelectedSound}"
Grid.Row="3"
Grid.Row="4"
Grid.Column="1"
FontSize="12pt"
Margin="10,3,10,3"
ItemsSource="{Binding AllSounds}"
Visibility="{Binding IsChecked, ElementName=TimerCheck, Converter={StaticResource bool2Vis}}"/>
<Button
Grid.Row="4"
Grid.Row="5"
Grid.Column="1"
Margin="10,3,10,3" Width="200" FontSize="12pt"
Background="SlateGray" Foreground="#B6B5B5" Click="OpenSounds">Open Sound Folder</Button>
Background="SlateGray" Foreground="#B6B5B5" Click="OpenSounds"
Visibility="{Binding IsChecked, ElementName=TimerCheck, Converter={StaticResource bool2Vis}}">Open Sound Folder</Button>
</Grid>
</Window>
5 changes: 5 additions & 0 deletions Views/SettingsView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,10 @@ private void OpenSounds(object sender, RoutedEventArgs e)
{
Process.Start("explorer.exe", Storage.Sounds);
}

private void SliderChange(object sender, RoutedPropertyChangedEventArgs<double> e)
{
Properties.Settings.Default.Save();
}
}
}

0 comments on commit a3ae263

Please sign in to comment.