Skip to content

Commit

Permalink
[Core] WDE.Common and WDE.Module no longer have WPF dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
BAndysc committed Feb 14, 2021
1 parent 9fc3245 commit b519915
Show file tree
Hide file tree
Showing 76 changed files with 336 additions and 444 deletions.
2 changes: 1 addition & 1 deletion GeminiGraphEditor/GeminiGraphEditor.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<TargetFramework>net5.0-windows7.0</TargetFramework>
<OutputType>Library</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWPF>true</UseWPF>
Expand Down
2 changes: 1 addition & 1 deletion QuestChainTest/QuestChainTest.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<TargetFramework>net5.0-windows7.0</TargetFramework>
<OutputType>WinExe</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWPF>true</UseWPF>
Expand Down
3 changes: 1 addition & 2 deletions WDE.AzerothCore/WDE.AzerothCore.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<TargetFrameworks>net5.0;net5.0-windows7.0</TargetFrameworks>
<OutputType>Library</OutputType>
<UseWPF>true</UseWPF>
<Nullable>enable</Nullable>
<WarningsAsErrors>nullable</WarningsAsErrors>
</PropertyGroup>
Expand Down
6 changes: 2 additions & 4 deletions WDE.Blueprints/Providers/BlueprintItemProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Windows.Media.Imaging;
using WDE.Common;
using WDE.Common.CoreVersion;
using WDE.Common.Types;
using WDE.Module.Attributes;

namespace WDE.Blueprints.Providers
Expand All @@ -22,10 +23,7 @@ public string GetDescription()
return "Script in new Blueprints system";
}

public ImageSource GetImage()
{
return new BitmapImage(new Uri("/WDE.Blueprints;component/Resources/icon.png", UriKind.Relative));
}
public ImageUri GetImage() => new("Resources/blueprint_icon.png");

