Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoYang06 committed Oct 13, 2021
2 parents 83af0e4 + 0229959 commit 7c84f46
Show file tree
Hide file tree
Showing 94 changed files with 1,035 additions and 97 deletions.
19 changes: 19 additions & 0 deletions Source/Demos/Wif.Demo/DemoViewCategories.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.ComponentModel;

namespace Wif.Demo
{
/// <summary>
/// 表示Demo视图类别枚举。
/// </summary>
public enum DemoViewCategories
{
[Description(nameof(BindingDemoView))]
BindingDemoView = 0,

[Description(nameof(FileHelperDemoView))]
FileHelperDemoView = 1,

[Description(nameof(SerializationHelperDemoView))]
SerializationHelperDemoView = 2
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ namespace Wif.Demo.Examples.BindingDemo
/// </summary>
public partial class BindingDemoView
{
public BindingDemoView()
public BindingDemoView(BindingDemoViewModel viewModel)
{
InitializeComponent();
DataContext = ViewModel = viewModel;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<UserControl x:Class="Wif.Demo.Examples.FileHelperDemo.FileHelperDemoView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Wif.Demo.Examples.FileHelperDemo"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<Grid>
<Button Click="CreateDirectory_OnClick"/>
<Button Click="CreateDirectory_OnClick"
Content="Create Directory" />
</Grid>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<UserControl x:Class="Wif.Demo.Examples.SerializationHelperDemo.SerializationHelperDemoView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Wif.Demo.Examples.SerializationHelperDemo"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<WrapPanel>
<Button Content="序列化"/>
</WrapPanel>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Wif.Demo.Examples.SerializationHelperDemo
{
/// <summary>
/// SerializationHelperDemoView.xaml 的交互逻辑
/// </summary>
public partial class SerializationHelperDemoView : UserControl
{
public SerializationHelperDemoView()
{
InitializeComponent();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Microsoft.Extensions.Hosting;
using Wif.Demo.Examples.BindingDemo;
using Wif.Demo.Examples.FileHelperDemo;
using Wif.Demo.Examples.SerializationHelperDemo;

namespace Wif.Demo.IocExtensions
{
Expand All @@ -21,14 +22,14 @@ public static IHostBuilder ConfigureView(this IHostBuilder hostBuilder)
serviceCollection.AddTransient<MainWindow>();
serviceCollection.AddTransient<BindingDemoView>();
serviceCollection.AddTransient<FileHelperDemoView>();
serviceCollection.AddTransient<SerializationHelperDemoView>();
#endregion 注入View
#region 注入ViewModel
serviceCollection.AddTransient<MainViewModel>();
serviceCollection.AddTransient<BindingDemoViewModel>();
serviceCollection.AddTransient<BindingDemoViewModel>();
#endregion 注入ViewModel
});
Expand Down
58 changes: 54 additions & 4 deletions Source/Demos/Wif.Demo/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reactive.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using Frontier.Wif.Core.Collections;
using Frontier.Wif.Core.ComponentModel;
using Frontier.Wif.Infrastructure.Commands;
using Frontier.Wif.Utilities.Extensions;
using Microsoft.Extensions.DependencyInjection;
using Wif.Demo.Common;
using Wif.Demo.Examples.BindingDemo;
using Wif.Demo.Examples.FileHelperDemo;
using Wif.Demo.Examples.SerializationHelperDemo;

namespace Wif.Demo
{
Expand All @@ -15,14 +24,55 @@ namespace Wif.Demo
/// </summary>
public class MainViewModel : ViewModelBase
{
private UserControl _demoView;
private readonly IServiceProvider _serviceProvider;

private UserControl _currentDemoView;
/// <summary>
/// 获取或设置Demo视图。
/// </summary>
public UserControl DemoView
public UserControl CurrentDemoView
{
get => _currentDemoView;
set => this.RaiseAndSetIfChanged(ref _currentDemoView, value);
}

private string _selectedDemoViewCategory;
/// <summary>
/// 获取或设置当前选中的Demo视图类别。
/// </summary>
public string SelectedDemoViewCategory
{
get { return _selectedDemoViewCategory; }
set { this.RaiseAndSetIfChanged(ref _selectedDemoViewCategory, value); }
}

private ObservableCollection<string> _demoViewCategoriesCollection;
/// <summary>
/// 获取或设置Demo视图类别集合。
/// </summary>
public ObservableCollection<string> DemoViewCategoriesCollection
{
get => _demoViewCategoriesCollection;
set => this.RaiseAndSetIfChanged(ref _demoViewCategoriesCollection, value);
}

public DelegateCommand<RoutedEventArgs> DemoViewCategoriesSelectionChangedCommand { get; }

public MainViewModel(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
DemoViewCategoriesSelectionChangedCommand = new DelegateCommand<RoutedEventArgs>(ExecuteDemoViewCategoriesSelectionChangedCommand);
}

private void ExecuteDemoViewCategoriesSelectionChangedCommand(RoutedEventArgs args)
{
get => _demoView;
set => this.RaiseAndSetIfChanged(ref _demoView, value);
CurrentDemoView = SelectedDemoViewCategory.ToEnum<DemoViewCategories>() switch
{
DemoViewCategories.BindingDemoView => _serviceProvider.GetRequiredService<BindingDemoView>(),
DemoViewCategories.FileHelperDemoView => _serviceProvider.GetRequiredService<FileHelperDemoView>(),
DemoViewCategories.SerializationHelperDemoView => _serviceProvider.GetRequiredService<SerializationHelperDemoView>(),
_ => throw new ArgumentOutOfRangeException()
};
}
}
}
24 changes: 19 additions & 5 deletions Source/Demos/Wif.Demo/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:demo="clr-namespace:Wif.Demo"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wif="https://frontier-dn.github.io/winfx/xaml/presentation/wif"
Title="Wif Demo"
Width="800"
Height="450"
Expand All @@ -15,12 +16,25 @@
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical">
<Expander Header="BindingDemo" />
<Expander Header="FileHelperDemo" />
</StackPanel>
<ListBox MinWidth="200"
MaxWidth="800"
ItemsSource="{wif:EnumBindingSourceExtension demo:DemoViewCategories}"
SelectedItem="{Binding SelectedDemoViewCategory}"
SelectionMode="Single">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Margin="6"
Text="{Binding}" />
</DataTemplate>
</ListBox.ItemTemplate>
<wif:EventToCommandBehavior.EventBindings>
<wif:EventBinding Command="{Binding DemoViewCategoriesSelectionChangedCommand}"
PassEventArgsToCommand="True"
EventName="SelectionChanged" />
</wif:EventToCommandBehavior.EventBindings>
</ListBox>

<ContentControl Grid.Column="1"
Content="{Binding DemoView}" />
Content="{Binding CurrentDemoView}" />
</Grid>
</Window>
1 change: 1 addition & 0 deletions Source/Demos/Wif.Demo/Wif.Demo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="5.0.0" />
<PackageReference Include="System.Reactive" Version="5.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Wif.Core\Wif.Core.csproj" />
Expand Down
10 changes: 10 additions & 0 deletions Source/Wif.Core/Async/AsyncLazy.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
/**************************************************************************
* File Name£ºAsyncLazy.cs
* Description£ºAsyncLazy.cs class description...
* Copyright£ºCopyright ? 2020 LeoYang-Chuese. All rights reserved.
* Creator£ºLeo Yang
* Create Time£º2020/12/15
*Project Address£ºhttps://github.com/LeoYang-Chuese/wif
**************************************************************************/


using System;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
Expand Down
10 changes: 10 additions & 0 deletions Source/Wif.Core/Async/AsyncProperty.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
/**************************************************************************
* File Name£ºAsyncProperty.cs
* Description£ºAsyncProperty.cs class description...
* Copyright£ºCopyright ? 2020 LeoYang-Chuese. All rights reserved.
* Creator£ºLeo Yang
* Create Time£º2020/12/15
*Project Address£ºhttps://github.com/LeoYang-Chuese/wif
**************************************************************************/


using System;
using System.Threading.Tasks;

Expand Down
10 changes: 10 additions & 0 deletions Source/Wif.Core/Async/AsyncPropertyBase.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
/**************************************************************************
* File Name£ºAsyncPropertyBase.cs
* Description£ºAsyncPropertyBase.cs class description...
* Copyright£ºCopyright ? 2020 LeoYang-Chuese. All rights reserved.
* Creator£ºLeo Yang
* Create Time£º2020/12/15
*Project Address£ºhttps://github.com/LeoYang-Chuese/wif
**************************************************************************/


using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
Expand Down
10 changes: 10 additions & 0 deletions Source/Wif.Core/Async/IAsyncProperty.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
/**************************************************************************
* File Name£ºIAsyncProperty.cs
* Description£ºIAsyncProperty.cs class description...
* Copyright£ºCopyright ? 2020 LeoYang-Chuese. All rights reserved.
* Creator£ºLeo Yang
* Create Time£º2020/12/15
*Project Address£ºhttps://github.com/LeoYang-Chuese/wif
**************************************************************************/


using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
Expand Down
12 changes: 11 additions & 1 deletion Source/Wif.Core/Attributes/UidAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
using System;
/**************************************************************************
* File Name:UidAttribute.cs
* Description:UidAttribute.cs class description...
* Copyright:Copyright © 2021 LeoYang-Chuese. All rights reserved.
* Creator:Leo Yang
* Create Time:2021/4/13
*Project Address:https://github.com/LeoYang-Chuese/wif
**************************************************************************/


using System;

namespace Frontier.Wif.Core.Attributes
{
Expand Down
12 changes: 11 additions & 1 deletion Source/Wif.Core/Cache/BoxCache.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
using System;
/**************************************************************************
* File Name:BoxCache.cs
* Description:BoxCache.cs class description...
* Copyright:Copyright © 2020 LeoYang-Chuese. All rights reserved.
* Creator:Leo Yang
* Create Time:2020/12/15
*Project Address:https://github.com/LeoYang-Chuese/wif
**************************************************************************/


using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
Expand Down
12 changes: 11 additions & 1 deletion Source/Wif.Core/Collections/AsyncObservableCollection’T.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
using System;
/**************************************************************************
* File Name:AsyncObservableCollection’T.cs
* Description:AsyncObservableCollection’T.cs class description...
* Copyright:Copyright © 2020 LeoYang-Chuese. All rights reserved.
* Creator:Leo Yang
* Create Time:2020/12/15
*Project Address:https://github.com/LeoYang-Chuese/wif
**************************************************************************/


using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
Expand Down
12 changes: 11 additions & 1 deletion Source/Wif.Core/Collections/BulkObservableCollection.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
using System;
/**************************************************************************
* File Name:BulkObservableCollection.cs
* Description:BulkObservableCollection.cs class description...
* Copyright:Copyright © 2020 LeoYang-Chuese. All rights reserved.
* Creator:Leo Yang
* Create Time:2020/12/15
*Project Address:https://github.com/LeoYang-Chuese/wif
**************************************************************************/


using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
using System;
/**************************************************************************
* File Name:ConcurrentObservableCollection’T.cs
* Description:ConcurrentObservableCollection’T.cs class description...
* Copyright:Copyright © 2020 LeoYang-Chuese. All rights reserved.
* Creator:Leo Yang
* Create Time:2020/12/15
*Project Address:https://github.com/LeoYang-Chuese/wif
**************************************************************************/


using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
Expand Down
12 changes: 11 additions & 1 deletion Source/Wif.Core/Collections/EnumCollection.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
using System;
/**************************************************************************
* File Name:EnumCollection.cs
* Description:EnumCollection.cs class description...
* Copyright:Copyright © 2020 LeoYang-Chuese. All rights reserved.
* Creator:Leo Yang
* Create Time:2020/12/15
*Project Address:https://github.com/LeoYang-Chuese/wif
**************************************************************************/


using System;
using System.Collections.ObjectModel;

namespace Frontier.Wif.Core.Collections
Expand Down
Loading

0 comments on commit 7c84f46

Please sign in to comment.