Stay with winforms, refactor names
This commit is contained in:
parent
abf1fbf167
commit
62a469eb1a
@ -1,10 +1,17 @@
|
|||||||
<Application x:Class="ReCodeItGUI_WPF.App"
|
<Application
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
x:Class="ReCodeItGUI_WPF.App"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:local="clr-namespace:ReCodeItGUI_WPF"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid"
|
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
DispatcherUnhandledException="OnDispatcherUnhandledException"
|
||||||
StartupUri="MainWindow.xaml">
|
Exit="OnExit"
|
||||||
|
Startup="OnStartup">
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ui:ThemesDictionary Theme="Light" />
|
||||||
|
<ui:ControlsDictionary />
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
</Application>
|
</Application>
|
||||||
|
@ -1,14 +1,94 @@
|
|||||||
using System.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using System.Data;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using System.Windows;
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using ReCodeItGUI_WPF.Services;
|
||||||
|
using ReCodeItGUI_WPF.ViewModels.Pages;
|
||||||
|
using ReCodeItGUI_WPF.ViewModels.Windows;
|
||||||
|
using ReCodeItGUI_WPF.Views.Pages;
|
||||||
|
using ReCodeItGUI_WPF.Views.Windows;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
using Wpf.Ui;
|
||||||
|
|
||||||
namespace ReCodeItGUI_WPF
|
namespace ReCodeItGUI_WPF
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for App.xaml
|
/// Interaction logic for App.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class App : Application
|
public partial class App
|
||||||
{
|
{
|
||||||
}
|
// The.NET Generic Host provides dependency injection, configuration, logging, and other services.
|
||||||
|
// https://docs.microsoft.com/dotnet/core/extensions/generic-host
|
||||||
|
// https://docs.microsoft.com/dotnet/core/extensions/dependency-injection
|
||||||
|
// https://docs.microsoft.com/dotnet/core/extensions/configuration
|
||||||
|
// https://docs.microsoft.com/dotnet/core/extensions/logging
|
||||||
|
private static readonly IHost _host = Host
|
||||||
|
.CreateDefaultBuilder()
|
||||||
|
.ConfigureAppConfiguration(c => { c.SetBasePath(Path.GetDirectoryName(Assembly.GetEntryAssembly()!.Location)); })
|
||||||
|
.ConfigureServices((context, services) =>
|
||||||
|
{
|
||||||
|
services.AddHostedService<ApplicationHostService>();
|
||||||
|
|
||||||
|
// Page resolver service
|
||||||
|
services.AddSingleton<IPageService, PageService>();
|
||||||
|
|
||||||
|
// Theme manipulation
|
||||||
|
services.AddSingleton<IThemeService, ThemeService>();
|
||||||
|
|
||||||
|
// TaskBar manipulation
|
||||||
|
services.AddSingleton<ITaskBarService, TaskBarService>();
|
||||||
|
|
||||||
|
// Service containing navigation, same as INavigationWindow... but without window
|
||||||
|
services.AddSingleton<INavigationService, NavigationService>();
|
||||||
|
|
||||||
|
// Main window with navigation
|
||||||
|
services.AddSingleton<INavigationWindow, MainWindow>();
|
||||||
|
services.AddSingleton<MainWindowViewModel>();
|
||||||
|
|
||||||
|
services.AddSingleton<DashboardPage>();
|
||||||
|
services.AddSingleton<DashboardViewModel>();
|
||||||
|
services.AddSingleton<DataPage>();
|
||||||
|
services.AddSingleton<DataViewModel>();
|
||||||
|
services.AddSingleton<SettingsPage>();
|
||||||
|
services.AddSingleton<SettingsViewModel>();
|
||||||
|
}).Build();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets registered service.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">Type of the service to get.</typeparam>
|
||||||
|
/// <returns>Instance of the service or <see langword="null"/>.</returns>
|
||||||
|
public static T GetService<T>()
|
||||||
|
where T : class
|
||||||
|
{
|
||||||
|
return _host.Services.GetService(typeof(T)) as T;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Occurs when the application is loading.
|
||||||
|
/// </summary>
|
||||||
|
private void OnStartup(object sender, StartupEventArgs e)
|
||||||
|
{
|
||||||
|
_host.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Occurs when the application is closing.
|
||||||
|
/// </summary>
|
||||||
|
private async void OnExit(object sender, ExitEventArgs e)
|
||||||
|
{
|
||||||
|
await _host.StopAsync();
|
||||||
|
|
||||||
|
_host.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Occurs when an exception is thrown by an application but not handled.
|
||||||
|
/// </summary>
|
||||||
|
private void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
|
||||||
|
{
|
||||||
|
// For more info see https://docs.microsoft.com/en-us/dotnet/api/system.windows.application.dispatcherunhandledexception?view=windowsdesktop-6.0
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
[assembly: ThemeInfo(
|
[assembly: ThemeInfo(
|
||||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
//(used if a resource is not found in the page,
|
//(used if a resource is not found in the page,
|
||||||
// or application resource dictionaries)
|
// or application resource dictionaries)
|
||||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
//(used if a resource is not found in the page,
|
//(used if a resource is not found in the page,
|
||||||
// app, or any theme specific resource dictionaries)
|
// app, or any theme specific resource dictionaries)
|
||||||
)]
|
)]
|
||||||
|
BIN
ReCodeItGUI_WPF/Assets/wpfui-icon-1024.png
Normal file
BIN
ReCodeItGUI_WPF/Assets/wpfui-icon-1024.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
BIN
ReCodeItGUI_WPF/Assets/wpfui-icon-256.png
Normal file
BIN
ReCodeItGUI_WPF/Assets/wpfui-icon-256.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
36
ReCodeItGUI_WPF/Helpers/EnumToBooleanConverter.cs
Normal file
36
ReCodeItGUI_WPF/Helpers/EnumToBooleanConverter.cs
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using Wpf.Ui.Appearance;
|
||||||
|
|
||||||
|
namespace ReCodeItGUI_WPF.Helpers
|
||||||
|
{
|
||||||
|
internal class EnumToBooleanConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (parameter is not String enumString)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("ExceptionEnumToBooleanConverterParameterMustBeAnEnumName");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Enum.IsDefined(typeof(ApplicationTheme), value))
|
||||||
|
{
|
||||||
|
throw new ArgumentException("ExceptionEnumToBooleanConverterValueMustBeAnEnum");
|
||||||
|
}
|
||||||
|
|
||||||
|
var enumValue = Enum.Parse(typeof(ApplicationTheme), enumString);
|
||||||
|
|
||||||
|
return enumValue.Equals(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (parameter is not String enumString)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("ExceptionEnumToBooleanConverterParameterMustBeAnEnumName");
|
||||||
|
}
|
||||||
|
|
||||||
|
return Enum.Parse(typeof(ApplicationTheme), enumString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,156 +0,0 @@
|
|||||||
using Microsoft.Win32;
|
|
||||||
using ReCodeIt.Models;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using Xceed.Wpf.Toolkit;
|
|
||||||
|
|
||||||
namespace ReCodeItGUI_WPF.Helpers
|
|
||||||
{
|
|
||||||
internal static class GUIExtentions
|
|
||||||
{
|
|
||||||
#region EXT_METHODS
|
|
||||||
|
|
||||||
public static void AddToListView(this ListView listView, TextBox textBox)
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrWhiteSpace(textBox.Text) && !listView.Items.Contains(textBox.Text))
|
|
||||||
{
|
|
||||||
listView.Items.Add(textBox.Text);
|
|
||||||
textBox.Clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void RemoveSelectedItem(this ListView listView)
|
|
||||||
{
|
|
||||||
if (listView.SelectedItem != null)
|
|
||||||
{
|
|
||||||
listView.Items.RemoveAt(listView.SelectedIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion EXT_METHODS
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the string result of the dialog
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Path if valid, or empty string</returns>
|
|
||||||
public static string OpenFileDialog(bool dll = false)
|
|
||||||
{
|
|
||||||
var title = dll ? "Select a DLL File" : "Select a Json File";
|
|
||||||
|
|
||||||
var defaultExt = dll ? ".dll" : ".jsonc";
|
|
||||||
|
|
||||||
var dllFilter = "DLL files (*.dll)|*.dll|All files (*.*)|*.*";
|
|
||||||
var jsonFilter = "JSON/JSONC files (*.json;*.jsonc)|*.json;*.jsonc|All files (*.*)|*.*";
|
|
||||||
|
|
||||||
var openFileDialog = new OpenFileDialog();
|
|
||||||
openFileDialog.Title = title;
|
|
||||||
openFileDialog.Filter = dll ? dllFilter : jsonFilter;
|
|
||||||
openFileDialog.DefaultExt = defaultExt;
|
|
||||||
|
|
||||||
bool? result = openFileDialog.ShowDialog();
|
|
||||||
|
|
||||||
if (result == true)
|
|
||||||
{
|
|
||||||
return openFileDialog.FileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static RemapModel CreateRemapFromGui(this MainWindow window)
|
|
||||||
{
|
|
||||||
var model = new RemapModel
|
|
||||||
{
|
|
||||||
NewTypeName = window.NewTypeNameTextBox.Text,
|
|
||||||
OriginalTypeName = window.OriginalTypeNameTextBox.Text ?? string.Empty,
|
|
||||||
UseForceRename = (bool)window.UseForceRenameCheckbox.IsChecked,
|
|
||||||
SearchParams = new SearchParams
|
|
||||||
{
|
|
||||||
IsPublic = window.IsPublicComboBox.IsComboEnabled(),
|
|
||||||
IsAbstract = window.IsAbstractComboBox.IsComboEnabled(),
|
|
||||||
IsInterface = window.IsInterfaceComboBox.IsComboEnabled(),
|
|
||||||
IsEnum = window.IsEnumComboBox.IsComboEnabled(),
|
|
||||||
IsNested = window.IsNestedComboBox.IsComboEnabled(),
|
|
||||||
IsSealed = window.IsSealedComboBox.IsComboEnabled(),
|
|
||||||
HasAttribute = window.HasAttributeComboBox.IsComboEnabled(),
|
|
||||||
IsDerived = window.IsDerivedComboBox.IsComboEnabled(),
|
|
||||||
HasGenericParameters = window.HasAttributeComboBox.IsComboEnabled(),
|
|
||||||
ParentName = window.ParentNameTextBox.GetText(),
|
|
||||||
MatchBaseClass = window.IncludeBaseClassTextBox.GetText(),
|
|
||||||
IgnoreBaseClass = window.IgnoreBaseClassTextBox.GetText(),
|
|
||||||
ConstructorParameterCount = window.CtorParamCountUpDown.GetValIfEnabled(window.CtorCheckbox),
|
|
||||||
MethodCount = window.MethodCountUpDown.GetValIfEnabled(window.MethodCheckbox),
|
|
||||||
FieldCount = window.FieldCountUpDown.GetValIfEnabled(window.FieldCountCheckbox),
|
|
||||||
PropertyCount = window.PropertyCountUpDown.GetValIfEnabled(window.PropertyCountCheckBox),
|
|
||||||
NestedTypeCount = window.NestedTypeCountUpDown.GetValIfEnabled(window.NestedTypeCountCheckBox),
|
|
||||||
IncludeMethods = window.MethodIncludeListView.GetItems(),
|
|
||||||
ExcludeMethods = window.MethodExcludeListView.GetItems(),
|
|
||||||
IncludeFields = window.FieldIncludeListView.GetItems(),
|
|
||||||
ExcludeFields = window.FieldExcludeListView.GetItems(),
|
|
||||||
IncludeProperties = window.PropertyIncludeListBox.GetItems(),
|
|
||||||
ExcludeProperties = window.PropertyExcludeListBox.GetItems(),
|
|
||||||
IncludeNestedTypes = window.NestedTypeIncludeListView.GetItems(),
|
|
||||||
ExcludeNestedTypes = window.NestedTypeExcludeListView.GetItems(),
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return model;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// True or false if selected, otherwise null
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="comboBox"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static bool? IsComboEnabled(this ComboBox comboBox)
|
|
||||||
{
|
|
||||||
if (bool.TryParse(comboBox.Text, out var result))
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// returns the text in the box if exists, or null
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="textBox"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static string? GetText(this TextBox textBox)
|
|
||||||
{
|
|
||||||
if (textBox.Text != string.Empty)
|
|
||||||
{
|
|
||||||
return textBox.Text;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int? GetValIfEnabled(this IntegerUpDown intUpDown, CheckBox cBox)
|
|
||||||
{
|
|
||||||
if ((bool)cBox.IsChecked)
|
|
||||||
{
|
|
||||||
return intUpDown.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Converts list view objects to string list
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="listView"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static List<string> GetItems(this ListView listView)
|
|
||||||
{
|
|
||||||
var tmp = new List<string>();
|
|
||||||
|
|
||||||
foreach (var item in listView.Items)
|
|
||||||
{
|
|
||||||
tmp.Add(item.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,197 +0,0 @@
|
|||||||
<Window x:Class="ReCodeItGUI_WPF.MainWindow"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
xmlns:local="clr-namespace:ReCodeItGUI_WPF"
|
|
||||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
Title="ReCodeIt V0.1.0" Height="800" Width="1216" Background="#FF676464">
|
|
||||||
<Canvas>
|
|
||||||
<TabControl Height="784" Width="1216.2" Background="#FF595454" HorizontalAlignment="Center" VerticalAlignment="Top">
|
|
||||||
<TabItem Header="Manual ReMapper">
|
|
||||||
<TabItem.Background>
|
|
||||||
<LinearGradientBrush EndPoint="0,1">
|
|
||||||
<GradientStop Color="#FFF0F0F0" />
|
|
||||||
<GradientStop Color="#FF474242" Offset="1" />
|
|
||||||
</LinearGradientBrush>
|
|
||||||
</TabItem.Background>
|
|
||||||
<Grid Background="#FF595454">
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Rectangle HorizontalAlignment="Left" Height="228" Margin="374,10,0,0" Stroke="Black" VerticalAlignment="Top" Width="813" />
|
|
||||||
<Rectangle HorizontalAlignment="Left" Height="244" Margin="374,243,0,0" Stroke="Black" VerticalAlignment="Top" Width="405" />
|
|
||||||
<Rectangle HorizontalAlignment="Left" Height="114" Margin="10,10,0,0" Stroke="Black" VerticalAlignment="Top" Width="360" />
|
|
||||||
<TextBox x:Name="NewTypeNameTextBox" HorizontalAlignment="Left" Margin="20,21,0,0" TextWrapping="Wrap" Text="New Type Name" VerticalAlignment="Top" Width="120" />
|
|
||||||
<TextBox x:Name="OriginalTypeNameTextBox" HorizontalAlignment="Left" Margin="20,44,0,0" TextWrapping="Wrap" Text="Original Type Name" VerticalAlignment="Top" Width="120" />
|
|
||||||
<Button x:Name="SaveRemapButton" Content="Save Remap" HorizontalAlignment="Left" Margin="276,22,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.492,0.856" Width="86" Click="SaveRemapButton_Click" />
|
|
||||||
<Button x:Name="RemoveRemapButton" Content="Remove Remap" HorizontalAlignment="Left" Margin="276,47,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.492,0.856" />
|
|
||||||
<Button x:Name="RunRemapButton" Content="Run Remap" HorizontalAlignment="Left" Margin="276,72,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.492,0.856" Width="86" />
|
|
||||||
<CheckBox x:Name="UseForceRenameCheckbox" Content="Use Force Rename" HorizontalAlignment="Left" Margin="20,70,0,0" VerticalAlignment="Top" />
|
|
||||||
<ComboBox x:Name="IsNestedComboBox" HorizontalAlignment="Left" Margin="378,42,0,0" VerticalAlignment="Top" Width="120" IsReadOnly="True">
|
|
||||||
<ComboBoxItem Content="True" />
|
|
||||||
<ComboBoxItem Content="False" />
|
|
||||||
</ComboBox>
|
|
||||||
<Label Content="General section" HorizontalAlignment="Left" Margin="377,13,0,0" VerticalAlignment="Top" />
|
|
||||||
<ComboBox x:Name="IsPublicComboBox" HorizontalAlignment="Left" Margin="378,69,0,0" VerticalAlignment="Top" Width="120" IsReadOnly="True">
|
|
||||||
<ComboBoxItem Content="True" />
|
|
||||||
<ComboBoxItem Content="False" />
|
|
||||||
</ComboBox>
|
|
||||||
<ComboBox x:Name="IsAbstractComboBox" HorizontalAlignment="Left" Margin="378,96,0,0" VerticalAlignment="Top" Width="120" IsReadOnly="True">
|
|
||||||
<ComboBoxItem Content="True" />
|
|
||||||
<ComboBoxItem Content="False" />
|
|
||||||
</ComboBox>
|
|
||||||
<ComboBox x:Name="IsInterfaceComboBox" HorizontalAlignment="Left" Margin="570,42,0,0" VerticalAlignment="Top" Width="120" IsReadOnly="True">
|
|
||||||
<ComboBoxItem Content="True" />
|
|
||||||
<ComboBoxItem Content="False" />
|
|
||||||
</ComboBox>
|
|
||||||
<ComboBox x:Name="IsSealedComboBox" HorizontalAlignment="Left" Margin="570,69,0,0" VerticalAlignment="Top" Width="120" IsReadOnly="True">
|
|
||||||
<ComboBoxItem Content="True" />
|
|
||||||
<ComboBoxItem Content="False" />
|
|
||||||
</ComboBox>
|
|
||||||
<ComboBox x:Name="IsEnumComboBox" HorizontalAlignment="Left" Margin="570,96,0,0" VerticalAlignment="Top" Width="120" IsReadOnly="True">
|
|
||||||
<ComboBoxItem Content="True" />
|
|
||||||
<ComboBoxItem Content="False" />
|
|
||||||
</ComboBox>
|
|
||||||
<ComboBox x:Name="HasAttributeComboBox" HorizontalAlignment="Left" Margin="768,44,0,0" VerticalAlignment="Top" Width="120" IsReadOnly="True">
|
|
||||||
<ComboBoxItem Content="True" />
|
|
||||||
<ComboBoxItem Content="False" />
|
|
||||||
</ComboBox>
|
|
||||||
<ComboBox x:Name="IsDerivedComboBox" HorizontalAlignment="Left" Margin="768,71,0,0" VerticalAlignment="Top" Width="120" IsReadOnly="True">
|
|
||||||
<ComboBoxItem Content="True" />
|
|
||||||
<ComboBoxItem Content="False" />
|
|
||||||
</ComboBox>
|
|
||||||
<ComboBox x:Name="HasGenericParamsComboBox" HorizontalAlignment="Left" Margin="768,98,0,0" VerticalAlignment="Top" Width="120" IsReadOnly="True">
|
|
||||||
<ComboBoxItem Content="True" />
|
|
||||||
<ComboBoxItem Content="False" />
|
|
||||||
</ComboBox>
|
|
||||||
<TextBox x:Name="ParentNameTextBox" HorizontalAlignment="Left" Margin="378,124,0,0" TextWrapping="Wrap" Text="Parent Name" VerticalAlignment="Top" Width="120" />
|
|
||||||
<TextBox x:Name="IncludeBaseClassTextBox" HorizontalAlignment="Left" Margin="378,151,0,0" TextWrapping="Wrap" Text="Include base class" VerticalAlignment="Top" Width="120" />
|
|
||||||
<TextBox x:Name="IgnoreBaseClassTextBox" HorizontalAlignment="Left" Margin="378,178,0,0" TextWrapping="Wrap" Text="Ignore base class" VerticalAlignment="Top" Width="120" />
|
|
||||||
<xctk:IntegerUpDown x:Name="CtorParamCountUpDown" FormatString="N0" Value="0" Increment="1" Minimum="0" Maximum="40" Margin="378,206,756,528" />
|
|
||||||
<xctk:IntegerUpDown x:Name="MethodCountUpDown" FormatString="N0" Value="0" Increment="1" Minimum="0" Maximum="40" Margin="480,338,654,396" />
|
|
||||||
<CheckBox x:Name="CtorCheckbox" Content="Constructor Param Count" HorizontalAlignment="Left" Margin="444,209,0,0" VerticalAlignment="Top" />
|
|
||||||
<CheckBox x:Name="MethodCheckbox" Content="Method Count" HorizontalAlignment="Left" Margin="479,320,0,0" VerticalAlignment="Top" />
|
|
||||||
<ListView x:Name="MethodIncludeListView" d:ItemsSource="{d:SampleData ItemCount=5}" Margin="378,261,732,283" Width="100" Height="212.06">
|
|
||||||
<ListView.View>
|
|
||||||
<GridView>
|
|
||||||
<GridViewColumn Header="Methods" />
|
|
||||||
</GridView>
|
|
||||||
</ListView.View>
|
|
||||||
</ListView>
|
|
||||||
<ListView x:Name="MethodExcludeListView" d:ItemsSource="{d:SampleData ItemCount=5}" Margin="676,262,434,282" Height="212.04" Width="100">
|
|
||||||
<ListView.View>
|
|
||||||
<GridView>
|
|
||||||
<GridViewColumn Header="Methods" />
|
|
||||||
</GridView>
|
|
||||||
</ListView.View>
|
|
||||||
</ListView>
|
|
||||||
<TextBox x:Name="MethodTextBox" HorizontalAlignment="Left" Margin="480,263,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="193" />
|
|
||||||
<Button x:Name="MethodIncludeButton" Content="Include" HorizontalAlignment="Left" Margin="480,283,0,0" VerticalAlignment="Top" Width="63" Height="34" Click="MethodIncludeButton_Click" />
|
|
||||||
<Button x:Name="MethodExcludeButton" Content="Exclude" HorizontalAlignment="Left" Margin="610,283,0,0" VerticalAlignment="Top" Width="63" Height="34" Click="MethodExcludeButton_Click" />
|
|
||||||
<Button x:Name="MethodRemoveButton" Content="Remove" HorizontalAlignment="Left" Margin="545,283,0,0" VerticalAlignment="Top" Width="63" Height="34" Click="MethodRemoveButton_Click" />
|
|
||||||
<Rectangle HorizontalAlignment="Left" Height="244" Margin="374,489,0,0" Stroke="Black" VerticalAlignment="Top" Width="405" />
|
|
||||||
<xctk:IntegerUpDown x:Name="FieldCountUpDown" FormatString="N0" Value="0" Increment="1" Minimum="0" Maximum="40" Margin="480,597,654,136" />
|
|
||||||
<CheckBox x:Name="FieldCountCheckbox" Content="Field Count" HorizontalAlignment="Left" Margin="479,579,0,0" VerticalAlignment="Top" />
|
|
||||||
<ListView x:Name="FieldIncludeListView" d:ItemsSource="{d:SampleData ItemCount=5}" Margin="377,517,733,27" Width="100" Height="212.04">
|
|
||||||
<ListView.View>
|
|
||||||
<GridView>
|
|
||||||
<GridViewColumn Header="Field" />
|
|
||||||
</GridView>
|
|
||||||
</ListView.View>
|
|
||||||
</ListView>
|
|
||||||
<ListView x:Name="FieldExcludeListView" d:ItemsSource="{d:SampleData ItemCount=5}" Margin="676,517,434,27" Height="212.04" Width="100">
|
|
||||||
<ListView.View>
|
|
||||||
<GridView>
|
|
||||||
<GridViewColumn Header="Field" />
|
|
||||||
</GridView>
|
|
||||||
</ListView.View>
|
|
||||||
</ListView>
|
|
||||||
<TextBox x:Name="FieldTextBox" HorizontalAlignment="Left" Margin="480,518,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="193" />
|
|
||||||
<Button x:Name="FieldIncludeButton" Content="Include" HorizontalAlignment="Left" Margin="480,541,0,0" VerticalAlignment="Top" Width="63" Height="34" Click="FieldIncludeButton_Click" />
|
|
||||||
<Button x:Name="FieldExcludeButton" Content="Exclude" HorizontalAlignment="Left" Margin="611,541,0,0" VerticalAlignment="Top" Width="63" Height="34" Click="FieldExcludeButton_Click" />
|
|
||||||
<Button x:Name="FieldRemoveButton" Content="Remove" HorizontalAlignment="Left" Margin="545,541,0,0" VerticalAlignment="Top" Width="64" Height="34" Click="FieldRemoveButton_Click" />
|
|
||||||
<Rectangle HorizontalAlignment="Left" Height="244" Margin="783,489,0,0" Stroke="Black" VerticalAlignment="Top" Width="405" />
|
|
||||||
<xctk:IntegerUpDown x:Name="PropertyCountUpDown" FormatString="N0" Value="0" Increment="1" Minimum="0" Maximum="40" Margin="889,601,245,133" />
|
|
||||||
<CheckBox x:Name="PropertyCountCheckBox" Content="Property Count" HorizontalAlignment="Left" Margin="888,583,0,0" VerticalAlignment="Top" />
|
|
||||||
<ListView x:Name="PropertyIncludeListBox" d:ItemsSource="{d:SampleData ItemCount=5}" Margin="787,517,323,27" Width="100">
|
|
||||||
<ListView.View>
|
|
||||||
<GridView>
|
|
||||||
<GridViewColumn Header="Property" />
|
|
||||||
</GridView>
|
|
||||||
</ListView.View>
|
|
||||||
</ListView>
|
|
||||||
<ListView x:Name="PropertyExcludeListBox" d:ItemsSource="{d:SampleData ItemCount=5}" Margin="1084,518,26,26" Width="100">
|
|
||||||
<ListView.View>
|
|
||||||
<GridView>
|
|
||||||
<GridViewColumn Header="Property" />
|
|
||||||
</GridView>
|
|
||||||
</ListView.View>
|
|
||||||
</ListView>
|
|
||||||
<TextBox x:Name="PropertyTextBox" HorizontalAlignment="Left" Margin="889,518,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="193" Height="19" />
|
|
||||||
<Button x:Name="PropertyIncludeButton" Content="Include" HorizontalAlignment="Left" Margin="889,543,0,0" VerticalAlignment="Top" Height="34" Width="63" Click="PropertyIncludeButton_Click" />
|
|
||||||
<Button x:Name="PropertyExcludeButton" Content="Exclude" HorizontalAlignment="Left" Margin="1020,542,0,0" VerticalAlignment="Top" Height="35" Width="63" Click="PropertyExcludeButton_Click" />
|
|
||||||
<Button x:Name="PropertyRemoveButton" Content="Remove" HorizontalAlignment="Left" Margin="955,542,0,0" VerticalAlignment="Top" Height="35" Width="63" Click="PropertyRemoveButton_Click" />
|
|
||||||
<Rectangle HorizontalAlignment="Left" Height="244" Margin="783,243,0,0" Stroke="Black" VerticalAlignment="Top" Width="405" />
|
|
||||||
<xctk:IntegerUpDown x:Name="NestedTypeCountUpDown" FormatString="N0" Value="0" Increment="1" Minimum="0" Maximum="40" Margin="890,340,244,394" />
|
|
||||||
<CheckBox x:Name="NestedTypeCountCheckBox" Content="Nested Type Count" HorizontalAlignment="Left" Margin="889,322,0,0" VerticalAlignment="Top" />
|
|
||||||
<ListView x:Name="NestedTypeIncludeListView" d:ItemsSource="{d:SampleData ItemCount=5}" Margin="786,261,324,283" Width="100" Height="212.04">
|
|
||||||
<ListView.View>
|
|
||||||
<GridView>
|
|
||||||
<GridViewColumn Header="Nested Type" />
|
|
||||||
</GridView>
|
|
||||||
</ListView.View>
|
|
||||||
</ListView>
|
|
||||||
<ListView x:Name="NestedTypeExcludeListView" d:ItemsSource="{d:SampleData ItemCount=5}" Margin="1085,260,25,284" Height="212.04" Width="100">
|
|
||||||
<ListView.View>
|
|
||||||
<GridView>
|
|
||||||
<GridViewColumn Header="Nested Type" />
|
|
||||||
</GridView>
|
|
||||||
</ListView.View>
|
|
||||||
</ListView>
|
|
||||||
<TextBox x:Name="NestTypeTextBox" HorizontalAlignment="Left" Margin="890,261,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="193" />
|
|
||||||
<Button x:Name="NestedTypeIncludeAddButton" Content="Include" HorizontalAlignment="Left" Margin="890,282,0,0" VerticalAlignment="Top" Width="63" Height="34" Click="NestedTypeIncludeAddButton_Click" />
|
|
||||||
<Button x:Name="NestedTypeExcludeButton" Content="Exclude" HorizontalAlignment="Left" Margin="1020,282,0,0" VerticalAlignment="Top" Width="63" Height="34" Click="NestedTypeExcludeButton_Click" />
|
|
||||||
<Button x:Name="NestedTypeRemoveButton" Content="Remove" HorizontalAlignment="Left" Margin="955,282,0,0" VerticalAlignment="Top" Width="63" Height="34" Click="NestedTypeRemoveButton_Click" />
|
|
||||||
<Label Content="Is Nested" HorizontalAlignment="Left" Margin="503,40,0,0" VerticalAlignment="Top" Width="227" />
|
|
||||||
<Label Content="Is Public" HorizontalAlignment="Left" Margin="503,66,0,0" VerticalAlignment="Top" Width="227" />
|
|
||||||
<Label Content="Is Abstract" HorizontalAlignment="Left" Margin="503,92,0,0" VerticalAlignment="Top" Width="227" />
|
|
||||||
<Label Content="Is Interface" HorizontalAlignment="Left" Margin="694,40,0,0" VerticalAlignment="Top" Width="228" />
|
|
||||||
<Label Content="Is Sealed" HorizontalAlignment="Left" Margin="694,67,0,0" VerticalAlignment="Top" Width="228" />
|
|
||||||
<Label Content="Is Enum" HorizontalAlignment="Left" Margin="694,94,0,0" VerticalAlignment="Top" Width="228" />
|
|
||||||
<Label Content="Has Attribute" HorizontalAlignment="Left" Margin="893,42,0,0" VerticalAlignment="Top" Width="227" />
|
|
||||||
<Label Content="Is Derived" HorizontalAlignment="Left" Margin="893,69,0,0" VerticalAlignment="Top" Width="227" />
|
|
||||||
<Label Content="Has Generic Parameters" HorizontalAlignment="Left" Margin="893,94,0,0" VerticalAlignment="Top" Width="227" />
|
|
||||||
<TreeView x:Name="RemapTreeView" Margin="6,153,840,23" Background="#FF484646" />
|
|
||||||
<Label Content="Remaps" HorizontalAlignment="Left" Margin="10,129,0,0" VerticalAlignment="Top" />
|
|
||||||
</Grid>
|
|
||||||
</TabItem>
|
|
||||||
<TabItem Header="Auto ReMapper">
|
|
||||||
<TabItem.Background>
|
|
||||||
<LinearGradientBrush EndPoint="0,1">
|
|
||||||
<GradientStop Color="#FFF0F0F0" />
|
|
||||||
<GradientStop Color="#FF595454" Offset="1" />
|
|
||||||
</LinearGradientBrush>
|
|
||||||
</TabItem.Background>
|
|
||||||
<Grid Background="#FF595454" />
|
|
||||||
</TabItem>
|
|
||||||
<TabItem Header="Database">
|
|
||||||
<TabItem.Background>
|
|
||||||
<LinearGradientBrush EndPoint="0,1">
|
|
||||||
<GradientStop Color="#FFF0F0F0" />
|
|
||||||
<GradientStop Color="#FF595454" Offset="1" />
|
|
||||||
</LinearGradientBrush>
|
|
||||||
</TabItem.Background>
|
|
||||||
</TabItem>
|
|
||||||
<TabItem BorderBrush="#FF8A8282" Header="Settings">
|
|
||||||
<TabItem.Background>
|
|
||||||
<LinearGradientBrush EndPoint="0,1">
|
|
||||||
<GradientStop Color="#FFF0F0F0" Offset="0.33" />
|
|
||||||
<GradientStop Color="#FF595454" Offset="1" />
|
|
||||||
</LinearGradientBrush>
|
|
||||||
</TabItem.Background>
|
|
||||||
</TabItem>
|
|
||||||
</TabControl>
|
|
||||||
</Canvas>
|
|
||||||
</Window>
|
|
@ -1,94 +0,0 @@
|
|||||||
using ReCodeIt.Utils;
|
|
||||||
using ReCodeItGUI_WPF.Helpers;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Input;
|
|
||||||
|
|
||||||
namespace ReCodeItGUI_WPF;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Interaction logic for MainWindow.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class MainWindow : Window
|
|
||||||
{
|
|
||||||
private ICommand deleteCommand;
|
|
||||||
|
|
||||||
public MainWindow()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
DataProvider.LoadAppSettings();
|
|
||||||
DataProvider.LoadMappingFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
#region MANUAL_REMAPPER
|
|
||||||
|
|
||||||
private void SaveRemapButton_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
this.CreateRemapFromGui();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MethodIncludeButton_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
MethodIncludeListView.AddToListView(MethodTextBox);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MethodExcludeButton_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
MethodExcludeListView.AddToListView(MethodTextBox);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MethodRemoveButton_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
MethodIncludeListView.RemoveSelectedItem();
|
|
||||||
MethodExcludeListView.RemoveSelectedItem();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FieldIncludeButton_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
FieldIncludeListView.AddToListView(FieldTextBox);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FieldExcludeButton_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
FieldExcludeListView.AddToListView(FieldTextBox);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FieldRemoveButton_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
FieldIncludeListView.RemoveSelectedItem();
|
|
||||||
FieldExcludeListView.RemoveSelectedItem();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PropertyIncludeButton_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
PropertyIncludeListBox.AddToListView(PropertyTextBox);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PropertyExcludeButton_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
PropertyExcludeListBox.AddToListView(PropertyTextBox);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PropertyRemoveButton_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
PropertyIncludeListBox.RemoveSelectedItem();
|
|
||||||
PropertyExcludeListBox.RemoveSelectedItem();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void NestedTypeIncludeAddButton_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
NestedTypeIncludeListView.AddToListView(NestTypeTextBox);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void NestedTypeExcludeButton_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
NestedTypeExcludeListView.AddToListView(NestTypeTextBox);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void NestedTypeRemoveButton_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
NestedTypeIncludeListView.RemoveSelectedItem();
|
|
||||||
NestedTypeExcludeListView.RemoveSelectedItem();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion MANUAL_REMAPPER
|
|
||||||
}
|
|
9
ReCodeItGUI_WPF/Models/AppConfig.cs
Normal file
9
ReCodeItGUI_WPF/Models/AppConfig.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
namespace ReCodeItGUI_WPF.Models
|
||||||
|
{
|
||||||
|
public class AppConfig
|
||||||
|
{
|
||||||
|
public string ConfigurationsFolder { get; set; }
|
||||||
|
|
||||||
|
public string AppPropertiesFileName { get; set; }
|
||||||
|
}
|
||||||
|
}
|
9
ReCodeItGUI_WPF/Models/DataColor.cs
Normal file
9
ReCodeItGUI_WPF/Models/DataColor.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace ReCodeItGUI_WPF.Models
|
||||||
|
{
|
||||||
|
public struct DataColor
|
||||||
|
{
|
||||||
|
public Brush Color { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,23 +1,33 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
<Nullable>disable</Nullable>
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ApplicationIcon>wpfui-icon.ico</ApplicationIcon>
|
||||||
<UseWPF>true</UseWPF>
|
<UseWPF>true</UseWPF>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Extended.Wpf.Toolkit" Version="4.6.0" />
|
<Content Include="wpfui-icon.ico" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\RecodeItLib\ReCodeItLib.csproj" />
|
<PackageReference Include="WPF-UI" Version="3.0.4" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
|
||||||
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2 "/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
<ItemGroup>
|
||||||
<Exec Command="xcopy "$(SolutionDir)Templates" "$(TargetDir)Data" /E /I /Y" />
|
<None Remove="Assets\wpfui-icon-256.png" />
|
||||||
</Target>
|
<None Remove="Assets\wpfui-icon-1024.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="Assets\wpfui-icon-256.png" />
|
||||||
|
<Resource Include="Assets\wpfui-icon-1024.png" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
6
ReCodeItGUI_WPF/Resources/Translations.cs
Normal file
6
ReCodeItGUI_WPF/Resources/Translations.cs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
namespace ReCodeItGUI_WPF.Resources
|
||||||
|
{
|
||||||
|
public partial class Translations
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
59
ReCodeItGUI_WPF/Services/ApplicationHostService.cs
Normal file
59
ReCodeItGUI_WPF/Services/ApplicationHostService.cs
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using ReCodeItGUI_WPF.Views.Pages;
|
||||||
|
using ReCodeItGUI_WPF.Views.Windows;
|
||||||
|
using Wpf.Ui;
|
||||||
|
|
||||||
|
namespace ReCodeItGUI_WPF.Services
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Managed host of the application.
|
||||||
|
/// </summary>
|
||||||
|
public class ApplicationHostService : IHostedService
|
||||||
|
{
|
||||||
|
private readonly IServiceProvider _serviceProvider;
|
||||||
|
|
||||||
|
private INavigationWindow _navigationWindow;
|
||||||
|
|
||||||
|
public ApplicationHostService(IServiceProvider serviceProvider)
|
||||||
|
{
|
||||||
|
_serviceProvider = serviceProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Triggered when the application host is ready to start the service.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cancellationToken">Indicates that the start process has been aborted.</param>
|
||||||
|
public async Task StartAsync(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
await HandleActivationAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Triggered when the application host is performing a graceful shutdown.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cancellationToken">Indicates that the shutdown process should no longer be graceful.</param>
|
||||||
|
public async Task StopAsync(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
await Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates main window during activation.
|
||||||
|
/// </summary>
|
||||||
|
private async Task HandleActivationAsync()
|
||||||
|
{
|
||||||
|
if (!Application.Current.Windows.OfType<MainWindow>().Any())
|
||||||
|
{
|
||||||
|
_navigationWindow = (
|
||||||
|
_serviceProvider.GetService(typeof(INavigationWindow)) as INavigationWindow
|
||||||
|
)!;
|
||||||
|
_navigationWindow!.ShowWindow();
|
||||||
|
|
||||||
|
_navigationWindow.Navigate(typeof(Views.Pages.DashboardPage));
|
||||||
|
}
|
||||||
|
|
||||||
|
await Task.CompletedTask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
42
ReCodeItGUI_WPF/Services/PageService.cs
Normal file
42
ReCodeItGUI_WPF/Services/PageService.cs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
using Wpf.Ui;
|
||||||
|
|
||||||
|
namespace ReCodeItGUI_WPF.Services
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Service that provides pages for navigation.
|
||||||
|
/// </summary>
|
||||||
|
public class PageService : IPageService
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Service which provides the instances of pages.
|
||||||
|
/// </summary>
|
||||||
|
private readonly IServiceProvider _serviceProvider;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates new instance and attaches the <see cref="IServiceProvider"/>.
|
||||||
|
/// </summary>
|
||||||
|
public PageService(IServiceProvider serviceProvider)
|
||||||
|
{
|
||||||
|
_serviceProvider = serviceProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public T? GetPage<T>()
|
||||||
|
where T : class
|
||||||
|
{
|
||||||
|
if (!typeof(FrameworkElement).IsAssignableFrom(typeof(T)))
|
||||||
|
throw new InvalidOperationException("The page should be a WPF control.");
|
||||||
|
|
||||||
|
return (T?)_serviceProvider.GetService(typeof(T));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public FrameworkElement? GetPage(Type pageType)
|
||||||
|
{
|
||||||
|
if (!typeof(FrameworkElement).IsAssignableFrom(pageType))
|
||||||
|
throw new InvalidOperationException("The page should be a WPF control.");
|
||||||
|
|
||||||
|
return _serviceProvider.GetService(pageType) as FrameworkElement;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
4
ReCodeItGUI_WPF/Usings.cs
Normal file
4
ReCodeItGUI_WPF/Usings.cs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
global using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
global using CommunityToolkit.Mvvm.Input;
|
||||||
|
global using System;
|
||||||
|
global using System.Windows;
|
14
ReCodeItGUI_WPF/ViewModels/Pages/DashboardViewModel.cs
Normal file
14
ReCodeItGUI_WPF/ViewModels/Pages/DashboardViewModel.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
namespace ReCodeItGUI_WPF.ViewModels.Pages
|
||||||
|
{
|
||||||
|
public partial class DashboardViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
[ObservableProperty]
|
||||||
|
private int _counter = 0;
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void OnCounterIncrement()
|
||||||
|
{
|
||||||
|
Counter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
47
ReCodeItGUI_WPF/ViewModels/Pages/DataViewModel.cs
Normal file
47
ReCodeItGUI_WPF/ViewModels/Pages/DataViewModel.cs
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
using ReCodeItGUI_WPF.Models;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Wpf.Ui.Controls;
|
||||||
|
|
||||||
|
namespace ReCodeItGUI_WPF.ViewModels.Pages
|
||||||
|
{
|
||||||
|
public partial class DataViewModel : ObservableObject, INavigationAware
|
||||||
|
{
|
||||||
|
private bool _isInitialized = false;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private IEnumerable<DataColor> _colors;
|
||||||
|
|
||||||
|
public void OnNavigatedTo()
|
||||||
|
{
|
||||||
|
if (!_isInitialized)
|
||||||
|
InitializeViewModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnNavigatedFrom() { }
|
||||||
|
|
||||||
|
private void InitializeViewModel()
|
||||||
|
{
|
||||||
|
var random = new Random();
|
||||||
|
var colorCollection = new List<DataColor>();
|
||||||
|
|
||||||
|
for (int i = 0; i < 8192; i++)
|
||||||
|
colorCollection.Add(
|
||||||
|
new DataColor
|
||||||
|
{
|
||||||
|
Color = new SolidColorBrush(
|
||||||
|
Color.FromArgb(
|
||||||
|
(byte)200,
|
||||||
|
(byte)random.Next(0, 250),
|
||||||
|
(byte)random.Next(0, 250),
|
||||||
|
(byte)random.Next(0, 250)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
Colors = colorCollection;
|
||||||
|
|
||||||
|
_isInitialized = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
63
ReCodeItGUI_WPF/ViewModels/Pages/SettingsViewModel.cs
Normal file
63
ReCodeItGUI_WPF/ViewModels/Pages/SettingsViewModel.cs
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
using Wpf.Ui.Appearance;
|
||||||
|
using Wpf.Ui.Controls;
|
||||||
|
|
||||||
|
namespace ReCodeItGUI_WPF.ViewModels.Pages
|
||||||
|
{
|
||||||
|
public partial class SettingsViewModel : ObservableObject, INavigationAware
|
||||||
|
{
|
||||||
|
private bool _isInitialized = false;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _appVersion = String.Empty;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private ApplicationTheme _currentTheme = ApplicationTheme.Unknown;
|
||||||
|
|
||||||
|
public void OnNavigatedTo()
|
||||||
|
{
|
||||||
|
if (!_isInitialized)
|
||||||
|
InitializeViewModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnNavigatedFrom() { }
|
||||||
|
|
||||||
|
private void InitializeViewModel()
|
||||||
|
{
|
||||||
|
CurrentTheme = ApplicationThemeManager.GetAppTheme();
|
||||||
|
AppVersion = $"UiDesktopApp1 - {GetAssemblyVersion()}";
|
||||||
|
|
||||||
|
_isInitialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetAssemblyVersion()
|
||||||
|
{
|
||||||
|
return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version?.ToString()
|
||||||
|
?? String.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private void OnChangeTheme(string parameter)
|
||||||
|
{
|
||||||
|
switch (parameter)
|
||||||
|
{
|
||||||
|
case "theme_light":
|
||||||
|
if (CurrentTheme == ApplicationTheme.Light)
|
||||||
|
break;
|
||||||
|
|
||||||
|
ApplicationThemeManager.Apply(ApplicationTheme.Light);
|
||||||
|
CurrentTheme = ApplicationTheme.Light;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
if (CurrentTheme == ApplicationTheme.Dark)
|
||||||
|
break;
|
||||||
|
|
||||||
|
ApplicationThemeManager.Apply(ApplicationTheme.Dark);
|
||||||
|
CurrentTheme = ApplicationTheme.Dark;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
45
ReCodeItGUI_WPF/ViewModels/Windows/MainWindowViewModel.cs
Normal file
45
ReCodeItGUI_WPF/ViewModels/Windows/MainWindowViewModel.cs
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using Wpf.Ui.Controls;
|
||||||
|
|
||||||
|
namespace ReCodeItGUI_WPF.ViewModels.Windows
|
||||||
|
{
|
||||||
|
public partial class MainWindowViewModel : ObservableObject
|
||||||
|
{
|
||||||
|
[ObservableProperty]
|
||||||
|
private string _applicationTitle = "WPF UI - ReCodeItGUI_WPF";
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private ObservableCollection<object> _menuItems = new()
|
||||||
|
{
|
||||||
|
new NavigationViewItem()
|
||||||
|
{
|
||||||
|
Content = "Home",
|
||||||
|
Icon = new SymbolIcon { Symbol = SymbolRegular.Home24 },
|
||||||
|
TargetPageType = typeof(Views.Pages.DashboardPage)
|
||||||
|
},
|
||||||
|
new NavigationViewItem()
|
||||||
|
{
|
||||||
|
Content = "Data",
|
||||||
|
Icon = new SymbolIcon { Symbol = SymbolRegular.DataHistogram24 },
|
||||||
|
TargetPageType = typeof(Views.Pages.DataPage)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private ObservableCollection<object> _footerMenuItems = new()
|
||||||
|
{
|
||||||
|
new NavigationViewItem()
|
||||||
|
{
|
||||||
|
Content = "Settings",
|
||||||
|
Icon = new SymbolIcon { Symbol = SymbolRegular.Settings24 },
|
||||||
|
TargetPageType = typeof(Views.Pages.SettingsPage)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private ObservableCollection<MenuItem> _trayMenuItems = new()
|
||||||
|
{
|
||||||
|
new MenuItem { Header = "Home", Tag = "tray_home" }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
36
ReCodeItGUI_WPF/Views/Pages/DashboardPage.xaml
Normal file
36
ReCodeItGUI_WPF/Views/Pages/DashboardPage.xaml
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<Page
|
||||||
|
x:Class="ReCodeItGUI_WPF.Views.Pages.DashboardPage"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:ReCodeItGUI_WPF.Views.Pages"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||||
|
Title="DashboardPage"
|
||||||
|
d:DataContext="{d:DesignInstance local:DashboardPage,
|
||||||
|
IsDesignTimeCreatable=False}"
|
||||||
|
d:DesignHeight="450"
|
||||||
|
d:DesignWidth="800"
|
||||||
|
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
|
||||||
|
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
||||||
|
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
|
||||||
|
<Grid VerticalAlignment="Top">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<ui:Button
|
||||||
|
Grid.Column="0"
|
||||||
|
Command="{Binding ViewModel.CounterIncrementCommand, Mode=OneWay}"
|
||||||
|
Content="Click me!"
|
||||||
|
Icon="Fluent24" />
|
||||||
|
<TextBlock
|
||||||
|
Grid.Column="1"
|
||||||
|
Margin="12,0,0,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Text="{Binding ViewModel.Counter, Mode=OneWay}" />
|
||||||
|
</Grid>
|
||||||
|
</Page>
|
18
ReCodeItGUI_WPF/Views/Pages/DashboardPage.xaml.cs
Normal file
18
ReCodeItGUI_WPF/Views/Pages/DashboardPage.xaml.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using ReCodeItGUI_WPF.ViewModels.Pages;
|
||||||
|
using Wpf.Ui.Controls;
|
||||||
|
|
||||||
|
namespace ReCodeItGUI_WPF.Views.Pages
|
||||||
|
{
|
||||||
|
public partial class DashboardPage : INavigableView<DashboardViewModel>
|
||||||
|
{
|
||||||
|
public DashboardViewModel ViewModel { get; }
|
||||||
|
|
||||||
|
public DashboardPage(DashboardViewModel viewModel)
|
||||||
|
{
|
||||||
|
ViewModel = viewModel;
|
||||||
|
DataContext = this;
|
||||||
|
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
43
ReCodeItGUI_WPF/Views/Pages/DataPage.xaml
Normal file
43
ReCodeItGUI_WPF/Views/Pages/DataPage.xaml
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<Page
|
||||||
|
x:Class="ReCodeItGUI_WPF.Views.Pages.DataPage"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:ReCodeItGUI_WPF.Views.Pages"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:models="clr-namespace:ReCodeItGUI_WPF.Models"
|
||||||
|
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||||
|
Title="DataPage"
|
||||||
|
d:DataContext="{d:DesignInstance local:DataPage,
|
||||||
|
IsDesignTimeCreatable=False}"
|
||||||
|
d:DesignHeight="450"
|
||||||
|
d:DesignWidth="800"
|
||||||
|
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
|
||||||
|
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
||||||
|
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
||||||
|
ScrollViewer.CanContentScroll="False"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<ui:VirtualizingItemsControl
|
||||||
|
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||||
|
ItemsSource="{Binding ViewModel.Colors, Mode=OneWay}"
|
||||||
|
VirtualizingPanel.CacheLengthUnit="Item">
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type models:DataColor}">
|
||||||
|
<ui:Button
|
||||||
|
Width="80"
|
||||||
|
Height="80"
|
||||||
|
Margin="2"
|
||||||
|
Padding="0"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
Appearance="Secondary"
|
||||||
|
Background="{Binding Color, Mode=OneWay}"
|
||||||
|
FontSize="25"
|
||||||
|
Icon="Fluent24" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ui:VirtualizingItemsControl>
|
||||||
|
</Grid>
|
||||||
|
</Page>
|
18
ReCodeItGUI_WPF/Views/Pages/DataPage.xaml.cs
Normal file
18
ReCodeItGUI_WPF/Views/Pages/DataPage.xaml.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using ReCodeItGUI_WPF.ViewModels.Pages;
|
||||||
|
using Wpf.Ui.Controls;
|
||||||
|
|
||||||
|
namespace ReCodeItGUI_WPF.Views.Pages
|
||||||
|
{
|
||||||
|
public partial class DataPage : INavigableView<DataViewModel>
|
||||||
|
{
|
||||||
|
public DataViewModel ViewModel { get; }
|
||||||
|
|
||||||
|
public DataPage(DataViewModel viewModel)
|
||||||
|
{
|
||||||
|
ViewModel = viewModel;
|
||||||
|
DataContext = this;
|
||||||
|
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
51
ReCodeItGUI_WPF/Views/Pages/SettingsPage.xaml
Normal file
51
ReCodeItGUI_WPF/Views/Pages/SettingsPage.xaml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<Page
|
||||||
|
x:Class="ReCodeItGUI_WPF.Views.Pages.SettingsPage"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:helpers="clr-namespace:ReCodeItGUI_WPF.Helpers"
|
||||||
|
xmlns:local="clr-namespace:ReCodeItGUI_WPF.Views.Pages"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||||
|
Title="SettingsPage"
|
||||||
|
d:DataContext="{d:DesignInstance local:SettingsPage,
|
||||||
|
IsDesignTimeCreatable=False}"
|
||||||
|
d:DesignHeight="450"
|
||||||
|
d:DesignWidth="800"
|
||||||
|
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
|
||||||
|
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
||||||
|
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
<Page.Resources>
|
||||||
|
<helpers:EnumToBooleanConverter x:Key="EnumToBooleanConverter" />
|
||||||
|
</Page.Resources>
|
||||||
|
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock
|
||||||
|
FontSize="20"
|
||||||
|
FontWeight="Medium"
|
||||||
|
Text="Personalization" />
|
||||||
|
<TextBlock Margin="0,12,0,0" Text="Theme" />
|
||||||
|
<RadioButton
|
||||||
|
Margin="0,12,0,0"
|
||||||
|
Command="{Binding ViewModel.ChangeThemeCommand, Mode=OneWay}"
|
||||||
|
CommandParameter="theme_light"
|
||||||
|
Content="Light"
|
||||||
|
GroupName="themeSelect"
|
||||||
|
IsChecked="{Binding ViewModel.CurrentTheme, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Light, Mode=OneWay}" />
|
||||||
|
<RadioButton
|
||||||
|
Margin="0,8,0,0"
|
||||||
|
Command="{Binding ViewModel.ChangeThemeCommand, Mode=OneWay}"
|
||||||
|
CommandParameter="theme_dark"
|
||||||
|
Content="Dark"
|
||||||
|
GroupName="themeSelect"
|
||||||
|
IsChecked="{Binding ViewModel.CurrentTheme, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter=Dark, Mode=OneWay}" />
|
||||||
|
|
||||||
|
<TextBlock
|
||||||
|
Margin="0,24,0,0"
|
||||||
|
FontSize="20"
|
||||||
|
FontWeight="Medium"
|
||||||
|
Text="About ReCodeItGUI_WPF" />
|
||||||
|
<TextBlock Margin="0,12,0,0" Text="{Binding ViewModel.AppVersion, Mode=OneWay}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Page>
|
18
ReCodeItGUI_WPF/Views/Pages/SettingsPage.xaml.cs
Normal file
18
ReCodeItGUI_WPF/Views/Pages/SettingsPage.xaml.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using ReCodeItGUI_WPF.ViewModels.Pages;
|
||||||
|
using Wpf.Ui.Controls;
|
||||||
|
|
||||||
|
namespace ReCodeItGUI_WPF.Views.Pages
|
||||||
|
{
|
||||||
|
public partial class SettingsPage : INavigableView<SettingsViewModel>
|
||||||
|
{
|
||||||
|
public SettingsViewModel ViewModel { get; }
|
||||||
|
|
||||||
|
public SettingsPage(SettingsViewModel viewModel)
|
||||||
|
{
|
||||||
|
ViewModel = viewModel;
|
||||||
|
DataContext = this;
|
||||||
|
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
65
ReCodeItGUI_WPF/Views/Windows/MainWindow.xaml
Normal file
65
ReCodeItGUI_WPF/Views/Windows/MainWindow.xaml
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<ui:FluentWindow
|
||||||
|
x:Class="ReCodeItGUI_WPF.Views.Windows.MainWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:ReCodeItGUI_WPF.Views.Windows"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||||
|
Title="{Binding ViewModel.ApplicationTitle, Mode=OneWay}"
|
||||||
|
Width="1100"
|
||||||
|
Height="650"
|
||||||
|
d:DataContext="{d:DesignInstance local:MainWindow,
|
||||||
|
IsDesignTimeCreatable=True}"
|
||||||
|
d:DesignHeight="450"
|
||||||
|
d:DesignWidth="800"
|
||||||
|
ui:Design.Background="{DynamicResource ApplicationBackgroundBrush}"
|
||||||
|
ui:Design.Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
||||||
|
ExtendsContentIntoTitleBar="True"
|
||||||
|
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
||||||
|
WindowBackdropType="Mica"
|
||||||
|
WindowCornerPreference="Round"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<ui:NavigationView
|
||||||
|
x:Name="RootNavigation"
|
||||||
|
Grid.Row="1"
|
||||||
|
Padding="42,0,42,0"
|
||||||
|
BreadcrumbBar="{Binding ElementName=BreadcrumbBar}"
|
||||||
|
FooterMenuItemsSource="{Binding ViewModel.FooterMenuItems, Mode=OneWay}"
|
||||||
|
FrameMargin="0"
|
||||||
|
IsBackButtonVisible="Visible"
|
||||||
|
IsPaneToggleVisible="True"
|
||||||
|
MenuItemsSource="{Binding ViewModel.MenuItems, Mode=OneWay}"
|
||||||
|
PaneDisplayMode="LeftFluent">
|
||||||
|
<ui:NavigationView.Header>
|
||||||
|
<ui:BreadcrumbBar x:Name="BreadcrumbBar" Margin="42,32,42,20" />
|
||||||
|
</ui:NavigationView.Header>
|
||||||
|
<ui:NavigationView.ContentOverlay>
|
||||||
|
<Grid>
|
||||||
|
<ui:SnackbarPresenter x:Name="SnackbarPresenter" />
|
||||||
|
</Grid>
|
||||||
|
</ui:NavigationView.ContentOverlay>
|
||||||
|
</ui:NavigationView>
|
||||||
|
|
||||||
|
<ContentPresenter
|
||||||
|
x:Name="RootContentDialog"
|
||||||
|
Grid.Row="0"
|
||||||
|
Grid.RowSpan="2" />
|
||||||
|
|
||||||
|
<ui:TitleBar
|
||||||
|
x:Name="TitleBar"
|
||||||
|
Title="{Binding ViewModel.ApplicationTitle}"
|
||||||
|
Grid.Row="0"
|
||||||
|
CloseWindowByDoubleClickOnIcon="True">
|
||||||
|
<ui:TitleBar.Icon>
|
||||||
|
<ui:ImageIcon Source="pack://application:,,,/Assets/wpfui-icon-256.png" />
|
||||||
|
</ui:TitleBar.Icon>
|
||||||
|
</ui:TitleBar>
|
||||||
|
</Grid>
|
||||||
|
</ui:FluentWindow>
|
64
ReCodeItGUI_WPF/Views/Windows/MainWindow.xaml.cs
Normal file
64
ReCodeItGUI_WPF/Views/Windows/MainWindow.xaml.cs
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
using ReCodeItGUI_WPF.ViewModels.Windows;
|
||||||
|
using Wpf.Ui;
|
||||||
|
using Wpf.Ui.Appearance;
|
||||||
|
using Wpf.Ui.Controls;
|
||||||
|
|
||||||
|
namespace ReCodeItGUI_WPF.Views.Windows
|
||||||
|
{
|
||||||
|
public partial class MainWindow : INavigationWindow
|
||||||
|
{
|
||||||
|
public MainWindowViewModel ViewModel { get; }
|
||||||
|
|
||||||
|
public MainWindow(
|
||||||
|
MainWindowViewModel viewModel,
|
||||||
|
IPageService pageService,
|
||||||
|
INavigationService navigationService
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ViewModel = viewModel;
|
||||||
|
DataContext = this;
|
||||||
|
|
||||||
|
SystemThemeWatcher.Watch(this);
|
||||||
|
|
||||||
|
InitializeComponent();
|
||||||
|
SetPageService(pageService);
|
||||||
|
|
||||||
|
navigationService.SetNavigationControl(RootNavigation);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region INavigationWindow methods
|
||||||
|
|
||||||
|
public INavigationView GetNavigation() => RootNavigation;
|
||||||
|
|
||||||
|
public bool Navigate(Type pageType) => RootNavigation.Navigate(pageType);
|
||||||
|
|
||||||
|
public void SetPageService(IPageService pageService) => RootNavigation.SetPageService(pageService);
|
||||||
|
|
||||||
|
public void ShowWindow() => Show();
|
||||||
|
|
||||||
|
public void CloseWindow() => Close();
|
||||||
|
|
||||||
|
#endregion INavigationWindow methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raises the closed event.
|
||||||
|
/// </summary>
|
||||||
|
protected override void OnClosed(EventArgs e)
|
||||||
|
{
|
||||||
|
base.OnClosed(e);
|
||||||
|
|
||||||
|
// Make sure that closing this window will begin the process of closing the application.
|
||||||
|
Application.Current.Shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
INavigationView INavigationWindow.GetNavigation()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetServiceProvider(IServiceProvider serviceProvider)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
75
ReCodeItGUI_WPF/app.manifest
Normal file
75
ReCodeItGUI_WPF/app.manifest
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<assemblyIdentity version="1.0.0.0" name="ReCodeItGUI_WPF.app"/>
|
||||||
|
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||||
|
<security>
|
||||||
|
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
<!-- UAC Manifest Options
|
||||||
|
If you want to change the Windows User Account Control level replace the
|
||||||
|
requestedExecutionLevel node with one of the following.
|
||||||
|
|
||||||
|
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||||
|
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||||
|
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||||
|
|
||||||
|
Specifying requestedExecutionLevel element will disable file and registry virtualization.
|
||||||
|
Remove this element if your application requires this virtualization for backwards
|
||||||
|
compatibility.
|
||||||
|
-->
|
||||||
|
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||||
|
</requestedPrivileges>
|
||||||
|
</security>
|
||||||
|
</trustInfo>
|
||||||
|
|
||||||
|
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||||
|
<application>
|
||||||
|
<!-- A list of the Windows versions that this application has been tested on
|
||||||
|
and is designed to work with. Uncomment the appropriate elements
|
||||||
|
and Windows will automatically select the most compatible environment. -->
|
||||||
|
|
||||||
|
<!-- Windows Vista -->
|
||||||
|
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
|
||||||
|
|
||||||
|
<!-- Windows 7 -->
|
||||||
|
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
|
||||||
|
|
||||||
|
<!-- Windows 8 -->
|
||||||
|
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
|
||||||
|
|
||||||
|
<!-- Windows 8.1 -->
|
||||||
|
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
|
||||||
|
|
||||||
|
<!-- Windows 10 -->
|
||||||
|
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
|
||||||
|
|
||||||
|
</application>
|
||||||
|
</compatibility>
|
||||||
|
|
||||||
|
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
|
||||||
|
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
|
||||||
|
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
|
||||||
|
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config.
|
||||||
|
|
||||||
|
Makes the application long-path aware. See https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
|
||||||
|
|
||||||
|
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
<windowsSettings>
|
||||||
|
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor</dpiAwareness>
|
||||||
|
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
|
||||||
|
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
|
||||||
|
</windowsSettings>
|
||||||
|
</application>
|
||||||
|
|
||||||
|
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
|
||||||
|
<dependency>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity
|
||||||
|
type="win32"
|
||||||
|
name="Microsoft.Windows.Common-Controls"
|
||||||
|
version="6.0.0.0"
|
||||||
|
processorArchitecture="*"
|
||||||
|
publicKeyToken="6595b64144ccf1df"
|
||||||
|
language="*" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</dependency>
|
||||||
|
</assembly>
|
BIN
ReCodeItGUI_WPF/wpfui-icon.ico
Normal file
BIN
ReCodeItGUI_WPF/wpfui-icon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
@ -7,8 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReCodeItGUI", "RecodeItGUI\
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReCodeItLib", "RecodeItLib\ReCodeItLib.csproj", "{FDA58DB6-E114-4FE0-AAF1-C3DEE44AEF99}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReCodeItLib", "RecodeItLib\ReCodeItLib.csproj", "{FDA58DB6-E114-4FE0-AAF1-C3DEE44AEF99}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReCodeItGUI_WPF", "ReCodeItGUI_WPF\ReCodeItGUI_WPF.csproj", "{86142D6E-DE7E-48A7-9905-55D3ECE377AD}"
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -23,10 +21,6 @@ Global
|
|||||||
{FDA58DB6-E114-4FE0-AAF1-C3DEE44AEF99}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{FDA58DB6-E114-4FE0-AAF1-C3DEE44AEF99}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{FDA58DB6-E114-4FE0-AAF1-C3DEE44AEF99}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{FDA58DB6-E114-4FE0-AAF1-C3DEE44AEF99}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{FDA58DB6-E114-4FE0-AAF1-C3DEE44AEF99}.Release|Any CPU.Build.0 = Release|Any CPU
|
{FDA58DB6-E114-4FE0-AAF1-C3DEE44AEF99}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{86142D6E-DE7E-48A7-9905-55D3ECE377AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{86142D6E-DE7E-48A7-9905-55D3ECE377AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{86142D6E-DE7E-48A7-9905-55D3ECE377AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{86142D6E-DE7E-48A7-9905-55D3ECE377AD}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using ReCodeIt.Enums;
|
using Mono.Cecil;
|
||||||
using ReCodeIt.Models;
|
|
||||||
using Mono.Cecil;
|
|
||||||
using MoreLinq;
|
using MoreLinq;
|
||||||
|
using ReCodeIt.Enums;
|
||||||
|
using ReCodeIt.Models;
|
||||||
|
|
||||||
namespace ReCodeIt.ReMapper.Search;
|
namespace ReCodeIt.ReMapper.Search;
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ internal static class Fields
|
|||||||
/// <param name="parms"></param>
|
/// <param name="parms"></param>
|
||||||
/// <param name="score"></param>
|
/// <param name="score"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static EMatchResult IncludeFields(TypeDefinition type, SearchParams parms, ScoringModel score)
|
public static EMatchResult Include(TypeDefinition type, SearchParams parms, ScoringModel score)
|
||||||
{
|
{
|
||||||
if (parms.IncludeFields is null || parms.IncludeFields.Count == 0) return EMatchResult.Disabled;
|
if (parms.IncludeFields is null || parms.IncludeFields.Count == 0) return EMatchResult.Disabled;
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ internal static class Fields
|
|||||||
/// <param name="parms"></param>
|
/// <param name="parms"></param>
|
||||||
/// <param name="score"></param>
|
/// <param name="score"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static EMatchResult ExcludeFields(TypeDefinition type, SearchParams parms, ScoringModel score)
|
public static EMatchResult Exclude(TypeDefinition type, SearchParams parms, ScoringModel score)
|
||||||
{
|
{
|
||||||
if (parms.ExcludeFields is null || parms.ExcludeFields.Count == 0) return EMatchResult.Disabled;
|
if (parms.ExcludeFields is null || parms.ExcludeFields.Count == 0) return EMatchResult.Disabled;
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ internal static class Fields
|
|||||||
/// <param name="parms"></param>
|
/// <param name="parms"></param>
|
||||||
/// <param name="score"></param>
|
/// <param name="score"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static EMatchResult MatchFieldCount(TypeDefinition type, SearchParams parms, ScoringModel score)
|
public static EMatchResult Count(TypeDefinition type, SearchParams parms, ScoringModel score)
|
||||||
{
|
{
|
||||||
if (parms.FieldCount is null) return EMatchResult.Disabled;
|
if (parms.FieldCount is null) return EMatchResult.Disabled;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using ReCodeIt.Enums;
|
using Mono.Cecil;
|
||||||
using ReCodeIt.Models;
|
|
||||||
using Mono.Cecil;
|
|
||||||
using Mono.Cecil.Rocks;
|
using Mono.Cecil.Rocks;
|
||||||
|
using ReCodeIt.Enums;
|
||||||
|
using ReCodeIt.Models;
|
||||||
|
|
||||||
namespace ReCodeIt.ReMapper.Search;
|
namespace ReCodeIt.ReMapper.Search;
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ internal static class Methods
|
|||||||
/// <param name="parms"></param>
|
/// <param name="parms"></param>
|
||||||
/// <param name="score"></param>
|
/// <param name="score"></param>
|
||||||
/// <returns>Match if type contains any supplied methods</returns>
|
/// <returns>Match if type contains any supplied methods</returns>
|
||||||
public static EMatchResult IncludeMethods(TypeDefinition type, SearchParams parms, ScoringModel score)
|
public static EMatchResult Include(TypeDefinition type, SearchParams parms, ScoringModel score)
|
||||||
{
|
{
|
||||||
if (parms.IncludeMethods is null || parms.IncludeMethods.Count == 0) return EMatchResult.Disabled;
|
if (parms.IncludeMethods is null || parms.IncludeMethods.Count == 0) return EMatchResult.Disabled;
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ internal static class Methods
|
|||||||
/// <param name="parms"></param>
|
/// <param name="parms"></param>
|
||||||
/// <param name="score"></param>
|
/// <param name="score"></param>
|
||||||
/// <returns>Match if type has no methods</returns>
|
/// <returns>Match if type has no methods</returns>
|
||||||
public static EMatchResult ExcludeMethods(TypeDefinition type, SearchParams parms, ScoringModel score)
|
public static EMatchResult Exclude(TypeDefinition type, SearchParams parms, ScoringModel score)
|
||||||
{
|
{
|
||||||
if (parms.ExcludeMethods is null || parms.ExcludeMethods.Count == 0) return EMatchResult.Disabled;
|
if (parms.ExcludeMethods is null || parms.ExcludeMethods.Count == 0) return EMatchResult.Disabled;
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ internal static class Methods
|
|||||||
/// <param name="parms"></param>
|
/// <param name="parms"></param>
|
||||||
/// <param name="score"></param>
|
/// <param name="score"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static EMatchResult MatchMethodCount(TypeDefinition type, SearchParams parms, ScoringModel score)
|
public static EMatchResult Count(TypeDefinition type, SearchParams parms, ScoringModel score)
|
||||||
{
|
{
|
||||||
if (parms.MethodCount is null) return EMatchResult.Disabled;
|
if (parms.MethodCount is null) return EMatchResult.Disabled;
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
using ReCodeIt.Enums;
|
using Mono.Cecil;
|
||||||
using ReCodeIt.Models;
|
|
||||||
using Mono.Cecil;
|
|
||||||
using MoreLinq;
|
using MoreLinq;
|
||||||
|
using ReCodeIt.Enums;
|
||||||
|
using ReCodeIt.Models;
|
||||||
|
|
||||||
namespace ReCodeIt.ReMapper.Search;
|
namespace ReCodeIt.ReMapper.Search;
|
||||||
|
|
||||||
internal class NestedTypes
|
internal class NestedTypes
|
||||||
{
|
{
|
||||||
public static EMatchResult IncludeNestedTypes(TypeDefinition type, SearchParams parms, ScoringModel score)
|
public static EMatchResult Include(TypeDefinition type, SearchParams parms, ScoringModel score)
|
||||||
{
|
{
|
||||||
if (parms.IncludeNestedTypes is null || parms.IncludeNestedTypes.Count == 0) return EMatchResult.Disabled;
|
if (parms.IncludeNestedTypes is null || parms.IncludeNestedTypes.Count == 0) return EMatchResult.Disabled;
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ internal class NestedTypes
|
|||||||
: EMatchResult.NoMatch;
|
: EMatchResult.NoMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EMatchResult ExcludeNestedTypes(TypeDefinition type, SearchParams parms, ScoringModel score)
|
public static EMatchResult Exclude(TypeDefinition type, SearchParams parms, ScoringModel score)
|
||||||
{
|
{
|
||||||
if (parms.ExcludeNestedTypes is null || parms.ExcludeNestedTypes.Count == 0) return EMatchResult.Disabled;
|
if (parms.ExcludeNestedTypes is null || parms.ExcludeNestedTypes.Count == 0) return EMatchResult.Disabled;
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ internal class NestedTypes
|
|||||||
: EMatchResult.Match;
|
: EMatchResult.Match;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EMatchResult MatchNestedTypeCount(TypeDefinition type, SearchParams parms, ScoringModel score)
|
public static EMatchResult Count(TypeDefinition type, SearchParams parms, ScoringModel score)
|
||||||
{
|
{
|
||||||
if (parms.NestedTypeCount is null) return EMatchResult.Disabled;
|
if (parms.NestedTypeCount is null) return EMatchResult.Disabled;
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
using ReCodeIt.Enums;
|
using Mono.Cecil;
|
||||||
using ReCodeIt.Models;
|
|
||||||
using Mono.Cecil;
|
|
||||||
using MoreLinq;
|
using MoreLinq;
|
||||||
|
using ReCodeIt.Enums;
|
||||||
|
using ReCodeIt.Models;
|
||||||
|
|
||||||
namespace ReCodeIt.ReMapper.Search
|
namespace ReCodeIt.ReMapper.Search
|
||||||
{
|
{
|
||||||
internal class Properties
|
internal class Properties
|
||||||
{
|
{
|
||||||
public static EMatchResult IncludeProperties(TypeDefinition type, SearchParams parms, ScoringModel score)
|
public static EMatchResult Include(TypeDefinition type, SearchParams parms, ScoringModel score)
|
||||||
{
|
{
|
||||||
if (parms.IncludeProperties is null || parms.IncludeProperties.Count == 0) return EMatchResult.Disabled;
|
if (parms.IncludeProperties is null || parms.IncludeProperties.Count == 0) return EMatchResult.Disabled;
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ namespace ReCodeIt.ReMapper.Search
|
|||||||
: EMatchResult.NoMatch;
|
: EMatchResult.NoMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EMatchResult ExcludeProperties(TypeDefinition type, SearchParams parms, ScoringModel score)
|
public static EMatchResult Exclude(TypeDefinition type, SearchParams parms, ScoringModel score)
|
||||||
{
|
{
|
||||||
if (parms.ExcludeProperties is null || parms.ExcludeProperties.Count == 0) return EMatchResult.Disabled;
|
if (parms.ExcludeProperties is null || parms.ExcludeProperties.Count == 0) return EMatchResult.Disabled;
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ namespace ReCodeIt.ReMapper.Search
|
|||||||
: EMatchResult.Match;
|
: EMatchResult.Match;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EMatchResult MatchPropertyCount(TypeDefinition type, SearchParams parms, ScoringModel score)
|
public static EMatchResult Count(TypeDefinition type, SearchParams parms, ScoringModel score)
|
||||||
{
|
{
|
||||||
if (parms.PropertyCount is null) return EMatchResult.Disabled;
|
if (parms.PropertyCount is null) return EMatchResult.Disabled;
|
||||||
|
|
||||||
|
@ -208,9 +208,9 @@ internal static class TypeDefExtensions
|
|||||||
{
|
{
|
||||||
var matches = new List<EMatchResult>
|
var matches = new List<EMatchResult>
|
||||||
{
|
{
|
||||||
Methods.IncludeMethods(type, parms, score),
|
Methods.Include(type, parms, score),
|
||||||
Methods.ExcludeMethods(type, parms, score),
|
Methods.Exclude(type, parms, score),
|
||||||
Methods.MatchMethodCount(type, parms, score)
|
Methods.Count(type, parms, score)
|
||||||
};
|
};
|
||||||
|
|
||||||
// return match if any condition matched
|
// return match if any condition matched
|
||||||
@ -221,9 +221,9 @@ internal static class TypeDefExtensions
|
|||||||
{
|
{
|
||||||
var matches = new List<EMatchResult>
|
var matches = new List<EMatchResult>
|
||||||
{
|
{
|
||||||
Fields.IncludeFields(type, parms, score),
|
Fields.Include(type, parms, score),
|
||||||
Fields.ExcludeFields(type, parms, score),
|
Fields.Exclude(type, parms, score),
|
||||||
Fields.MatchFieldCount(type, parms, score)
|
Fields.Count(type, parms, score)
|
||||||
};
|
};
|
||||||
|
|
||||||
// return match if any condition matched
|
// return match if any condition matched
|
||||||
@ -234,9 +234,9 @@ internal static class TypeDefExtensions
|
|||||||
{
|
{
|
||||||
var matches = new List<EMatchResult>
|
var matches = new List<EMatchResult>
|
||||||
{
|
{
|
||||||
Properties.IncludeProperties(type, parms, score),
|
Properties.Include(type, parms, score),
|
||||||
Properties.ExcludeProperties(type, parms, score),
|
Properties.Exclude(type, parms, score),
|
||||||
Properties.MatchPropertyCount(type, parms, score)
|
Properties.Count(type, parms, score)
|
||||||
};
|
};
|
||||||
|
|
||||||
// return match if any condition matched
|
// return match if any condition matched
|
||||||
@ -247,9 +247,9 @@ internal static class TypeDefExtensions
|
|||||||
{
|
{
|
||||||
var matches = new List<EMatchResult>
|
var matches = new List<EMatchResult>
|
||||||
{
|
{
|
||||||
NestedTypes.IncludeNestedTypes(type, parms, score),
|
NestedTypes.Include(type, parms, score),
|
||||||
NestedTypes.ExcludeNestedTypes(type, parms, score),
|
NestedTypes.Exclude(type, parms, score),
|
||||||
NestedTypes.MatchNestedTypeCount(type, parms, score)
|
NestedTypes.Count(type, parms, score)
|
||||||
};
|
};
|
||||||
|
|
||||||
// return match if any condition matched
|
// return match if any condition matched
|
||||||
|
Loading…
x
Reference in New Issue
Block a user