Skip to content
This repository has been archived by the owner on Dec 18, 2022. It is now read-only.

Commit

Permalink
更新 UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Misaka-L committed Aug 5, 2020
1 parent 1fe331e commit a960ff5
Show file tree
Hide file tree
Showing 9 changed files with 144 additions and 128 deletions.
6 changes: 3 additions & 3 deletions App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
</startup>
</configuration>
</configuration>
8 changes: 7 additions & 1 deletion App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
xmlns:local="clr-namespace:Vrc_Lyric_Format_Convert_GUI"
StartupUri="MainWindow.xaml">
<Application.Resources>

<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Light.Blue.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
96 changes: 49 additions & 47 deletions MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,53 +1,55 @@
<Window x:Class="Vrc_Lyric_Format_Convert_GUI.MainWindow"
<mah:MetroWindow x:Class="Vrc_Lyric_Format_Convert_GUI.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Vrc_Lyric_Format_Convert_GUI"
xmlns:mah ="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
mc:Ignorable="d"
Title="Vrc Converter - Alpha v1.1 有问题请联系组内或开 Issue" Height="500" Width="800" Icon="bitbug_favicon.ico">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="0"/>
</Grid.ColumnDefinitions>
<GroupBox Grid.Column="1" Header="输出内容" FontSize="18">
<TextBox x:Name="OutPut" AcceptsReturn="True" VerticalScrollBarVisibility="Visible" TextWrapping="Wrap" Grid.Column="1"/>
</GroupBox>
<GroupBox Grid.Column="0" Header="设定" FontSize="18">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<StackPanel>
<GroupBox Header="文件位置" FontSize="18">
<StackPanel>
<TextBlock x:Name="SourceFileDisplay" TextWrapping="Wrap" Text="源文件路径:" FontSize="14" Padding="5,5,5,0"/>
<Button Content="选择源文件路径" x:Name="SourcePathInput" FontSize="18" Margin="5,0" Click="SourcePathInput_Click"/>
<TextBlock x:Name="OutPutFileDisplay" TextWrapping="Wrap" Text="输出文件路径:源文件路径下" FontSize="14" Padding="5,5,5,0"/>
<Button Content="选择输出文件路径" x:Name="OutPutPathInput" FontSize="18" Margin="5,0" Click="OutPutPathInput_Click"/>
<CheckBox x:Name="IsRecursion" Content="转换目录下所有歌词文件" VerticalContentAlignment="Center" Margin="0,5,0,0" Checked="IsRecursion_Checked" Unchecked="IsRecursion_Unchecked"/>
</StackPanel>
</GroupBox>
<GroupBox Header="源文件格式">
<StackPanel>
<RadioButton x:Name="txtRadio" GroupName="DataType" Content="txt" Margin="5,0,0,0" FontSize="18" VerticalContentAlignment="Center"/>
<RadioButton x:Name="mlrcRadio" GroupName="DataType" Content="mlrc" Margin="5,0,0,0" FontSize="18" VerticalContentAlignment="Center"/>
<RadioButton x:Name="assRadio" GroupName="DataType" Content="ass" Margin="5,0,0,0" FontSize="18" VerticalContentAlignment="Center"/>
</StackPanel>
</GroupBox>
<GroupBox Header="Json 设置 (看不懂不用动)">
<StackPanel>
<TextBlock TextWrapping="Wrap" Text="Json 缩进空格数:" FontSize="14" Padding="5,5,5,0"/>
<TextBox x:Name="JsonIndent" FontSize="18" Margin="5,0" Text="2"/>
</StackPanel>
</GroupBox>
<Button x:Name="README" Content="点击查看说明" Margin="0,5,0,0" Click="README_Click"/>
<TextBlock TextWrapping="Wrap" Text="这界面是开发赶着奔丧写的,比较丑请谅解"/>
</StackPanel>
<Button x:Name="Run" Click="Run_Click" Grid.Row="1" Content="走你!" FontSize="18"/>
</Grid>
</GroupBox>
</Grid>
</Window>
Title="Vrc Converter - v1.2 有问题请联系组内或开 Issue" Height="600" Width="520">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="0"/>
</Grid.ColumnDefinitions>
<GroupBox Grid.Column="1" Header="输出内容" FontSize="18">
<TextBox x:Name="OutPut" AcceptsReturn="True" VerticalScrollBarVisibility="Visible" TextWrapping="Wrap" Grid.Column="1"/>
</GroupBox>
<GroupBox Grid.Column="0" Header="设定" FontSize="18">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<StackPanel>
<GroupBox Header="文件位置" FontSize="18">
<StackPanel>
<TextBlock x:Name="SourceFileDisplay" TextWrapping="Wrap" Text="源文件路径:" FontSize="14" Padding="5,0"/>
<Button Content="选择源文件路径" x:Name="SourcePathInput" FontSize="18" Margin="5,0" Click="SourcePathInput_Click"/>
<TextBlock x:Name="OutPutFileDisplay" TextWrapping="Wrap" Text="输出文件路径:源文件路径下" FontSize="14" Padding="5,0" Margin="0,5,0,0"/>
<Button Content="选择输出文件路径" x:Name="OutPutPathInput" FontSize="18" Margin="5,0" Click="OutPutPathInput_Click"/>
<CheckBox x:Name="IsRecursion" Content="转换目录下所有歌词文件" VerticalContentAlignment="Center" Margin="5,5,0,0" Checked="IsRecursion_Checked" Unchecked="IsRecursion_Unchecked"/>
</StackPanel>
</GroupBox>
<GroupBox Header="源文件格式">
<StackPanel>
<RadioButton x:Name="txtRadio" GroupName="DataType" Content="txt" Margin="5,0,0,0" FontSize="18" VerticalContentAlignment="Center"/>
<RadioButton x:Name="mlrcRadio" GroupName="DataType" Content="mlrc" Margin="5,0,0,0" FontSize="18" VerticalContentAlignment="Center"/>
<RadioButton x:Name="assRadio" GroupName="DataType" Content="ass" Margin="5,0,0,0" FontSize="18" VerticalContentAlignment="Center"/>
</StackPanel>
</GroupBox>
<GroupBox Header="Json 设置 (看不懂不用动)">
<StackPanel>
<TextBlock TextWrapping="Wrap" Text="Json 缩进空格数:" FontSize="14" Padding="5,0"/>
<TextBox x:Name="JsonIndent" FontSize="18" Margin="5,0" Text="2"/>
</StackPanel>
</GroupBox>
<Button x:Name="README" Content="点击查看说明" Margin="0,5,0,0" Click="README_Click" FontSize="18"/>
</StackPanel>
<Button x:Name="Run" Click="Run_Click" Grid.Row="1" Content="走你!" FontSize="18"/>
</Grid>
</GroupBox>
</Grid>
</ScrollViewer>
</mah:MetroWindow>
43 changes: 23 additions & 20 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.Win32;
using ControlzEx.Standard;
using MahApps.Metro.Controls;
using MahApps.Metro.Controls.Dialogs;
using Microsoft.Win32;
using Microsoft.WindowsAPICodePack.Dialogs;
using System;
using System.Collections.Generic;
Expand All @@ -23,7 +26,7 @@ namespace Vrc_Lyric_Format_Convert_GUI
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
public partial class MainWindow : MetroWindow
{
private string sourceFormat = "";
private string jsonIndent = "2";
Expand Down Expand Up @@ -62,15 +65,15 @@ private void Run_Click(object sender, RoutedEventArgs e)
{
if (sourceFormat == "")
{
MessageBox.Show("你还没有输入完参数呢!怎么跑");
this.ShowMessageAsync("运行失败", "你还没有输入完参数呢!怎么跑");
}
else if (sourceDirPath == "")
{
MessageBox.Show("你还没有输入完参数呢!怎么跑");
this.ShowMessageAsync("运行失败", "你还没有输入完参数呢!怎么跑");
}
else if (jsonIndent == "")
{
MessageBox.Show("你还没有输入完参数呢!怎么跑");
this.ShowMessageAsync("运行失败", "你还没有输入完参数呢!怎么跑");
}
else
{
Expand All @@ -83,15 +86,15 @@ private void Run_Click(object sender, RoutedEventArgs e)
{
if (sourceFormat == "")
{
MessageBox.Show("你还没有输入完参数呢!怎么跑");
this.ShowMessageAsync("运行失败", "你还没有输入完参数呢!怎么跑");
}
else if (sourcePath == "")
{
MessageBox.Show("你还没有输入完参数呢!怎么跑");
this.ShowMessageAsync("运行失败", "你还没有输入完参数呢!怎么跑");
}
else if (jsonIndent == "")
{
MessageBox.Show("你还没有输入完参数呢!怎么跑");
this.ShowMessageAsync("运行失败", "你还没有输入完参数呢!怎么跑");
}
else
{
Expand Down Expand Up @@ -243,7 +246,7 @@ private void ExecuteCMD(string StartFileName, string StartFileArg)
catch (Exception e)
{
Run.Dispatcher.Invoke(new Action(delegate { Run.IsEnabled = true; Run.Content = "走你!"; }));
MessageBox.Show("错误信息:\r\n" + e.Message + "\r\n错误追踪:\r\n" + e.StackTrace, "无法运行脚本");
Dispatcher.Invoke(new Action(delegate { this.ShowMessageAsync("无法运行脚本", "错误信息:\r\n" + e.Message + "\r\n错误追踪:\r\n" + e.StackTrace); }));
//OutPut.AppendText("无法运行脚本 错误信息:\r\n");
//OutPut.AppendText(e.Message);
//OutPut.AppendText("\r\n错误追踪:\r\n");
Expand Down Expand Up @@ -292,7 +295,7 @@ private void ProcessExit(object sender, EventArgs e)
}
catch (Exception exx)
{
MessageBox.Show("文件将被输出到:" + files[i].FullName + "\r\n错误信息:\r\n" + exx.Message + "\r\n错误追踪:\r\n" + exx.StackTrace, "无法将文件输出到指定目录!");
Dispatcher.Invoke(new Action(delegate { this.ShowMessageAsync("无法将文件输出到指定目录", "文件将被输出到:" + files[i].FullName + "\r\n错误信息:\r\n" + exx.Message + "\r\n错误追踪:\r\n" + exx.StackTrace); }));
isOk = false;
}
}
Expand All @@ -310,7 +313,7 @@ private void ProcessExit(object sender, EventArgs e)
}
catch (Exception exx)
{
MessageBox.Show("文件将被输出到:" + files[i].FullName + "\r\n错误信息:\r\n" + exx.Message + "\r\n错误追踪:\r\n" + exx.StackTrace, "无法将文件输出到指定目录!");
Dispatcher.Invoke(new Action(delegate { this.ShowMessageAsync("输出失败", "部分文件可能没有输出成功"); }));
isOk = false;
}
}
Expand All @@ -319,10 +322,10 @@ private void ProcessExit(object sender, EventArgs e)

if (isOk)
{
MessageBox.Show("文件已输出到:" + outputDirPath, "输出成功!");
Dispatcher.Invoke(new Action(delegate { this.ShowMessageAsync("输出成功", "文件已输出到:" + outputDirPath); }));
} else
{
MessageBox.Show("部分文件可能没有输出成功", "输出失败!");
Dispatcher.Invoke(new Action(delegate { this.ShowMessageAsync("输出失败", "部分文件可能没有输出成功"); }));
}
#endregion
}
Expand All @@ -345,11 +348,11 @@ private void ProcessExit(object sender, EventArgs e)

if (isOk)
{
MessageBox.Show("文件已输出到源目录","输出成功");
Dispatcher.Invoke(new Action(delegate { this.ShowMessageAsync("输出成功", "文件已输出到源目录"); }));
}
else
{
MessageBox.Show("部分文件可能没有输出成功", "输出失败!");
Dispatcher.Invoke(new Action(delegate { this.ShowMessageAsync("输出失败", "部分文件可能没有输出成功"); }));
}
#endregion
}
Expand All @@ -362,28 +365,28 @@ private void ProcessExit(object sender, EventArgs e)
{
if (File.Exists(deOutPutPath))
{
MessageBox.Show("文件已输出到:" + deOutPutPath, "输出成功!");
Dispatcher.Invoke(new Action(delegate { this.ShowMessageAsync("输出成功", "文件已输出到:"+deOutPutPath); }));
}
else
{
MessageBox.Show("输出失败! 请尝试手动调用脚本", "输出失败!");
Dispatcher.Invoke(new Action(delegate { this.ShowMessageAsync("输出失败", "请尝试手动调用脚本"); }));
}
}
else if (File.Exists(deOutPutPath))
{
try
{
File.Move(deOutPutPath, outputPath);
MessageBox.Show("文件已输出到:" + outputPath,"输出成功");
Dispatcher.Invoke(new Action(delegate { this.ShowMessageAsync("输出成功", "文件已输出到:" + outputPath); }));
}
catch (Exception a)
{
MessageBox.Show("文件将被输出到:" + deOutPutPath + "\r\n错误信息:\r\n" + a.Message + "\r\n错误追踪:\r\n" + a.StackTrace, "无法将文件输出到指定目录!");
Dispatcher.Invoke(new Action(delegate { this.ShowMessageAsync("无法将文件输出到指定目录", "文件将被输出到:" + deOutPutPath + "\r\n错误信息:\r\n" + a.Message + "\r\n错误追踪:\r\n" + a.StackTrace); }));
}
}
else
{
MessageBox.Show("输出失败! 请尝试手动调用脚本", "输出失败!");
Dispatcher.Invoke(new Action(delegate { this.ShowMessageAsync("输出失败", "请尝试手动调用脚本"); }));
}
#endregion
}
Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: NeutralResourcesLanguage("zh-CN")]
Loading

0 comments on commit a960ff5

Please sign in to comment.