Commit d50fa932 by liulongfei

添加刷新配置按钮

parent d9cbd1db
......@@ -95,6 +95,7 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
......
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
......@@ -8,7 +8,7 @@
xmlns:resource="clr-namespace:VIZ.TimeSlice.Module.Resource;assembly=VIZ.TimeSlice.Module.Resource"
mc:Ignorable="d" d:Background="White"
d:DataContext="{d:DesignInstance Type=local:MainViewModel}"
d:DesignHeight="800" d:DesignWidth="800">
d:DesignHeight="820" d:DesignWidth="800">
<UserControl.Resources>
<ResourceDictionary>
<resource:PullMessageUrlConverter x:Key="PullMessageUrlConverter"></resource:PullMessageUrlConverter>
......@@ -30,6 +30,7 @@
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="60"></RowDefinition>
</Grid.RowDefinitions>
<!-- 工作目录 -->
<Grid Grid.Row="0">
......@@ -170,6 +171,10 @@
</ComboBox>
</Grid>
<!-- 刷新配置 -->
<Button Grid.Row="5" Width="120" Height="30" HorizontalAlignment="Right" Content="刷新配置"
Command="{Binding RefreshCommand,Mode=OneWay}"></Button>
</Grid>
</GroupBox>
......
......@@ -40,6 +40,7 @@ namespace VIZ.TimeSlice.Module
this.SelectWorkPathCommand = new VCommand(this.SelectWorkPath);
this.SelectBackgroundImagePathCommand = new VCommand(this.SelectBackgroundImagePath);
this.SelectDestPathCommand = new VCommand(this.SelectDestPath);
this.RefreshCommand = new VCommand(this.Refresh);
}
/// <summary>
......@@ -390,6 +391,11 @@ namespace VIZ.TimeSlice.Module
/// </summary>
private readonly static string CLIENT_PULL_MESSAGE_URL = ApplicationDomainEx.IniStorage.GetValue<ClientConfig, string>(p => p.CLIENT_PULL_MESSAGE_URL);
/// <summary>
/// 刷新配置地址
/// </summary>
private readonly static string CLIENT_REFRESH_INI_CONFIG_URL = ApplicationDomainEx.IniStorage.GetValue<ClientConfig, string>(p => p.CLIENT_REFRESH_INI_CONFIG_URL);
// ==========================================================
// Commond
// ==========================================================
......@@ -506,6 +512,47 @@ namespace VIZ.TimeSlice.Module
#endregion
#region RefreshCommand -- 刷新配置命令
/// <summary>
/// 刷新配置命令
/// </summary>
public VCommand RefreshCommand { get; set; }
/// <summary>
/// 刷新配置
/// </summary>
private void Refresh()
{
this.IsStartButtonEnabled = false;
Task.Run(() =>
{
try
{
string url = CLIENT_REFRESH_INI_CONFIG_URL;
this.LogString = $"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} -- HTTP请求:{url}";
string result = HttpHelper.Get(url, null);
this.LogString = $"{this.LogString}\r\n{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} -- 返回: {result}";
}
catch (Exception ex)
{
log.Error(ex);
this.LogString = $"{this.LogString}\r\n{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} -- 异常: {ex.Message}";
}
finally
{
this.IsStartButtonEnabled = true;
}
});
}
#endregion
// ==========================================================
// Private Function
// ==========================================================
......
......@@ -17,5 +17,11 @@ namespace VIZ.TimeSlice.Storage
/// </summary>
[Ini(Section = "Client", DefaultValue = "http://localhost:8888/olympic/pull/message?status=1&path={path}", Type = typeof(string))]
public string CLIENT_PULL_MESSAGE_URL { get; set; }
/// <summary>
/// 刷新配置地址
/// </summary>
[Ini(Section = "Client", DefaultValue = "http://localhost:8888/olympic/update-config/message", Type = typeof(string))]
public string CLIENT_REFRESH_INI_CONFIG_URL { get; set; }
}
}
......@@ -7,7 +7,7 @@
xmlns:local="clr-namespace:VIZ.TimeSlice"
mc:Ignorable="d" WindowStartupLocation="CenterScreen"
Icon="icon.ico"
Title="时间切片工具" Height="800" Width="800" MinWidth="800" MinHeight="800">
Title="时间切片工具" Height="860" Width="800" MinWidth="800" MinHeight="860">
<Grid>
<module:MainView></module:MainView>
</Grid>
......
......@@ -28,3 +28,5 @@ format=mp4
[Client]
; 推送消息地址
CLIENT_PULL_MESSAGE_URL=http://localhost:8888/olympic/pull/message?status=1&path={path}
; 刷新配置地址
CLIENT_REFRESH_INI_CONFIG_URL=http://localhost:8888/olympic/update-config/message
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment