本文整理汇总了C#中ProgressEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# ProgressEventArgs类的具体用法?C# ProgressEventArgs怎么用?C# ProgressEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProgressEventArgs类属于命名空间,在下文中一共展示了ProgressEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProjectBuilder
protected ProjectBuilder(Project project, ProgressEventHandler total_handler, ProgressEventHandler task_handler)
{
this.project = project;
this.total_handler = total_handler;
this.task_handler = task_handler;
total = new ProgressEventArgs ();
}
示例2: OnProgressUpdate
public void OnProgressUpdate(object sender, ProgressEventArgs args)
{
this.filteredReplays = args.Filtered;
this.totalReplays = args.Total - args.Filtered;
this.progressBar1.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action<double>(this.UpdateProgressBar), args.Progress);
this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(this.Refresh));
}
示例3: ProgressHadler
public void ProgressHadler(object sender, ProgressEventArgs e)
{
if (!Visible)
Show();
if (e.Step == 0)
{
progressBar.Maximum = e.Steps;
begin = DateTime.Now;
}
progressBar.Value = e.Step;
stepLabel.Text = e.Step.ToString() + "/" + e.Steps.ToString();
actionNameLabel.Text = e.Process + " (" + e.ProcessedItem + ")";
Text = "Loading... (" + DateTime.Now.Subtract(begin).ToString() + ")";
if (DateTime.Now.Subtract(lastRefresh).Milliseconds > 200)
{
lastRefresh = DateTime.Now;
Refresh();
}
if (e.Step == (e.Steps - 1))
Hide();
}
示例4: processor_ProgressUpdate
void processor_ProgressUpdate(object sender, ProgressEventArgs<CopyFileWorkItem> e)
{
if (CopyFileProgressUpdate != null)
{
CopyFileProgressUpdate(this, e);
}
}
示例5: OnProgress
void OnProgress(object sender, ProgressEventArgs e) {
if (e.before < this.progress && e.after >= this.progress) {
Debug.LogFormat("{0} progress went from {1} to {2} which crosses threshold {3}, adding {4} to cash",
thing.name, e.before, e.after, this.progress, this.cash);
MoniesController.Instance.cash += this.cash;
thing.ProgressChanged -= OnProgress;
}
}
示例6: OnProgressEvent
protected virtual void OnProgressEvent(ProgressEventArgs e)
{
Throw.If(e).IsNull();
EventHandler<ProgressEventArgs> evt = ProgressEvent;
if (evt != null)
{
evt(this, e);
}
}
示例7: AssertEventArgsCorrect
private void AssertEventArgsCorrect(ProgressEventArgs actual, EventType et,
LocalNamespace ns, LocalTopic topic, Status oldStatus, Status newStatus,
string message)
{
Assert.AreEqual(et, actual.EventType,
"Checking that event types are equivalent for " + message);
Assert.AreEqual(ns.Name, actual.Namespace.Name,
"Checking that namespaces are equivalent for " + message);
Assert.AreEqual(topic.Name, actual.Topic.Name,
"Checking that topics are equivalent for " + message);
Assert.AreEqual(oldStatus, actual.OldStatus,
"Checking that old statuses are equivalent for " + message);
Assert.AreEqual(newStatus, actual.NewStatus,
"Checking that new statuses are equivalent for " + message);
}
示例8: ProgressHandler
public void ProgressHandler(object sender, ProgressEventArgs e)
{
progress.Invoke(new MethodInvoker(delegate()
{
if (!activity.Text.Equals(e.Process))
activityProgress.PerformStep();
activity.Text = e.Process;
activityCountLabel.Text = activityProgress.Value.ToString() + "/3";
progressText.Text = e.ProcessedItem;
progressCountLabel.Text = e.Step.ToString() + "/" + e.Steps;
if (e.Step == 0)
progress.Maximum = e.Steps;
progress.Value = e.Step;
}));
}
示例9: ShowProgress
private void ShowProgress(ProgressEventArgs e)
{
if ("nextStep".Equals(e.Message))
{
label9.Text = "Ready measuring with signal";
button3.Enabled = true;
progressBar.Value = 0;
return;
}
if (objProcess.getIsStopped())
{
label9.Text = "Result of measurement can be found in c:\\temp\\measurement.txt";
stopProcess();
progressBar.Value = 0;
return;
}
progressBar.Value = (progressBar.Value + 1) % 100;
if ( e.Message.Length > 0 ) label9.Text = e.Message;
}
示例10: AddFile
private bool AddFile(string filePath)
{
var success = false;
try
{
var tagFile = new TagFile(filePath);
Files.Add(tagFile);
FileIndex++;
success = true;
}
catch (TagLib.CorruptFileException)
{
FileCount--;
}
catch (TagLib.UnsupportedFormatException)
{
FileCount--;
}
var e = new ProgressEventArgs(index: FileIndex, count: FileCount, path: filePath, success: success);
Progress.Report(e);
return e.Continue;
}
示例11: ImportPricesFromEDDBStrings
/// <summary>
/// Imports the prices from a list of csv-strings in EDDB format
/// </summary>
/// <param name="CSV_Strings">data to import</param>
/// <param name="importBehaviour">filter, which prices to import</param>
/// <param name="dataSource">if data has no information about the datasource, this setting will count</param>
public void ImportPricesFromEDDBStrings(String[] CSV_Strings, enImportBehaviour importBehaviour, enDataSource dataSource, PriceImportParameters importParams)
{
List<EDStation> StationData;
Boolean updateTables = false;
ProgressEventArgs eva=new ProgressEventArgs();
Int32 initialSize=0;
try
{
StationData = fromCSV_EDDB(CSV_Strings);
if(importParams != null)
{
DataTable data = Program.Data.GetNeighbourSystems(importParams.SystemID, importParams.Radius);
String info = "filter data to the bubble (radius " + importParams.Radius+ " ly) : " + data.Rows.Count +" systems...";
eva = new ProgressEventArgs() { Info=info, NewLine=true};
if(!sendProgressEvent(eva))
{
if(data.Rows.Count > 0)
{
updateTables = true;
initialSize = StationData.Count();
for (int i = StationData.Count()-1 ; i >= 0 ; i--)
{
if(data.Rows.Find(StationData[i].SystemId) == null)
{
// system is not in the bubble
StationData.Remove(StationData[i]);
}
else
{
// system is in the bubble - set as visited
Program.Data.checkPotentiallyNewSystemOrStation(StationData[i].SystemName, StationData[i].Name, null, true);
}
eva = new ProgressEventArgs() { Info=info, CurrentValue=initialSize-i, TotalValue=initialSize };
sendProgressEvent(eva);
if(eva.Cancelled)
break;
}
}
else
StationData.Clear();
}
eva = new ProgressEventArgs() { Info=info, CurrentValue=initialSize, TotalValue=initialSize, ForceRefresh=true };
sendProgressEvent(eva);
}
if((!eva.Cancelled) && (updateTables))
{
eva = new ProgressEventArgs() { Info = "refreshing basetables in memory...", NewLine=true };
sendProgressEvent(eva);
if(!eva.Cancelled)
{
Program.Data.updateVisitedFlagsFromBase();
eva = new ProgressEventArgs() { Info = "refreshing basetables in memory...", CurrentValue=25, TotalValue=100, ForceRefresh=true };
sendProgressEvent(eva);
}
if(!eva.Cancelled)
{
Program.Data.PrepareBaseTables(Program.Data.BaseData.tbsystems.TableName);
eva = new ProgressEventArgs() { Info = "refreshing basetables in memory...", CurrentValue=50, TotalValue=100, ForceRefresh=true };
sendProgressEvent(eva);
}
if(!eva.Cancelled)
{
Program.Data.PrepareBaseTables(Program.Data.BaseData.tbstations.TableName);
eva = new ProgressEventArgs() { Info = "refreshing basetables in memory...", CurrentValue=75, TotalValue=100, ForceRefresh=true };
sendProgressEvent(eva);
}
if(!eva.Cancelled)
{
Program.Data.PrepareBaseTables(Program.Data.BaseData.visystemsandstations.TableName);
eva = new ProgressEventArgs() { Info = "refreshing basetables in memory...", CurrentValue=100, TotalValue=100, ForceRefresh=true };
sendProgressEvent(eva);
}
}
// now import the prices
if(!eva.Cancelled)
{
ImportPrices(StationData, importBehaviour, dataSource);
}
//.........这里部分代码省略.........
示例12: ImportPricesFromCSVStrings
/// <summary>
/// Imports the prices from a list of csv-strings
/// </summary>
/// <param name="CSV_Strings">data to import</param>
/// <param name="importBehaviour">filter, which prices to import</param>
/// <param name="dataSource">if data has no information about the datasource, this setting will count</param>
/// <returns>a list of converted station data (including correct station ids) </returns>
public List<EDStation> ImportPricesFromCSVStrings(String[] CSV_Strings, enImportBehaviour importBehaviour, enDataSource dataSource)
{
Boolean MissingSystem = false;
Boolean MissingStation = false;
String currentLanguage;
DataTable newData;
List<EDStation> StationData;
List<EDSystem> SystemData = null;
List<CsvRow> csvRowList = new List<CsvRow>();
ProgressEventArgs eva;
Int32 counter = 0;
Dictionary<String, String> foundNames = new Dictionary<string,string>(); // quick cache for finding commodity names
try
{
// *****************************************************************
// START :section for automatically add unknown commodities
currentLanguage = Program.DBCon.getIniValue(IBESettingsView.DB_GROUPNAME, "Language", Program.BASE_LANGUAGE, false);
newData = new DataTable();
newData.TableName = "Names";
newData.Columns.Add(Program.BASE_LANGUAGE, typeof(String));
if(currentLanguage != Program.BASE_LANGUAGE)
newData.Columns.Add(currentLanguage, typeof(String));
eva = new ProgressEventArgs() { Info="analysing data...", AddSeparator = true};
sendProgressEvent(eva);
for (int i = 0; i < CSV_Strings.Length; i++)
{
String currentName;
List<dsEliteDB.tbcommoditylocalizationRow> currentCommodity;
if (CSV_Strings[i].Trim().Length > 0)
{
currentName = new CsvRow(CSV_Strings[i]).CommodityName;
if (!String.IsNullOrEmpty(currentName))
{
// check if we need to remap this name
Datasets.dsEliteDB.tbdnmap_commodityRow mappedName = (Datasets.dsEliteDB.tbdnmap_commodityRow)BaseData.tbdnmap_commodity.Rows.Find(new object[] {currentName, ""});
if (mappedName != null)
{
CSV_Strings[i] = CSV_Strings[i].Replace(mappedName.CompanionName, mappedName.GameName);
currentName = mappedName.GameName;
}
if (!foundNames.ContainsKey(currentName))
{
currentCommodity = Program.Data.BaseData.tbcommoditylocalization.Where(x => x.locname.Equals(currentName, StringComparison.InvariantCultureIgnoreCase)).ToList();
if (currentCommodity.Count == 0)
{
if (currentLanguage == Program.BASE_LANGUAGE)
newData.Rows.Add(currentName);
else
newData.Rows.Add(currentName, currentName);
}
foundNames.Add(currentName, "");
}
}
}
counter++;
eva = new ProgressEventArgs() { Info="analysing data...", CurrentValue=counter, TotalValue=CSV_Strings.GetUpperBound(0) + 1 };
sendProgressEvent(eva);
if(eva.Cancelled)
break;
}
eva = new ProgressEventArgs() { Info="analysing data...", CurrentValue=counter, TotalValue=counter, ForceRefresh=true };
sendProgressEvent(eva);
if (!eva.Cancelled)
if(newData.Rows.Count > 0)
{
// add found unknown commodities
var ds = new DataSet();
ds.Tables.Add(newData);
ImportCommodityLocalizations(ds);
// refresh translation columns
Program.Data.updateTranslation();
// refresh working tables
Program.Data.PrepareBaseTables(Program.Data.BaseData.tbcommoditylocalization.TableName);
Program.Data.PrepareBaseTables(Program.Data.BaseData.tbcommodity.TableName);
}
// END : section for automatically add unknown commodities
// *****************************************************************
// convert csv-strings to EDStation-objects
StationData = fromCSV(CSV_Strings, ref SystemData, ref csvRowList);
//.........这里部分代码省略.........
示例13: OnProgress
public static void OnProgress(int progress)
{
try
{
var handler = OnProgressHandler;
if (handler == null) return;
var args = new ProgressEventArgs(progress);
handler(null, args);
}
catch (Exception)
{
//ignored
}
}
示例14: ProgressChangePercent
private void ProgressChangePercent(object sender, ProgressEventArgs e)
{
Assert.AreEqual(actualPerc, e.Percent);
actualPerc += actualAdd;
}
示例15: RunInternal
void RunInternal()
{
for (int i = 0; i < files.Count; i++)
{
string f = files[i];
multihasnext = false;
multiindex = 0;
do
{
LoadOne(f);
} while (multihasnext);
if (OnProgress != null)
{
var e = new ProgressEventArgs(i + 1, files.Count);
OnProgress(this, e);
if (e.ShouldCancel)
return;
}
}
}