Skip to content
Merged
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
966 changes: 469 additions & 497 deletions App.xaml.cs

Large diffs are not rendered by default.

44 changes: 14 additions & 30 deletions AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,30 +1,14 @@
/*
* ThreadPilot - Advanced Windows Process and Power Plan Manager
* Copyright (C) 2025 Prime Build
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, version 3 only.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
using System.Runtime.CompilerServices;
using System.Windows;

[assembly: InternalsVisibleTo("ThreadPilot.Core.Tests")]

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, // where theme specific resource dictionaries are located
// (used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly) // where the generic resource dictionary is located
// (used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
]

using System.Runtime.CompilerServices;
using System.Windows;

[assembly: InternalsVisibleTo("ThreadPilot.Core.Tests")]

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, // where theme specific resource dictionaries are located
// (used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly) // where the generic resource dictionary is located
// (used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
]

98 changes: 41 additions & 57 deletions Converters/BoolToColorConverter.cs
Original file line number Diff line number Diff line change
@@ -1,57 +1,41 @@
/*
* ThreadPilot - Advanced Windows Process and Power Plan Manager
* Copyright (C) 2025 Prime Build
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, version 3 only.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace ThreadPilot
{
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;

public class BoolToColorConverter : IValueConverter
{
public static readonly BoolToColorConverter Instance = new();

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool boolValue)
{
return boolValue
? ResolveBrush("TextFillColorPrimaryBrush", System.Windows.Media.Brushes.Black)
: ResolveBrush("TextFillColorSecondaryBrush", System.Windows.Media.Brushes.Gray);
}

return ResolveBrush("TextFillColorSecondaryBrush", System.Windows.Media.Brushes.Gray);
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}

private static System.Windows.Media.Brush ResolveBrush(string key, System.Windows.Media.Brush fallback)
{
if (System.Windows.Application.Current?.TryFindResource(key) is System.Windows.Media.Brush brush)
{
return brush;
}

return fallback;
}
}
}

namespace ThreadPilot
{
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;

public class BoolToColorConverter : IValueConverter
{
public static readonly BoolToColorConverter Instance = new();

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool boolValue)
{
return boolValue
? ResolveBrush("TextFillColorPrimaryBrush", System.Windows.Media.Brushes.Black)
: ResolveBrush("TextFillColorSecondaryBrush", System.Windows.Media.Brushes.Gray);
}

return ResolveBrush("TextFillColorSecondaryBrush", System.Windows.Media.Brushes.Gray);
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}

private static System.Windows.Media.Brush ResolveBrush(string key, System.Windows.Media.Brush fallback)
{
if (System.Windows.Application.Current?.TryFindResource(key) is System.Windows.Media.Brush brush)
{
return brush;
}

return fallback;
}
}
}

70 changes: 27 additions & 43 deletions Converters/BoolToFontWeightConverter.cs
Original file line number Diff line number Diff line change
@@ -1,43 +1,27 @@
/*
* ThreadPilot - Advanced Windows Process and Power Plan Manager
* Copyright (C) 2025 Prime Build
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, version 3 only.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace ThreadPilot
{
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

public class BoolToFontWeightConverter : IValueConverter
{
public static readonly BoolToFontWeightConverter Instance = new();

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool boolValue && boolValue)
{
return FontWeights.Bold;
}
return FontWeights.Normal;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

namespace ThreadPilot
{
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

public class BoolToFontWeightConverter : IValueConverter
{
public static readonly BoolToFontWeightConverter Instance = new();

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool boolValue && boolValue)
{
return FontWeights.Bold;
}
return FontWeights.Normal;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

77 changes: 29 additions & 48 deletions Converters/BoolToStringConverter.cs
Original file line number Diff line number Diff line change
@@ -1,48 +1,29 @@
/*
* ThreadPilot - Advanced Windows Process and Power Plan Manager
* Copyright (C) 2025 Prime Build
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, version 3 only.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace ThreadPilot.Converters
{
using System;
using System.Globalization;
using System.Windows.Data;

/// <summary>
/// Converts boolean values to strings based on parameter format.
/// </summary>
public class BoolToStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool boolValue && parameter is string paramString)
{
var parts = paramString.Split('|');
if (parts.Length == 2)
{
return boolValue ? parts[0] : parts[1];
}
}

return value?.ToString() ?? string.Empty;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

namespace ThreadPilot.Converters
{
using System;
using System.Globalization;
using System.Windows.Data;

public class BoolToStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool boolValue && parameter is string paramString)
{
var parts = paramString.Split('|');
if (parts.Length == 2)
{
return boolValue ? parts[0] : parts[1];
}
}

return value?.ToString() ?? string.Empty;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

78 changes: 31 additions & 47 deletions Converters/BoolToVisibilityConverter.cs
Original file line number Diff line number Diff line change
@@ -1,47 +1,31 @@
/*
* ThreadPilot - Advanced Windows Process and Power Plan Manager
* Copyright (C) 2025 Prime Build
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, version 3 only.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace ThreadPilot
{
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

public class BoolToVisibilityConverter : IValueConverter
{
public static readonly BoolToVisibilityConverter Instance = new();

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool boolValue && boolValue)
{
return Visibility.Visible;
}
return Visibility.Collapsed;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is Visibility visibility)
{
return visibility == Visibility.Visible;
}
return false;
}
}
}

namespace ThreadPilot
{
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

public class BoolToVisibilityConverter : IValueConverter
{
public static readonly BoolToVisibilityConverter Instance = new();

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool boolValue && boolValue)
{
return Visibility.Visible;
}
return Visibility.Collapsed;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is Visibility visibility)
{
return visibility == Visibility.Visible;
}
return false;
}
}
}

Loading
Loading