Compare commits

..

No commits in common. "532beae7b613841f3dae2442e27f4dcd8c809c1b" and "7a07b3776d644f86b36cf12d678438f536935d5a" have entirely different histories.

4 changed files with 34 additions and 86 deletions

View File

@ -54,10 +54,11 @@
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.3" />
<PackageReference Include="Minio" Version="6.0.4" />
<PackageReference Include="ModernWpfUI" Version="0.9.6" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="MSTest.TestFramework" Version="3.8.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NLog" Version="5.4.0" />
<PackageReference Include="Polly" Version="8.5.2" />
<PackageReference Include="WindowsAPICodePack" Version="8.0.6" />
<PackageReference Include="WPF-UI" Version="4.0.2" />
</ItemGroup>

View File

@ -4,11 +4,12 @@
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="500" d:DesignWidth="700">
<Grid>
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<Grid.Resources>
<Style BasedOn="{StaticResource {x:Static h:GroupBoxKeys.Dynamic}}" TargetType="GroupBox">
<Setter Property="BorderBrush" Value="Transparent" />
@ -19,25 +20,16 @@
</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}" />
<Setter Property="h:Cattach.GuideTitle" Value="{Binding RelativeSource={RelativeSource Mode=Self},Path=Header}" />
</Style>
<Style TargetType="DockPanel">
<Setter Property="LastChildFill" Value="False" />
</Style>
<Style TargetType="TextBox" BasedOn="{StaticResource {x:Static h:TextBoxKeys.Accent}}">
<Setter Property="Width" Value="700" />
<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="True" />
<Setter Property="h:Cattach.BackgroundColumn" Value="1" />
</Style>
<Style BasedOn="{StaticResource {x:Static h:ComboBoxKeys.LabelSingle}}" TargetType="ComboBox">
<Setter Property="Width" Value="500" />
@ -57,24 +49,22 @@
<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 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.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="SelectedIndex" Value="0"/>
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style BasedOn="{StaticResource {x:Static h:ListBoxItemKeys.Default}}"
TargetType="ListBoxItem">
<Style BasedOn="{StaticResource {x:Static h:ListBoxItemKeys.Default}}" TargetType="ListBoxItem">
<Setter Property="Background" Value="Transparent" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<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" />
@ -86,19 +76,13 @@
<Setter Property="Padding" Value="10,0" />
</Style>
</h:ScrollIntoItems.NavigationStyle>
<GroupBox Margin="0" Header="同步设置">
<StackPanel Margin="10,6">
<h:Row>
<StackPanel Orientation="Horizontal">
<TextBox h:Cattach.Title="下载目录:" Text="{Binding SyncDir, Mode=TwoWay}"
VerticalAlignment="Center" Width="250"
Grid.Column="0" />
<Button h:Cattach.Icon="&#xeadb;"
VerticalAlignment="Center"
Command="{Binding OpenDirCommand}" Grid.Column="1" />
</StackPanel>
<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">

View File

@ -1,8 +1,6 @@
using System.Text;
using System.Windows;
using System.Windows;
using System.Windows.Controls;
using Microsoft.Win32;
using Microsoft.WindowsAPICodePack.Dialogs;
using Hopetry.Provider;
namespace Hopetry.View.Sync;
@ -13,6 +11,18 @@ public partial class SyncControl : UserControl
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

@ -1,15 +1,13 @@
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows;
using System.Windows.Threading;
using HeBianGu.Service.Mvc;
using Microsoft.WindowsAPICodePack.Dialogs;
using Hopetry.Provider;
namespace HeBianGu.App.Disk.ViewModel.Sync;
[ViewModel("Sync")]
public class SyncViewModel : MvcViewModelBase
{
public ICommand OpenDirCommand { get; set; }
protected override void Init()
{
/*LinkActions.Add(new LinkAction() { Action = "Space", Controller = "Loyout", DisplayName = "会话", Logo = "\xe613" });
@ -20,15 +18,9 @@ public class SyncViewModel : MvcViewModelBase
}));*/
}
public SyncViewModel()
{
OpenDirCommand = new RelayCommand(async () => await ButtonBase_OnClick());
}
protected override void Loaded(string args)
{
}
public string _syncDir;
public string SyncDir
@ -40,44 +32,5 @@ public class SyncViewModel : MvcViewModelBase
RaisePropertyChanged();
}
}
public class RelayCommand : ICommand
{
private readonly Action _execute;
public RelayCommand(Action execute)
{
_execute = execute;
}
public bool CanExecute(object parameter)
{
return true;
}
public event EventHandler CanExecuteChanged;
public void Execute(object parameter)
{
_execute();
}
}
private async Task ButtonBase_OnClick()
{
CommonOpenFileDialog dialog = new CommonOpenFileDialog
{
IsFolderPicker = true
};
if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
{
var folderPath = dialog.FileName; // 获取选中的文件夹路径
//MessageBox.Show("folderPath " + folderPath);
SyncDir = folderPath;
// 处理选中的文件夹路径
}
}
}