public string GetName()
{
Expand Down
File renamed without changes
6 changes: 4 additions & 2 deletions WDE.Blueprints/WDE.Blueprints.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<TargetFramework>net5.0-windows7.0</TargetFramework>
<OutputType>Library</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWPF>true</UseWPF>
Expand All @@ -22,7 +22,9 @@
</None>
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\icon.png" />
<None Include="Resources\blueprint_icon.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommonServiceLocator">
Expand Down
44 changes: 44 additions & 0 deletions WDE.Common.WPF/Components/WdeImage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Imaging;
using WDE.Common.Types;

namespace WDE.Common.WPF.Components
{
public class WdeImage : Image
{
// we are never releasing those intentionally
private static Dictionary<ImageUri, BitmapImage> cache = new();

public ImageUri Image
{
get => (ImageUri) GetValue(ImageProperty);
set => SetValue(ImageProperty, value);
}

public static readonly DependencyProperty ImageProperty =
DependencyProperty.Register(
nameof(Image),
typeof(ImageUri),
typeof(WdeImage),
new FrameworkPropertyMetadata(
default(ImageUri),
FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender,
new PropertyChangedCallback(OnSourceChanged),
null),
null);

private static void OnSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var img = (ImageUri)d.GetValue(ImageProperty);
if (!cache.TryGetValue(img, out var bitmap))
{
bitmap = cache[img] =
new BitmapImage(new Uri(System.IO.Path.Combine(Environment.CurrentDirectory, img.Uri), UriKind.Absolute));
}
d.SetValue(SourceProperty, bitmap);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Windows;
using System.Windows.Controls;

namespace WDE.Common.Utils
namespace WDE.Common.WPF.Utils
{
public static class GridUtils
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<UserControl x:Class="WDE.Common.Utils.LoadingSpinner"
<UserControl x:Class="WDE.Common.WPF.Utils.LoadingSpinner"
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"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Windows.Controls;

namespace WDE.Common.Utils
namespace WDE.Common.WPF.Utils
{
public partial class LoadingSpinner : UserControl
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
using System.Linq;
using System.Windows;
using System.Windows.Markup;
using Prism.Ioc;
using WDE.Common.Windows;

namespace WDE.Common.Utils
namespace WDE.Common.WPF.Utils
{
public class ViewBind
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Windows;
using System.Windows.Data;

namespace WDE.SmartScriptEditor.Editor.Helpers
namespace WDE.Common.WPF.ViewHelpers
{
public class BooleanToVisibilityConverter : IValueConverter
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Globalization;
using System.Windows.Controls;

namespace WDE.Common.ViewHelpers
namespace WDE.Common.WPF.ViewHelpers
{
public class IntInputValidationRule: ValidationRule
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Windows;
using System.Windows.Data;

namespace WDE.Common.ViewHelpers
namespace WDE.Common.WPF.ViewHelpers
{
public class NullToVisibilityConverter : IValueConverter
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows;
using System.Windows.Controls;

namespace WDE.Common.ViewHelpers
namespace WDE.Common.WPF.ViewHelpers
{
// https://stackoverflow.com/a/35557401
public class StretchedTreeView: TreeView
Expand Down Expand Up @@ -34,7 +29,7 @@ private void StretchingTreeViewItem_Loaded(object sender, RoutedEventArgs e)
// The purpose of this code is to stretch the Header Content all the way accross the TreeView.
if (this.VisualChildrenCount > 0)
{
Grid grid = this.GetVisualChild(0) as Grid;
Grid? grid = this.GetVisualChild(0) as Grid;
if (grid != null && grid.ColumnDefinitions.Count == 3)
{
// Remove the middle column which is set to Auto and let it get replaced with the
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using System.Windows;
using System.Windows.Input;
using System.Windows.Controls;
using System.Windows.Input;

namespace WDE.Common.ViewHelpers
namespace WDE.Common.WPF.ViewHelpers
{
public sealed class ViewItemDoubleClickCommand
{
Expand Down
15 changes: 15 additions & 0 deletions WDE.Common.WPF/WDE.Common.WPF.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0-windows7.0</TargetFramework>
<OutputType>Library</OutputType>
<UseWPF>true</UseWPF>
<Nullable>enable</Nullable>
<WarningsAsErrors>nullable</WarningsAsErrors>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\WoWDatabaseEditor.Common\WDE.Common\WDE.Common.csproj" />
</ItemGroup>

</Project>
25 changes: 2 additions & 23 deletions WDE.Conditions/WDE.Conditions.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<TargetFrameworks>net5.0;net5.0-windows7.0</TargetFrameworks>
<OutputType>Library</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWPF>true</UseWPF>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
Expand Down Expand Up @@ -37,28 +36,8 @@
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="AsyncAwaitBestPractices.MVVM">
<Version>5.0.2</Version>
</PackageReference>
<PackageReference Include="CommonServiceLocator">
<Version>2.0.5</Version>
</PackageReference>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Prism.Wpf">
<Version>8.0.0.1909</Version>
</PackageReference>
<PackageReference Include="SmartFormat.NET">
<Version>2.5.3</Version>
</PackageReference>
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="Unity.Abstractions">
<Version>5.11.6</Version>
</PackageReference>
<PackageReference Include="Unity.Container">
<Version>5.11.10</Version>
</PackageReference>
<PackageReference Include="Unity.RegistrationByConvention">
<Version>5.11.1</Version>
</PackageReference>
</ItemGroup>
</Project>
</Project>
4 changes: 2 additions & 2 deletions WDE.HistoryWindow/ViewModels/HistoryViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ internal class HistoryEvent
[SingleInstance]
internal class HistoryViewModel : BindableBase, ITool
{
private Visibility visibility;
private bool visibility;

private IDocument previousDocument;

Expand Down Expand Up @@ -66,7 +66,7 @@ public bool IsSelected
set => SetProperty(ref isSelected, value);
}

public Visibility Visibility
public bool Visibility
{
get => visibility;
set => SetProperty(ref visibility, value);
Expand Down
2 changes: 1 addition & 1 deletion WDE.HistoryWindow/WDE.HistoryWindow.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<TargetFramework>net5.0-windows7.0</TargetFramework>
<OutputType>Library</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWPF>true</UseWPF>
Expand Down
2 changes: 1 addition & 1 deletion WDE.MVVM.Test/WDE.MVVM.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion WDE.MVVM/WDE.MVVM.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<TargetFrameworks>net5.0;net5.0-windows7.0</TargetFrameworks>
<OutputType>Library</OutputType>
<Nullable>enable</Nullable>
<WarningsAsErrors>nullable</WarningsAsErrors>
Expand Down
2 changes: 1 addition & 1 deletion WDE.Parameters/WDE.Parameters.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<TargetFramework>net5.0-windows7.0</TargetFramework>
<OutputType>Library</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWPF>true</UseWPF>
Expand Down
2 changes: 1 addition & 1 deletion WDE.QuestChainEditor/WDE.QuestChainEditor.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<TargetFramework>net5.0-windows7.0</TargetFramework>
<OutputType>Library</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWPF>true</UseWPF>
Expand Down
2 changes: 1 addition & 1 deletion WDE.SQLEditor/WDE.SQLEditor.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<TargetFramework>net5.0-windows7.0</TargetFramework>
<OutputType>Library</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWindowsForms>true</UseWindowsForms>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ public interface IToolSmartEditorViewModel

public class ToolSmartEditorViewModel : ObservableBase, ITool, IToolSmartEditorViewModel
{
public bool IsOpened => Visibility == Visibility.Visible;
public bool IsOpened => Visibility;
public string Title => "Smart edit";
public string UniqueId => "tc_smart_script_edit";
public ToolPreferedPosition PreferedPosition => ToolPreferedPosition.Left;
public bool OpenOnStart => false;
private bool isSelected;
private Visibility visibility;
private bool visibility;

public bool IsSelected
{
get => isSelected;
set => SetProperty(ref isSelected, value);
}

public Visibility Visibility
public bool Visibility
{
get => visibility;
set => SetProperty(ref visibility, value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
xmlns:local="clr-namespace:WDE.SmartScriptEditor.Editor.Views"
xmlns:helpers="clr-namespace:WDE.Common.ViewHelpers;assembly=WDE.Common"
xmlns:mvvm="http://prismlibrary.com/"
xmlns:viewHelpers="clr-namespace:WDE.Common.WPF.ViewHelpers;assembly=WDE.Common.WPF"
mvvm:ViewModelLocator.AutoWireViewModel="False"
mc:Ignorable="d"
Height="666" Width="473"
Expand Down Expand Up @@ -42,7 +43,7 @@
<TextBox.Text>
<Binding Path="Source.Id" Mode="TwoWay" NotifyOnValidationError="True">
<Binding.ValidationRules>
<helpers:IntInputValidationRule />
<viewHelpers:IntInputValidationRule />
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
Expand Down Expand Up @@ -126,8 +127,8 @@
</ListView.ItemTemplate>
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<Setter Property="helpers:ViewItemDoubleClickCommand.Command" Value="{Binding ElementName=rootWindow, Path=DataContext.EditParameter}" />
<Setter Property="helpers:ViewItemDoubleClickCommand.CommandParameter" Value="{Binding}" />
<Setter Property="viewHelpers:ViewItemDoubleClickCommand.Command" Value="{Binding ElementName=rootWindow, Path=DataContext.EditParameter}" />
<Setter Property="viewHelpers:ViewItemDoubleClickCommand.CommandParameter" Value="{Binding}" />
</Style>
</ListView.ItemContainerStyle>
</ListView>
Expand Down
Loading

0 comments on commit b519915

Please sign in to comment.