Ookii-dialogs-wpf: ProgressDialogはProgressを実装する必要があります<t/>

作成日 2020年03月25日  ·  4コメント  ·  ソース: ookii-dialogs/ookii-dialogs-wpf

ProgressDialogがこれらのインターフェースを実装する場合、非常に役立つ可能性があります。

進捗率を報告するためのSystem.IProgress<int>
System.IProgress<Text> 、テキストの進行状況を報告します

したがって、ProgressDialogオブジェクトをプレーンオブジェクトとして実行中のジョブに渡し、進行状況レポート用にIProgress<int>IProgress<Text>にキャストすることができます。

enhancement help wanted

全てのコメント4件

@vpenadesに感謝し

それを突き刺してPRを送信したい場合はお知らせください。それ以外の場合は、次のリリースですぐに連絡します。

PR準備完了...

@ vpenadesOokii.Dialogs.WpfはIProgress<T>実装の改善の可能性について話し合いたい場合に備えて、pingを送信したいと思いました。

ps:返信する義務を感じないでください。 これは、これに対する以前の関心を考えると、単なる友好的なpingです。

ほとんどの場合、ユースケースは、 IProgress<T>複数のバージョンにキャストできるオブジェクト値で初期化されたバックグラウンドタスクであるため、バックグラウンドタスクの進行状況を報告できます。

あまり知られていないので、インターフェースはあまり使われていないと思いますが、 IProgress<T>はかなり前から存在しているので、ちょっと調べてみたところ、次のようになりました。

`` `C#
IProgress//進捗状況は0から1の間の値で報告されます
IProgress//進捗状況は0〜100の値で報告されます


It is very tempting to have a structure that keeps all the information required by the progress dialog (percent, text, description), but this _must be avoided_  because that would mean the caller needs to fill that structure, which would force it to have a dependency on the ookii library, this is probably not desirable for background tasks, or pure code libraries that don't want to depend on an UI library.

So, in order to pass rich progress information, we need to use only BCL types and collections. Unfortunately, `IProgress<T>` does not define a standard....   but in general I guess everybody will expect (int Percent, string Text, string Description)

So, I would propose adding these interfaces:

```c#
IProgress<float> // by far, the implementation I've found most occurences searching on github.
IProgress< KeyValuePair<string,object> > // where key is the name of the property to set (percent, text, desc)

さらに、現在のIProgress<INT>IProgress<STRING>はコンテンツをキャッシュできるため、相互に排他的ではありません。 現在のコードはすでに進行状況をキャッシュしていますが、テキストでも同じことを行う必要があります。 したがって、バックグラウンドタスクは、他のプロパティに対する前の呼び出しで設定された値を失うことなく、これらのインターフェイスを連続して呼び出すことができます。

このページは役に立ちましたか?
0 / 5 - 0 評価