Merge branch 'dev' of http://123.132.248.154:10000/chenwei/FieldWorkClient into dev
commit
821658b06a
|
|
@ -98,8 +98,12 @@
|
||||||
<Button h:Cattach.Icon=""
|
<Button h:Cattach.Icon=""
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Command="{Binding OpenDirCommand}" Grid.Column="1" />
|
Command="{Binding OpenDirCommand}" Grid.Column="1" />
|
||||||
|
<Button Content="打开下载目录" Width="150" Style="{DynamicResource {x:Static h:ButtonKeys.Accent}}"
|
||||||
|
Command="{Binding OpenTargetDirCommand}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
</h:Row>
|
||||||
|
<h:Row>
|
||||||
|
|
||||||
</h:Row>
|
</h:Row>
|
||||||
<h:Row>
|
<h:Row>
|
||||||
<ComboBox Width="250" h:Cattach.Title="同时下载"
|
<ComboBox Width="250" h:Cattach.Title="同时下载"
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
using System.IO;
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Windows;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using HeBianGu.Base.WpfBase;
|
using HeBianGu.Base.WpfBase;
|
||||||
using HeBianGu.Service.Mvc;
|
using HeBianGu.Service.Mvc;
|
||||||
|
|
@ -36,10 +38,11 @@ public class SyncViewModel : MvcViewModelBase
|
||||||
{
|
{
|
||||||
_setting = new SystemSetting();
|
_setting = new SystemSetting();
|
||||||
}
|
}
|
||||||
ComboBox_SelectionChanged = new RelayCommand( async()=> await ComboBox_SelectionUpdate());
|
|
||||||
|
ComboBox_SelectionChanged = new RelayCommand(async () => await ComboBox_SelectionUpdate());
|
||||||
OpenDirCommand = new RelayCommand(async () => await ButtonBase_OnClick());
|
OpenDirCommand = new RelayCommand(async () => await ButtonBase_OnClick());
|
||||||
|
OpenTargetDirCommand = new RelayCommand(async () => await Button_OpenTargetDir());
|
||||||
SyncData = new RelayCommand(async () => await SyncDataQuick());
|
SyncData = new RelayCommand(async () => await SyncDataQuick());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ComboBox_SelectionUpdate()
|
private async Task ComboBox_SelectionUpdate()
|
||||||
|
|
@ -84,6 +87,7 @@ public class SyncViewModel : MvcViewModelBase
|
||||||
|
|
||||||
public RelayCommand SyncData { get; set; }
|
public RelayCommand SyncData { get; set; }
|
||||||
public RelayCommand ComboBox_SelectionChanged { get; set; }
|
public RelayCommand ComboBox_SelectionChanged { get; set; }
|
||||||
|
public RelayCommand OpenTargetDirCommand { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public class RelayCommand : ICommand
|
public class RelayCommand : ICommand
|
||||||
|
|
@ -108,7 +112,32 @@ public class SyncViewModel : MvcViewModelBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task Button_OpenTargetDir()
|
||||||
|
{
|
||||||
|
|
||||||
|
// 验证目录是否存在
|
||||||
|
if (!Directory.Exists(SyncDir))
|
||||||
|
{
|
||||||
|
MessageBox.Show("文件夹不存在");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 调用系统资源管理器打开目录
|
||||||
|
Process.Start(new ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = "explorer.exe",
|
||||||
|
Arguments = $"\"{SyncDir}\"", // 处理路径中的空格
|
||||||
|
UseShellExecute = true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show($"打开失败:{ex.Message}", "错误",
|
||||||
|
MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
private async Task ButtonBase_OnClick()
|
private async Task ButtonBase_OnClick()
|
||||||
{
|
{
|
||||||
CommonOpenFileDialog dialog = new CommonOpenFileDialog
|
CommonOpenFileDialog dialog = new CommonOpenFileDialog
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue