Skip to content

Commit

Permalink
publish v1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Surbowl committed Feb 18, 2021
1 parent 25932cf commit fba0312
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@


## Download
- [v1.1.0_win_x86](https://github.com/Surbowl/Oh-Subtitle/raw/master/publish/Oh-Subtitle_v1.1.0_win_x86.zip)
- 添加对日语的支持
- 添加笔记本功能
- 启动时自动还原上次的位置、大小、主题色和语言模式
- [v1.0.5_win_x86](https://github.com/Surbowl/Oh-Subtitle/raw/master/publish/Oh-Subtitle_v1.0.5_win_x86.zip)
- 新增右键菜单,可选亮白、亮灰、暗灰、暗黑四种主题色
- [v1.0.4_win_x86](https://github.com/Surbowl/Oh-Subtitle/raw/master/publish/Oh-Subtitle_v1.0.4_win_x86.zip)
Expand Down
Binary file added publish/Oh-Subtitle_v1.1.0_win_x86.zip
Binary file not shown.
2 changes: 2 additions & 0 deletions src/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
TextChanged="TxtInput_TextChanged"/>
<fa:ImageAwesome x:Name="imgWriteNote" Icon="BookmarkOutline" Width="13" Height="13" Grid.Column="1" Margin="0,30,0,2" Foreground="FloralWhite" Visibility="Hidden"
MouseDown="ImgWriteNote_MouseDown" Cursor="Hand" ToolTip="记笔记 WriteNote"/>
<fa:ImageAwesome x:Name="imgNoteWrote" Icon="Bookmark" Width="13" Height="13" Grid.Column="1" Margin="0,30,0,2" Foreground="FloralWhite" Visibility="Hidden"
ToolTip="笔记已添加到文件:我的笔记MyNote.csv"/>
<fa:ImageAwesome x:Name="imgReset" Icon="TrashOutline" Height="14" Width="14" Grid.Column="1" Margin="0,2,0,20" Foreground="FloralWhite" Visibility="Hidden"
MouseDown="ImgReset_MouseDown" Cursor="Hand" ToolTip="清空输入框 ClearInput"/>
<fa:ImageAwesome x:Name="imgLoading" Icon="Refresh" Spin="True" Height="14" Width="14" Grid.Column="1" Foreground="FloralWhite" Visibility="Hidden"/>
Expand Down
9 changes: 8 additions & 1 deletion src/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ private void SetWindowColor(Brush background, Brush foreground)
{
Background = txtInput.Background = background;
txtInput.Foreground = txtResult.Foreground = foreground;
imgLoading.Foreground = imgReset.Foreground = imgWriteNote.Foreground = imgEye.Foreground = imgClose.Foreground = foreground;
imgLoading.Foreground = imgReset.Foreground = imgWriteNote.Foreground = imgNoteWrote.Foreground = imgEye.Foreground = imgClose.Foreground = foreground;
}
#endregion WindowEvent & Action 窗体事件与方法

Expand Down Expand Up @@ -367,10 +367,16 @@ private async void ImgWriteNote_MouseDown(object sender, MouseButtonEventArgs e)
{
try
{
imgWriteNote.Visibility = Visibility.Hidden;
imgNoteWrote.Visibility = Visibility.Visible;

await _noteService.WriteAsync(txtInput.Text, txtResult.Text);
}
catch
{
imgWriteNote.Visibility = Visibility.Visible;
imgNoteWrote.Visibility = Visibility.Hidden;

txtInput.Text = "笔记记录失败,可能是因为文件被占用或没有写入文件的权限。如果您已打开笔记文件,请将其关闭后再记录笔记;如果依然无法记录笔记,请尝试使用系统管理员权限启动本应用。";
}
}
Expand Down Expand Up @@ -505,6 +511,7 @@ private void TxtInput_TextChanged(object sender, TextChangedEventArgs e)
private async void HandleTypingTimerTimeoutAsync(object sender, EventArgs e)
{
imgWriteNote.Visibility = Visibility.Hidden;
imgNoteWrote.Visibility = Visibility.Hidden;
imgReset.Visibility = Visibility.Hidden;
imgLoading.Visibility = Visibility.Visible;

Expand Down
9 changes: 5 additions & 4 deletions src/Services/CsvFileNoteService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.IO;
using System;
using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -13,7 +14,7 @@ public class CsvFileNoteService : INoteService
/// <summary>
/// 表头
/// </summary>
const string TableHeader = "原文,翻译";
const string TableHeader = "时间,原文,翻译";

/// <summary>
/// 笔记文件名
Expand Down Expand Up @@ -69,8 +70,8 @@ public async Task WriteAsync(string orig, string translated, CancellationToken c
translated = translated.Replace('\n', ' ')
.Replace(',', ',');

string appendText = File.Exists(FullFilePath) ? $"\n{orig},{translated}"
: $"{TableHeader}\n{orig},{translated}";
string appendText = File.Exists(FullFilePath) ? $"\n{DateTime.Now:yyyy-MM-dd HH:mm},{orig},{translated}"
: $"{TableHeader}\n{DateTime.Now:yyyy-MM-dd HH:mm},{orig},{translated}";
if (cancellationToken.IsCancellationRequested)
{
return;
Expand Down

0 comments on commit fba0312

Please sign in to comment.