Skip to content

Commit

Permalink
.csv file note service debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Surbowl committed Feb 18, 2021
1 parent 879085f commit 25932cf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
12 changes: 11 additions & 1 deletion src/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using OhSubtitle.Services;
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows;
Expand Down Expand Up @@ -123,7 +124,7 @@ protected ThemeColors ThemeColor
/// <summary>
/// 语言模式
/// </summary>
[MemberNotNull(nameof(_translationService))]
//[MemberNotNull(nameof(_translationService))]
protected LangModels LangModel
{
get
Expand Down Expand Up @@ -204,6 +205,11 @@ public MainWindow()
LangModel = LangModels.ZhEn;
}

if (_translationService == null)
{
_translationService = new GoogleJapaneseTranslationService();
}

_noteService = new CsvFileNoteService();
}

Expand Down Expand Up @@ -276,6 +282,10 @@ private void Window_MouseDown(object sender, MouseButtonEventArgs e)
/// <param name="e"></param>
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
imgWriteNote.Visibility = Visibility.Hidden;
imgReset.Visibility = Visibility.Hidden;
imgLoading.Visibility = Visibility.Visible;

// 保存当前位置、大小和状态到配置文件
Properties.Settings.Default.MainWindowsRect = RestoreBounds;
Properties.Settings.Default.ThemeColor = ThemeColor;
Expand Down
12 changes: 5 additions & 7 deletions src/OhSubtitle.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
<Nullable>enable</Nullable>
<WarningsAsErrors>$(WarningsAsErrors);CS8600;CS8602;CS8603;CS8618;CS8625</WarningsAsErrors>
<DebugType>embedded</DebugType>

<PackageIcon>icon.png</PackageIcon>
<ApplicationIcon>icon.ico</ApplicationIcon>
<PackageProjectUrl>https://github.com/Surbowl/Oh-Subtitle</PackageProjectUrl>
Expand All @@ -15,12 +19,6 @@
<AssemblyVersion>1.1.0.0</AssemblyVersion>
<FileVersion>1.1.0.0</FileVersion>
<Version>1.1.0</Version>
<Nullable>enable</Nullable>
<WarningsAsErrors>$(WarningsAsErrors);CS8600;CS8602;CS8603;CS8618;CS8625</WarningsAsErrors>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Services/CsvFileNoteService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class CsvFileNoteService : INoteService
/// <summary>
/// 完整文件路径
/// </summary>
public string FullFilePath => BaseDirectoryPath + FileName;
public string FullFilePath => BaseDirectoryPath + '\\' + FileName;

/// <summary>
/// Create a CsvFileNoteService
Expand All @@ -41,7 +41,7 @@ public CsvFileNoteService() : this("我的笔记MyNote.csv")
/// Create a CsvFileNoteService
/// </summary>
/// <param name="fileName">笔记文件名</param>
public CsvFileNoteService(string fileName) : this(System.AppDomain.CurrentDomain.BaseDirectory, fileName)
public CsvFileNoteService(string fileName) : this(Directory.GetCurrentDirectory(), fileName)
{
}

Expand Down

0 comments on commit 25932cf

Please sign in to comment.