Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions client/DebugLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ namespace specify_client;

public static class DebugLog
{

private static Settings Settings => Settings.Instance;

public static string LogText;
public static readonly int[] ErrorCount = new int[7];
private static bool Started = false;
Expand Down Expand Up @@ -344,9 +345,9 @@ private static string CreateDebugString(string message, Region region, EventType
private static async Task LogSettings()
{
var properties = typeof(Settings).GetProperties();
foreach (PropertyInfo property in properties)
foreach (PropertyInfo property in properties.Where(x => x.Name != "EnableDebug"))
{
await LogEventAsync($"{property.Name}: {property.GetValue(null)}");
await LogEventAsync($"{property.Name}: {property.GetValue(Settings.Instance)}");
}
}

Expand Down
17 changes: 11 additions & 6 deletions client/Frontend/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,19 @@
</Storyboard>
</ControlTemplate.Resources>

<Viewbox StretchDirection="Both" Stretch="Uniform">
<DockPanel x:Name="dockPanel">
<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
<ContentControl>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ContentPresenter Grid.Column="0"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}" RecognizesAccessKey="True"
VerticalAlignment="Center" />

<Viewbox StretchDirection="Both" Stretch="Uniform" Height="14">
<Viewbox Grid.Column="1" StretchDirection="Both" Stretch="Uniform" >
<Grid Margin="5,5,0,5" Background="#3b4252" Height="20">

<Border x:Name="bg" BorderBrush="#525c70" HorizontalAlignment="Center"
Expand All @@ -136,8 +141,8 @@
</Border>
</Grid>
</Viewbox>
</DockPanel>
</Viewbox>
</Grid>
</ContentControl>

<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
Expand Down
5 changes: 1 addition & 4 deletions client/Frontend/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace specify_client;
/// </summary>
public partial class App : Application
{
private static Settings Settings => Settings.Instance;

[DllImport("Kernel32.dll")]
public static extern bool AllocConsole();
Expand Down Expand Up @@ -60,10 +61,6 @@ private async void Application_Startup(object sender, StartupEventArgs e)
Settings.RedactSerialNumber = true;
break;

case "-redact-odc":
Settings.RedactOneDriveCommercial = true;
break;

case "-redact-networking":
Settings.RedactNetworking = true;
break;
Expand Down
25 changes: 25 additions & 0 deletions client/Frontend/BoolToVisibilityConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
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.Data;

namespace specify_client.Frontend
{
[ValueConversion(typeof(bool), typeof(Visibility))]
public class BoolToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (bool)value ? Visibility.Visible : Visibility.Hidden;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
28 changes: 28 additions & 0 deletions client/Frontend/CheckboxUserControl.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<UserControl x:Class="specify_client.Frontend.CheckboxUserControl"
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:specify_client.Frontend"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">

<Border CornerRadius="8"
BorderThickness="2"
BorderBrush="#576277"
Margin="2,2">

<CheckBox Name="DontUploadCheckbox" Margin="5,0"
IsChecked="{Binding IsChecked, RelativeSource={RelativeSource AncestorType=local:CheckboxUserControl}}"
Style="{DynamicResource CheckBoxStyle1}"
Foreground="White"
VerticalContentAlignment="Center" HorizontalContentAlignment="Stretch" Padding="0">

<TextBlock VerticalAlignment="Center"
FontFamily="Consolas" FontSize="10" FontWeight="Bold"
TextAlignment="Center" TextWrapping="Wrap"
Text="{Binding Content, RelativeSource={RelativeSource AncestorType=local:CheckboxUserControl}}"
/>
</CheckBox>
</Border>
</UserControl>
54 changes: 54 additions & 0 deletions client/Frontend/CheckboxUserControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
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;

namespace specify_client.Frontend
{
/// <summary>
/// Interaction logic for CheckboxUserControl.xaml
/// </summary>
public partial class CheckboxUserControl : UserControl
{
public static readonly DependencyProperty IsCheckedProperty =
DependencyProperty.Register(
name: "IsChecked",
propertyType: typeof(bool),
ownerType: typeof(CheckboxUserControl),
typeMetadata: new FrameworkPropertyMetadata(
defaultValue: false,
flags: FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));

public static readonly DependencyProperty ContentProperty =
DependencyProperty.Register(
name: "Content",
propertyType: typeof(object),
ownerType: typeof(CheckboxUserControl));

public bool IsChecked
{
get => (bool)GetValue(IsCheckedProperty);
set => SetValue(IsCheckedProperty, value);
}
public object Content
{
get => GetValue(ContentProperty);
set => SetValue(ContentProperty, value);
}

public CheckboxUserControl()
{
InitializeComponent();
}
}
}
51 changes: 51 additions & 0 deletions client/Frontend/SettingsUserControl.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<UserControl x:Class="specify_client.Frontend.SettingsUserControl"
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:specify_client.Frontend"
xmlns:sfy="clr-namespace:specify_client"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">

<UserControl.DataContext>
<Binding Source="{x:Static sfy:Settings.Instance}" />
</UserControl.DataContext>

<Grid Margin="15"
Name="SettingsToggles"
Grid.ColumnSpan="2">

<Grid.RowDefinitions>
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>

<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>

<local:CheckboxUserControl Grid.Row="0" Grid.Column="0"
Content="Remove Usernames"
IsChecked="{Binding RedactUsername}" />

<local:CheckboxUserControl Grid.Row="0" Grid.Column="1"
Content="Remove Serial Number"
IsChecked="{Binding EnableDebug}" />

<local:CheckboxUserControl Grid.Row="1" Grid.Column="1"
Content="Enable Debug Logging"
IsChecked="{Binding EnableDebug}" />

<local:CheckboxUserControl Grid.Row="1" Grid.Column="0"
Content="Dont upload"
IsChecked="{Binding DontUpload}" />

<local:CheckboxUserControl Grid.Row="2" Grid.Column="0"
Content="Remove Networking"
IsChecked="{Binding RedactNetworking}" />

</Grid>
</UserControl>
16 changes: 16 additions & 0 deletions client/Frontend/SettingsUserControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System.Windows;
using System.Windows.Controls;

namespace specify_client.Frontend
{
/// <summary>
/// Interaction logic for Settings.xaml
/// </summary>
public partial class SettingsUserControl : UserControl
{
public SettingsUserControl()
{
InitializeComponent();
}
}
}
Loading