mirror of
https://github.com/chylex/Code-Statistics.git
synced 2025-01-05 09:42:45 +01:00
Replace FileSearch.OnReady with ProjectLoadForm.UpdateCallbacks
This commit is contained in:
parent
2e43553228
commit
db29887ce1
CodeStatistics
@ -32,7 +32,7 @@ namespace CodeStatistics.Forms{
|
||||
}
|
||||
|
||||
private void OnLoad(object sender, EventArgs e){
|
||||
inputMethod.BeginProcess(OnReady);
|
||||
inputMethod.BeginProcess(new UpdateCallbacks(this));
|
||||
}
|
||||
|
||||
private void OnReady(FileSearch fileSearch){
|
||||
@ -132,5 +132,29 @@ namespace CodeStatistics.Forms{
|
||||
|
||||
Debugger.Break();
|
||||
}
|
||||
|
||||
public class UpdateCallbacks{
|
||||
private readonly ProjectLoadForm form;
|
||||
|
||||
public UpdateCallbacks(ProjectLoadForm form){
|
||||
this.form = form;
|
||||
}
|
||||
|
||||
public void UpdateInfoLabel(string text){
|
||||
form.InvokeOnUIThread(() => form.labelLoadInfo.Text = text);
|
||||
}
|
||||
|
||||
public void UpdateDataLabel(string text){
|
||||
form.InvokeOnUIThread(() => form.labelLoadInfo.Text = text);
|
||||
}
|
||||
|
||||
public void UpdateProgress(int progress){
|
||||
form.InvokeOnUIThread(() => form.progressBarLoad.Value = progress*10);
|
||||
}
|
||||
|
||||
public void OnReady(FileSearch fileSearch){
|
||||
form.InvokeOnUIThread(() => form.OnReady(fileSearch));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,11 +6,10 @@ using System.Threading.Tasks;
|
||||
using FileIO = System.IO.File;
|
||||
using DirectoryIO = System.IO.Directory;
|
||||
using CodeStatistics.Input.Methods;
|
||||
using CodeStatistics.Forms;
|
||||
|
||||
namespace CodeStatistics.Input{
|
||||
public class FileSearch : IInputMethod{
|
||||
public delegate void OnInputReady(FileSearch search);
|
||||
|
||||
public delegate void RefreshEventHandler(int entriesFound);
|
||||
public delegate void FinishEventHandler(FileSearchData searchData);
|
||||
|
||||
@ -112,8 +111,8 @@ namespace CodeStatistics.Input{
|
||||
}
|
||||
}
|
||||
|
||||
public void BeginProcess(OnInputReady onReady){
|
||||
onReady(this);
|
||||
public void BeginProcess(ProjectLoadForm.UpdateCallbacks callbacks){
|
||||
callbacks.OnReady(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
namespace CodeStatistics.Input.Methods{
|
||||
using CodeStatistics.Forms;
|
||||
|
||||
namespace CodeStatistics.Input.Methods{
|
||||
public interface IInputMethod{
|
||||
void BeginProcess(FileSearch.OnInputReady onReady);
|
||||
void BeginProcess(ProjectLoadForm.UpdateCallbacks callbacks);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user