Skip to content

Commit

Permalink
v1.3.1 (#5)
Browse files Browse the repository at this point in the history
fix typo.
  • Loading branch information
MareMare authored Jun 30, 2022
1 parent e7ca358 commit 72ff40b
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions src/ExcelToA5er.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
<Copyright>© MareMare</Copyright>
<Description>A5:SQL Mk-2 で出力されたテーブル定義書からER図(.a5er)へ変換するツールです。</Description>
<Authors>MareMare</Authors>
<VersionPrefix>1.3.0</VersionPrefix>
<AssemblyVersion>1.3.0.0</AssemblyVersion>
<FileVersion>1.3.0.0</FileVersion>
<VersionPrefix>1.3.1</VersionPrefix>
<AssemblyVersion>1.3.1.0</AssemblyVersion>
<FileVersion>1.3.1.0</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private static DisplayItem[] ToDisplayItems(XlsxInformation xlsxInfo)
private async Task<XlsxInformation> LoadXlsxAsync(string xlsxFilePath)
{
using var progressForm = new ProgressForm { Title = "読み込み" };
await using var progressScoap = progressForm.UseProgressFormScoap(this);
await using var progressScoap = progressForm.UseProgressFormScope(this);
progressScoap.Reporter.ReportStarting("読み込み中です。しばらくお待ちください。");

var loadTask = XlsxInformation.LoadAsync(xlsxFilePath);
Expand All @@ -71,7 +71,7 @@ private async Task<XlsxInformation> LoadXlsxAsync(string xlsxFilePath)
private async Task SaveA5erAsync(string outputPath, ICollection<TableDefinition> tableDefinitions)
{
using var progressForm = new ProgressForm { Title = "変換" };
await using var progressScoap = progressForm.UseProgressFormScoap(this);
await using var progressScoap = progressForm.UseProgressFormScope(this);
progressScoap.Reporter.ReportStarting("変換中です。しばらくお待ちください。");

var generateTask = new A5erRuntimeTextTemplate(tableDefinitions).GenerateAsync(outputPath);
Expand Down
2 changes: 1 addition & 1 deletion src/Progress/FormExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ internal static class FormExtensions
public static async Task ShowAsync(this Form form, IWin32Window owner)
{
var tcs = new TaskCompletionSource<bool>();
form.FormClosed += (_, __) => tcs.TrySetResult(true);
form.FormClosed += (_, _) => tcs.TrySetResult(true);
form.Show(owner);
await tcs.Task.ConfigureAwait(false);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IProgressScoap.cs" company="MareMare">
// <copyright file="IProgressScope.cs" company="MareMare">
// Copyright © 2021 MareMare All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
// </copyright>
Expand All @@ -10,7 +10,7 @@ namespace ExcelToA5er.Progress;
/// <summary>
/// 進捗表示する範囲を提供するインターフェイスを表します。
/// </summary>
public interface IProgressScoap : IAsyncDisposable
public interface IProgressScope : IAsyncDisposable
{
/// <summary>
/// 進行状況の報告者を取得します。
Expand Down
24 changes: 12 additions & 12 deletions src/Progress/ProgressForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public partial class ProgressForm : Form
public ProgressForm()
{
this.InitializeComponent();
this._progressReporter = new ProgressReporter(progressInfo => this.UpdateBy(progressInfo));
this._progressReporter = new ProgressReporter(this.UpdateBy);
}

/// <summary>
Expand All @@ -49,7 +49,7 @@ public ProgressForm()
/// </summary>
/// <param name="owner">フォームを所有するトップレベルウィンドウ。</param>
/// <returns>進捗表示する範囲。</returns>
public IProgressScoap UseProgressFormScoap(IWin32Window owner) => new ProgressFormScoap(this, this.ShowDialogAsync(owner));
public IProgressScope UseProgressFormScope(IWin32Window owner) => new ProgressFormScope(this, this.ShowDialogAsync(owner));

/// <inheritdoc/>
protected override void OnLoad(EventArgs e)
Expand Down Expand Up @@ -87,7 +87,7 @@ private void ProgressForm_Load(object sender, EventArgs e)
/// <summary>
/// 進捗表示する範囲を表します。
/// </summary>
private sealed class ProgressFormScoap : IProgressScoap
private class ProgressFormScope : IProgressScope
{
/// <summary><see cref="ProgressForm"/> を表します。</summary>
private readonly ProgressForm _progressForm;
Expand All @@ -96,14 +96,17 @@ private sealed class ProgressFormScoap : IProgressScoap
private readonly Task<DialogResult> _progressFormTask;

/// <summary>
/// <see cref="ProgressFormScoap"/> クラスの新しいインスタンスを生成します。
/// <see cref="ProgressFormScope"/> クラスの新しいインスタンスを生成します。
/// </summary>
/// <param name="progressForm"><see cref="ProgressForm"/>。</param>
/// <param name="progressFormTask">表示完了を表すタスク。</param>
public ProgressFormScoap(ProgressForm progressForm, Task<DialogResult> progressFormTask)
public ProgressFormScope(ProgressForm progressForm, Task<DialogResult> progressFormTask)
{
this._progressForm = progressForm ?? throw new ArgumentNullException(nameof(progressForm));
this._progressFormTask = progressFormTask ?? throw new ArgumentNullException(nameof(progressFormTask));
ArgumentNullException.ThrowIfNull(progressForm);
ArgumentNullException.ThrowIfNull(progressFormTask);

this._progressForm = progressForm;
this._progressFormTask = progressFormTask;
this.Reporter = progressForm._progressReporter;
}

Expand All @@ -114,11 +117,8 @@ public ProgressFormScoap(ProgressForm progressForm, Task<DialogResult> progressF
public async ValueTask DisposeAsync()
{
// NOTE: https://stackoverflow.com/a/33411037
this._progressForm?.Close();
if (this._progressFormTask != null)
{
await this._progressFormTask.ConfigureAwait(true);
}
this._progressForm.Close();
await this._progressFormTask.ConfigureAwait(true);
}
}
}
4 changes: 2 additions & 2 deletions src/Progress/ProgressInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private ProgressInfo()
/// 値を表す <see cref="string" /> 型。
/// <para>進捗メッセージ。既定値は null です。</para>
/// </value>
public string? Message { get; private set; }
public string? Message { get; private init; }

/// <summary>
/// 進捗率 (0~100%) を取得します。
Expand All @@ -35,7 +35,7 @@ private ProgressInfo()
/// 値を表す <see cref="double" /> 型。
/// <para>進捗率 (0~100%)。既定値は 0d です。</para>
/// </value>
public double Percentage { get; private set; }
public double Percentage { get; private init; }

/// <summary>
/// 新しいインスタンスを生成します。
Expand Down

0 comments on commit 72ff40b

Please sign in to comment.