dev
陈伟 2025-03-22 15:29:32 +08:00
parent 278889d1a5
commit 3167897890
11 changed files with 226 additions and 10 deletions

View File

@ -2,10 +2,12 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:h="https://github.com/HeBianGu"
xmlns:local="clr-namespace:HeBianGu.App.Disk">
xmlns:local="clr-namespace:HeBianGu.App.Disk"
xmlns:provider="clr-namespace:Hopetry.Provider">
<h:ApplicationBase.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries />
<provider:DataSourceLocator x:Key="S.DataSource.Locator" />
</ResourceDictionary>
</h:ApplicationBase.Resources>
</h:ApplicationBase>

View File

@ -1,5 +1,4 @@
using System.Configuration;
using System.Windows;
using System.Windows;
using System.Windows.Media;
using HeBianGu.Base.WpfBase;
using HeBianGu.Control.Guide;
@ -10,7 +9,6 @@ using HeBianGu.Systems.About;
using HeBianGu.Systems.Identity;
using HeBianGu.Systems.Setting;
using Hopetry.Services;
using Microsoft.Extensions.Configuration;
namespace HeBianGu.App.Disk
{
@ -21,15 +19,20 @@ namespace HeBianGu.App.Disk
{
protected override MainWindowBase CreateMainWindow(StartupEventArgs e)
{
// 主页面
return new ShellWindow();
}
protected override void ConfigureServices(IServiceCollection services)
{
base.ConfigureServices(services);
// 本地持久化
services.AddXmlSerialize();
// minio 服务
services.AddSingleton<MinioService, MinioService>();
var minioService = services.GetService<MinioService>();
var bucketName = minioService._bucketName;
minioService.MirrorAsync1(bucketName, "d:/test");
minioService.RealTimeListen(bucketName, "d:/test");
services.AddStart(x =>
{
x.ProductFontSize = 90;
@ -48,6 +51,7 @@ namespace HeBianGu.App.Disk
// services.AddIdentity(x => x.ProductFontSize = 50);
services.AddMvc();
//services.AddProjectDefault();
services.AddXmlWebSerializerService();
//// Do :注册软件更新页面
/* services.AddAutoUpgrade(x =>
@ -56,9 +60,9 @@ namespace HeBianGu.App.Disk
x.UseIEDownload = true;
});*/
services.AddSettingPath();
services.AddXmlSerialize();
services.AddDESCryptService();
services.AddPrintBoxMessage();
// ???
services.AddWindowExplorer();
#region - More -
@ -87,7 +91,9 @@ namespace HeBianGu.App.Disk
#region - WindowCaption -
//
services.AddLoginViewPresenter();
// 引导功能按钮
services.AddGuideViewPresenter();
services.AddHideWindowViewPresenter();
services.AddSettingViewPrenter();
@ -116,10 +122,10 @@ namespace HeBianGu.App.Disk
{
base.Configure(app);
app.UseStyle();
// Do设置默认主题
app.UseLocalTheme(l =>
{
// 主题色
l.AccentColor = (Color)ColorConverter.ConvertFromString("#FF0093FF");
l.DefaultFontSize = 13D;
l.FontSize = FontSize.Normal;

View File

@ -0,0 +1,15 @@
using HeBianGu.App.Disk.ViewModel.Sync;
using HeBianGu.Base.WpfBase;
using HeBianGu.Service.Mvc;
namespace HeBianGu.App.Disk;
// control 特性名好像绑定了 xaml
[Controller("Sync")]
public class SyncController : Controller<SyncViewModel>
{
public async Task<IActionResult> Sync()
{
return await ViewAsync();
}
}

View File

@ -36,6 +36,7 @@
<PackageReference Include="HeBianGu.Systems.About" Version="5.0.0" />
<PackageReference Include="HeBianGu.Systems.Encryption" Version="5.0.0" />
<PackageReference Include="HeBianGu.Systems.Identity" Version="5.0.0" />
<PackageReference Include="HeBianGu.Systems.Logger" Version="5.0.0" />
<PackageReference Include="HeBianGu.Systems.Print" Version="5.0.0" />
<PackageReference Include="HeBianGu.Systems.Setting" Version="5.0.0" />
<PackageReference Include="HeBianGu.Systems.Start" Version="5.0.0" />
@ -66,4 +67,12 @@
<Folder Include="Assets\" />
</ItemGroup>
<ItemGroup>
<Page Update="View\Sync\ExplorerControl.xaml">
<Generator>MSBuild:Compile</Generator>
<XamlRuntime>Wpf</XamlRuntime>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
</Project>

View File

@ -0,0 +1,15 @@
using HeBianGu.App.Disk.ViewModel.Sync;
using HeBianGu.Base.WpfBase;
namespace Hopetry.Provider
{
internal class DataSourceLocator
{
public DataSourceLocator()
{
ServiceRegistry.Instance.Register<SyncViewModel>();
}
public SyncViewModel SyncViewModel => ServiceRegistry.Instance.GetInstance<SyncViewModel>();
}
}

View File

@ -18,7 +18,7 @@ namespace Hopetry.Services
{
private IMinioClient _minioClient;
private readonly string _bucketName = null;
public readonly string _bucketName = null;
public MinioService()
{

View File

@ -31,5 +31,6 @@
DisplayName="网盘空间"
Logo="{x:Null}" />
<h:LinkAction Action="Send" Controller="Send" DisplayName="传输列表" />
<h:LinkAction Action="Sync" Controller="Sync" DisplayName="同步" />
</h:LinkWindowBase.Links>
</h:LinkWindowBase>

View File

@ -1,13 +1,17 @@
namespace HeBianGu.App.Disk
using Hopetry.Services;
namespace HeBianGu.App.Disk
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class ShellWindow
{
private readonly MinioService _minioService;
public ShellWindow()
{
InitializeComponent();
}
}
}
}

100
View/Sync/SyncControl.xaml Normal file
View File

@ -0,0 +1,100 @@
<UserControl x:Class="Hopetry.View.Sync.SyncControl"
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"
mc:Ignorable="d"
xmlns:local="clr-namespace:HeBianGu.App.Disk.ViewModel.Sync"
xmlns:h="QQ:908293466"
xmlns:system="clr-namespace:System;assembly=System.Runtime"
DataContext="{Binding Source={StaticResource S.DataSource.Locator}, Path=SyncViewModel}"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<Grid.Resources>
<Style BasedOn="{StaticResource {x:Static h:GroupBoxKeys.Dynamic}}" TargetType="GroupBox">
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock Margin="10" FontWeight="Bold" Text="{Binding}" />
</DataTemplate>
</Setter.Value>
</Setter>
<Setter Property="h:Cattach.GuideParentTitle" Value="设置中心" />
<Setter Property="h:Cattach.UseGuide" Value="True" />
<Setter Property="h:Cattach.GuideData" Value="你可以通过此操作完成指定功能" />
<Setter Property="h:Cattach.GuideTitle" Value="{Binding RelativeSource={RelativeSource Mode=Self},Path=Header}" />
</Style>
<Style TargetType="DockPanel">
<Setter Property="LastChildFill" Value="False" />
</Style>
<Style BasedOn="{StaticResource {x:Static h:ComboBoxKeys.LabelSingle}}" TargetType="ComboBox">
<Setter Property="Width" Value="500" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="h:Cattach.TitleWidth" Value="120" />
<Setter Property="h:Cattach.TitleHorizontalAlignment" Value="Left" />
<Setter Property="h:Cattach.UseBackground" Value="False" />
<Setter Property="h:Cattach.BackgroundColumn" Value="1" />
<Setter Property="SelectedIndex" Value="0" />
</Style>
<Style BasedOn="{StaticResource {x:Static h:ButtonKeys.LabelSingle}}" TargetType="Button">
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="h:Cattach.TitleWidth" Value="120" />
<Setter Property="h:Cattach.TitleHorizontalAlignment" Value="Left" />
<Setter Property="h:Cattach.UseBackground" Value="False" />
<Setter Property="h:Cattach.BackgroundColumn" Value="1" />
</Style>
</Grid.Resources>
<h:ScrollIntoItems Margin="0 0 10 0" Background="{DynamicResource {x:Static h:BrushKeys.Dark0_3}}" NavigationSource="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Items}">
<h:ScrollIntoItems.NavigationDataTemplate>
<DataTemplate>
<TextBlock Text="{Binding Header}" />
</DataTemplate>
</h:ScrollIntoItems.NavigationDataTemplate>
<h:ScrollIntoItems.NavigationStyle>
<Style BasedOn="{StaticResource {x:Static h:ListBoxKeys.Dynamic}}" TargetType="ListBox">
<Setter Property="Width" Value="150" />
<Setter Property="SelectedIndex" Value="0"/>
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style BasedOn="{StaticResource {x:Static h:ListBoxItemKeys.Default}}" TargetType="ListBoxItem">
<Setter Property="Background" Value="Transparent" />
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="h:Cattach.GuideParentTitle" Value="设置中心" />
<Setter Property="h:Cattach.UseGuide" Value="True" />
<Setter Property="h:Cattach.GuideUseClick" Value="True" />
<Setter Property="h:Cattach.GuideData" Value="你可以通过此操作完成指定功能" />
<Setter Property="h:Cattach.GuideTitle" Value="{Binding Header}" />
</Style>
</Setter.Value>
</Setter>
<Setter Property="Padding" Value="10,0" />
</Style>
</h:ScrollIntoItems.NavigationStyle>
<GroupBox Margin="0" Header="同步设置">
<StackPanel Margin="10,6">
<h:Row>
<ComboBox h:Cattach.Title="下载目录" SelectedIndex="0" SelectedValue="{Binding SyncDir}">
<system:String>D:\迅雷云盘</system:String>
</ComboBox>
</h:Row>
<h:Row>
<ComboBox Width="250" h:Cattach.Title="同时下载任务数" SelectedIndex="0">
<system:String>1</system:String>
<system:String>2</system:String>
<system:String>3</system:String>
<system:String>4</system:String>
<system:String>5</system:String>
</ComboBox>
</h:Row>
</StackPanel>
</GroupBox>
</h:ScrollIntoItems>
</Grid>
</UserControl>

View File

@ -0,0 +1,28 @@
using System.Windows;
using System.Windows.Controls;
using Hopetry.Provider;
namespace Hopetry.View.Sync;
public partial class SyncControl : UserControl
{
public SyncControl()
{
InitializeComponent();
}
public event RoutedEventHandler OKClicked;
public event RoutedEventHandler CancelClicked;
private void btnOK_Click(object sender, RoutedEventArgs e)
{
OKClicked?.Invoke(this, e);
}
private void btnCancel_Click(object sender, RoutedEventArgs e)
{
CancelClicked?.Invoke(this, e);
}
}

View File

@ -0,0 +1,36 @@
using System.Windows;
using System.Windows.Threading;
using HeBianGu.Service.Mvc;
using Hopetry.Provider;
namespace HeBianGu.App.Disk.ViewModel.Sync;
[ViewModel("Sync")]
public class SyncViewModel : MvcViewModelBase
{
protected override void Init()
{
/*LinkActions.Add(new LinkAction() { Action = "Space", Controller = "Loyout", DisplayName = "会话", Logo = "\xe613" });
Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new Action(() =>
{
SelectLink = LinkActions[0];
}));*/
}
protected override void Loaded(string args)
{
}
public string _syncDir;
public string SyncDir
{
get => _syncDir;
set
{
_syncDir = value;
RaisePropertyChanged();
}
}
}