/// <summary> /// The progress complete. /// </summary> /// <param name="progress"> /// The progress. /// </param> private static void ProgressComplete(ProgressItem progress) { if (progress != null) { progress.SetProgress(100); } }
public async Task <List <ProgressItem> > LoadByCorrelationIdAsync(Guid correlationId, CancellationToken cancellationToken) { var items = new List <ProgressItem>(); await ExecuteAsync(async cmd => { cmd.CommandText = await SqlLoader.GetScript("Progress.LoadByCorrelationId"); cmd.AddParameter("@CorrelationId", correlationId); using (var rdr = await cmd.ExecuteReaderAsync(cancellationToken)) { while (await rdr.ReadAsync(cancellationToken)) { var workItem = new ProgressItem { CorrelationId = rdr.Map <Guid>(nameof(ProgressItem.CorrelationId)), Id = rdr.Map <Guid>(nameof(ProgressItem.Id)), Name = rdr.Map <string>(nameof(ProgressItem.Name)), Note = rdr.Map <string>(nameof(ProgressItem.Note)), Queue = rdr.Map <string>(nameof(ProgressItem.Queue)), RecordedOn = rdr.Map <DateTime>(nameof(ProgressItem.RecordedOn)), Value = rdr.Map <int>(nameof(ProgressItem.Value)), WorkId = rdr.Map <Guid>(nameof(ProgressItem.WorkId)) }; items.Add(workItem); } } }, cancellationToken); return(items); }
/// <summary> /// The execute query simple. /// </summary> /// <param name="query">The query.</param> /// <param name="parameterValues">The parameter values.</param> /// <param name="version">The version.</param> /// <param name="progress">The progress.</param> /// <param name="groups">The groups.</param> /// <returns> /// The <see cref="QueryInstanceResultInfo" />. /// </returns> public QueryInstanceResultInfo ExecuteQuerySimple( QueryInfo query, QueryExecutionParams parameters, InstanceVersion version, ProgressItem progress, params GroupDefinition[] groups ) { // Log.InfoFormat("73:query:'{0}'", // query // ); QueryInstanceResultInfo result = new QueryInstanceResultInfo(this.Instance); QueryItemInfo queryItem = query.Items.GetQueryItemForVersion(version); this.PrepareProgress(progress, groups); this.ExecuteQuery( query, parameters, progress, groups, result, queryItem ); return result; }
private void RaiseComplete(ProgressItem prog) { if (OnComplete != null) { OnComplete(this, new RunWorkerCompletedEventArgs(prog, null, false)); } }
private void RaiseProgress(int percent, ProgressItem prog) { if (OnProgressChanged != null) { OnProgressChanged(this, new ProgressChangedEventArgs(percent, prog)); } }
internal override void resetParentsChildren() { // TODO: for parents null through _ProgressItem = null; _CompletedBy = null; _UserProgressChecklist = null; }
private static bool CheckTree(CelestialBodySubtree tree, ProgressItem pi) { if (tree == null) { return(false); } switch (pi) { case ProgressItem.REACHED: return(tree.IsReached); case ProgressItem.ORBITED: return(tree.orbit.IsComplete); case ProgressItem.LANDED: return(tree.landing.IsComplete); case ProgressItem.ESCAPED: return(tree.escape.IsComplete); case ProgressItem.RETURNED_FROM: return(tree.returnFromFlyby.IsComplete); } return(false); }
/// <summary> /// The execute query simple. /// </summary> /// <param name="query">The query.</param> /// <param name="parameterValues">The parameter values.</param> /// <param name="version">The version.</param> /// <param name="progress">The progress.</param> /// <param name="groups">The groups.</param> /// <returns> /// The <see cref="QueryInstanceResultInfo" />. /// </returns> public QueryInstanceResultInfo ExecuteQuerySimple( QueryInfo query, QueryExecutionParams parameters, InstanceVersion version, ProgressItem progress, params GroupDefinition[] groups ) { // Log.InfoFormat("73:query:'{0}'", // query // ); QueryInstanceResultInfo result = new QueryInstanceResultInfo(this.Instance); QueryItemInfo queryItem = query.Items.GetQueryItemForVersion(version); this.PrepareProgress(progress, groups); this.ExecuteQuery( query, parameters, progress, groups, result, queryItem ); return(result); }
public void Load() { if (loaded) { return; } progressDict = Storage.shared.DeserializeLoad(GetSavePath(), new Dictionary <string, ProgressItem>()); Package[] packages = Repository.shared.GetAllPackages(); foreach (var pkg in packages) { ProgressItem item; if (progressDict.ContainsKey(pkg.id)) { item = progressDict[pkg.id]; } else { item = new ProgressItem(); item.progress = 0; progressDict.Add(pkg.id, item); } item.total = pkg.CountQuestions(); completedCount += item.progress; } loaded = true; }
public System.IProgress <float> Add() { var item = new ProgressItem(); Add(item); return(item); }
public void NotifyTaskProgressItemValueAndTotal(string sellerAccount, ProgressItem sellerAccountProgress) { SendOrPostCallback callback = delegate(object state) { lock (lockObject) { if (!progressSynchronous.IsTotalCountSet) { var totalInfo = client.GetProgressTotal(serviceType); setTotalCount(totalInfo); } setSellerAccountCount(sellerAccount, sellerAccountProgress); if (progressSynchronous.TotalType == TotalType.User) //按照账号 { if (progressSynchronous.IsSellerAccountFinished(sellerAccount)) { progressSynchronous.TotalValue++; } } else { progressSynchronous.TotalValue++; } ShowSumTaskBar(); } }; uiSyncContext.Post(callback, null); }
/// <summary> /// The process group. /// </summary> /// <param name="query">The query.</param> /// <param name="parameterValues">The parameter values.</param> /// <param name="result">The result.</param> /// <param name="queryItem">The query item.</param> /// <param name="group">The group.</param> /// <param name="subProgress">The sub progress.</param> protected virtual void ExecuteQuery( QueryInfo query, QueryExecutionParams parameters, QueryInstanceResultInfo result, QueryItemInfo queryItem, GroupDefinition group, ProgressItem subProgress ) { // Log.InfoFormat("146:query:'{0}'", // query // ); var qr = this.ExecuteQueryItemFunction.Invoke( this.Instance, queryItem, string.IsNullOrWhiteSpace(group.Name) ? parameters.DefaultDatabase : group.Name, //group.Name, group.Id, query.Parameters, parameters.Values.ToList(), subProgress ); // костыль. Наверное, прибъется вообще после убиения "групп" qr.Database = group.Name; result.AddDatabaseResult(qr); }
public IActionResult Update(Guid id, [FromBody] ProgressItem item) { if (item == null) { return(BadRequest()); } var progressItem = _context.ProgressItems.FirstOrDefault(t => t.Id == id); if (progressItem == null) { return(NotFound()); } progressItem.DisplayText = item.DisplayText; progressItem.DisplayValue = item.DisplayValue; progressItem.MeasureId = item.MeasureId; progressItem.TargetValue = item.TargetValue; progressItem.Type = item.Type; progressItem.Value = item.Value; progressItem.MaxValue = item.MaxValue; _context.ProgressItems.Update(progressItem); _context.SaveChanges(); return(GetById(id)); }
void gridViewReport_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { ProgressItem item = gridViewReport.GetRow(e.RowHandle) as ProgressItem; if (item != null && item.Status == ProgressStatus.Error) { e.Appearance.BackColor = Color.IndianRed; } }
private void ClearExpired() { var expired = _timer.ElapsedTicks - _maximumTicks; while ((_queue.Count > _minimumData) && (_queue.Peek().Key < expired)) { _oldest = _queue.Dequeue(); } }
/// <summary> /// End()が呼ばれないままループを抜ける等しても /// 「using ステートメント」を使用していれば自動的に閉じる。 /// </summary> public void Dispose() { if (ProgressStack.Count > 0) { ProgressStack.Clear(); CurrentItem = null; UnityEditor.EditorUtility.ClearProgressBar(); } }
private void OnProgressChanged(object sender, ProgressItem e) { if (e == null) { return; } Status = e.Message.ToString(CultureInfo.CurrentUICulture); }
public ProgressItem(ProgressItem p) { prog = p.prog; x = p.x; z = p.z; u = p.u; v = p.v; msg = p.msg; t = p.t; }
private static IEnumerable <CelestialBody> BodiesForItem(ProgressItem pi) { if (ProgressTracking.Instance == null) { return(Enumerable.Empty <CelestialBody>()); } return(ProgressTracking.Instance.celestialBodyNodes.Where(node => CheckTree(node, pi)).Select(node => node.Body). Where(cb => cb.Radius >= BARYCENTER_THRESHOLD)); }
public void Init() { items.Clear(); foreach (GameItems id in System.Enum.GetValues(typeof(GameItems))) { ProgressItem item = new ProgressItem(); item.Init(id); items[id] = item; } }
private static bool IsReached(CelestialBody cb, ProgressItem pi) { if (ProgressTracking.Instance == null) { return(false); } CelestialBodySubtree tree = ProgressTracking.Instance.celestialBodyNodes.Where(node => node.Body == cb).FirstOrDefault(); return(tree == null ? false : CheckTree(tree, pi)); }
public IActionResult Create([FromBody] ProgressItem item) { if (item == null) { return(BadRequest()); } _context.ProgressItems.Add(item); _context.SaveChanges(); return(CreatedAtRoute("GetProgress", new { id = item.Id }, item)); }
public static void CreateFromDirectory(TaxonTreeNode _root, string path) { TaxonSearch searchTool = new TaxonSearch(_root, true, true); int countFound = 0; int countNotFound = 0; string[] files = Directory.GetFiles(path, "*.txt"); string logFilename = Path.Combine(TaxonUtils.GetTaxonLocationPath(), "CreateFromDirectory.log"); using (StreamWriter log = new StreamWriter(logFilename)) { using (ProgressDialog progressDlg = new ProgressDialog()) { progressDlg.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; progressDlg.Show(); ProgressItem parseFiles = progressDlg.Add("parseFiles", "", 0, files.Length); foreach (string file in files) { parseFiles.Inc(file); log.WriteLine("Import " + file + ":"); France.Departement dep = France.Data.Departements.GetDepartementFromName(Path.GetFileNameWithoutExtension(file)); if (dep == null) { log.WriteLine(" associated departement not found"); continue; } TaxonList.ImportFileResult resultImport = TaxonList.ImportFile(file, searchTool); log.WriteLine(" " + resultImport.TaxonsFound + " taxons found"); log.WriteLine(" " + resultImport.TaxonNotFound + " taxons not found"); countFound += resultImport.TaxonsFound; countNotFound += resultImport.TaxonNotFound; TaxonList taxons = new TaxonList(); taxons.FromTaxonTreeNodeList(resultImport.List); taxons.HasFile = true; taxons.FileName = Path.Combine(TaxonUtils.GetTaxonLocationPath(), dep.Id + ".xml"); taxons.Save(); } } } string message = "Create location data from directory " + path + ": \n"; message += String.Format(" taxons found: {0}\n", countFound); message += String.Format(" taxons not found: {0}\n", countNotFound); message += String.Format("for more details, look at " + logFilename + " file, and all other generated logs"); Loggers.WriteInformation(LogTags.Location, message); }
private void setSellerAccountCount(string sellerAccount, ProgressItem progress) { progressSynchronous.SetSellerAccountValueAndTotal(sellerAccount, progress.Value, progress.Total, () => { var uc = new ucSellerProgressBar(sellerAccount, 0, progress.Total); uc.Name = sellerAccount; uc.Value = progress.Value; this.flowLayoutPanel1.Controls.Add(uc); return(uc); }); }
public static int Start(string title) { lock (s_ProgressItems) { var progressId = s_NextProgressId++; var progressItem = new ProgressItem() { id = progressId, title = title }; s_ProgressItems[progressId] = progressItem; return(progressId); } }
/// <summary> /// Creates a new progress object implementing the <see cref="IProgress"/> interface. /// </summary> /// <remarks> /// This function does not call the <see cref="Updated"/> event for the newly created <see cref="IProgress"/> instance. /// The <see cref="Updated"/> event will be fired upon the first <see cref="IProgress.Update(float, string)"/> call. /// </remarks> /// <returns>Retruns a new instance implementing the <see cref="IProgress"/> interface.</returns> public IProgress CreateProgress() { var result = new ProgressItem(this); lock (this) { #if NET20 items.Add(result, result); #else items.Add(result); #endif } return(result); }
/// <summary> /// The prepare progress. /// </summary> /// <param name="progress">The progress.</param> /// <param name="groups">The groups.</param> private void PrepareProgress(ProgressItem progress, GroupDefinition[] groups) { if (progress != null) { if (groups.Length > 0) { progress.SetPromisedChildCount(groups.Length); } else { progress.SetProgress(100); } } }
private void OnProgressChanged(object sender, ProgressItem e) { if (e == null) { return; } if (!IsActive) { IsActive = true; } Text = e.Message.ToString(CultureInfo.CurrentUICulture); ProgressValue = e.ProgressValue; }
/// <summary> /// Get user's progressinfo for the given servicetype and the given user. /// </summary> /// <param name="serviceType">The given servicetype.</param> /// <param name="user">The user.</param> /// <returns></returns> public ProgressItem GetUserProgressInfo(EServiceType serviceType, string user) { if (ContainsKey(serviceType)) { var info = this[serviceType]; if (info.ContainsKey(user)) { var progress = new ProgressItem(); progress.Total = info[user].Total; progress.Value = info[user].Value; return(progress); } } return(null); }
public void SetProgress(string id, int progress, int total) { if (!progressDict.ContainsKey(id)) { var item = new ProgressItem(); item.progress = progress; item.total = total; progressDict.Add(id, item); } else { progressDict[id].progress = progress; progressDict[id].total = total; } UpdateCompletedCount(); }
/// <summary> /// 終了(ネスト深度を1段階浅くします。) /// </summary> /// <returns>キャンセルされた場合trueを返します。</returns> public virtual bool End() { if (ProgressStack.Count > 0) { ProgressStack.Pop(); if (ProgressStack.Count <= 0) { CurrentItem = null; UnityEditor.EditorUtility.ClearProgressBar(); } else { CurrentItem = ProgressStack.Peek(); } } return(Canceled); }
/// <inheritdoc /> protected override void ExecuteQuery( QueryInfo query, QueryExecutionParams parameters, QueryInstanceResultInfo result, QueryItemInfo queryItem, GroupDefinition group, ProgressItem subProgress ) { var tempValues = new List<ParameterValue>(parameters.Values); foreach (var parameter in group.GroupParameters) { tempValues.Add(new ParameterValue { Name = "@" + parameter.Key, StringValue = parameter.Value } ); } QueryDatabaseResultInfo databaseResult = this.ExecuteQueryItemFunction.Invoke( this.Instance, queryItem, null, null, query.Parameters, tempValues, subProgress ); databaseResult.Database = group.Name; databaseResult.DatabaseId = group.Id; result.AddDatabaseResult(databaseResult); }
public void NotifyTaskProgressItemValueAndTotal(string sellerAccount, ProgressItem sellerAccountProgress) { SendOrPostCallback callback = delegate (object state) { lock (lockObject) { if (!progressSynchronous.IsTotalCountSet) { var totalInfo = client.GetProgressTotal(serviceType); setTotalCount(totalInfo); } setSellerAccountCount(sellerAccount, sellerAccountProgress); if (progressSynchronous.TotalType == TotalType.User) //按照账号 { if (progressSynchronous.IsSellerAccountFinished(sellerAccount)) { progressSynchronous.TotalValue++; } } else { progressSynchronous.TotalValue++; } ShowSumTaskBar(); } }; uiSyncContext.Post(callback, null); }
private void setSellerAccountCount(string sellerAccount, ProgressItem progress) { progressSynchronous.SetSellerAccountValueAndTotal(sellerAccount, progress.Value, progress.Total, () => { var uc = new ucSellerProgressBar(sellerAccount, 0, progress.Total); uc.Name = sellerAccount; uc.Value = progress.Value; this.flowLayoutPanel1.Controls.Add(uc); return uc; }); }
public void SetProgressItem(string user, int total, int value, bool accumulate = true) { var dict = DictUserProgressCount; if (dict.ContainsKey(user)) { dict[user].Total = total; } else { dict[user] = new ProgressItem(0, total); } }
private void ParsingResult(string s) { ProgressItem pi = new ProgressItem(); pi.msg = s; if (s.Contains("NUMYY=")) { inRunning = true; string s2 = s.Replace("NUMYY=", " ").Replace("&ZMAX=", " ").Replace("&U3XX=", " ").Replace("&VMAX=", " ").Replace("&PROG=", " "); string[] separators = { " ", "\t" }; string[] words = s2.Split(separators, StringSplitOptions.RemoveEmptyEntries); pi.t = ProgressItem.Type.ShowProgress; pi.prog = Convert.ToDouble(words[5]); pi.x = Convert.ToInt32(words[0]); pi.z = Convert.ToDouble(words[2]); pi.u = Convert.ToDouble(words[3]); pi.v = Convert.ToDouble(words[4]); bw.ReportProgress(0, new ProgressItem(pi)); } else if (!inRunning && s.Contains("1NUMXX=")) { string s2 = s.Replace("1NUMXX=", " ").Replace("|ZMAX=", " ").Replace("|U1XX=", " ").Replace("|VMAX=", " ").Replace("!PROG=", " "); string[] separators = { " ", "\t" }; string[] words = s2.Split(separators, StringSplitOptions.RemoveEmptyEntries); const double MaxValue = 1000.0; pi.t = ProgressItem.Type.ShowChart; pi.prog = Convert.ToDouble(words[5]); pi.x = Convert.ToInt32(words[0]); try { pi.z = Convert.ToDouble(words[2]); } catch { pi.z = MaxValue; } try { pi.u = Convert.ToDouble(words[3]); } catch { pi.u = MaxValue; } try { pi.v = Convert.ToDouble(words[4]); } catch { pi.v = MaxValue; } bw.ReportProgress(0, new ProgressItem(pi)); } else if(s.Contains("DIVERGENCE")) { pi.t = ProgressItem.Type.ShowDivergence; bw.ReportProgress(0, new ProgressItem(pi)); } else if(s.Contains("NOT CONVERGED")) { pi.t = ProgressItem.Type.ShowNotDivergence; bw.ReportProgress(0, new ProgressItem(pi)); } else { pi.t = ProgressItem.Type.ShowConsole; bw.ReportProgress(0, new ProgressItem(pi)); } }
public ProgressItem GetSellerAccountProgressInfo(EServiceType serviceType, string sellerAccount) { lock (lockObject) { if (dictProgressInfo.ContainsKey(serviceType.ServiceType)) { var info = dictProgressInfo[serviceType.ServiceType]; if (info.DictUserProgressCount.ContainsKey(sellerAccount)) { var progress = new ProgressItem(); progress.Total = info.DictUserProgressCount[sellerAccount].Total; progress.Value = info.DictUserProgressCount[sellerAccount].Value; return progress; } } } return null; }
private void HandleProgressChanged(ProgressItem item) { //System.Console.WriteLine ("Changed value = {0}", item.Value); progress_dialog.Fraction = (photo_index - 1.0 + item.Value) / (double)items.Length; }
void Upload() { progress_item = new ProgressItem (); progress_item.Changed += HandleProgressChanged; fr.Connection.OnUploadProgress += HandleFlickrProgress; var ids = new List<string> (); IPhoto [] photos = selection.Items; Array.Sort (photos, new DateComparer ()); for (int index = 0; index < photos.Length; index++) { try { IPhoto photo = photos [index]; progress_dialog.Message = string.Format ( Catalog.GetString ("Uploading picture \"{0}\""), photo.Name); progress_dialog.Fraction = photo_index / (double)selection.Count; photo_index++; progress_dialog.ProgressText = string.Format ( Catalog.GetString ("{0} of {1}"), photo_index, selection.Count); info = new FileInfo (photo.DefaultVersion.Uri.LocalPath); var stack = new FilterSet (); if (scale) stack.Add (new ResizeFilter ((uint)size)); string id = fr.Upload (photo, stack, is_public, is_family, is_friend); ids.Add (id); if (App.Instance.Database != null && photo is Photo) App.Instance.Database.Exports.Create ((photo as Photo).Id, (photo as Photo).DefaultVersionId, ExportStore.FlickrExportType, auth.User.UserId + ":" + auth.User.UserName + ":" + current_service.Name + ":" + id); } catch (Exception e) { progress_dialog.Message = string.Format (Catalog.GetString ("Error Uploading To {0}: {1}"), current_service.Name, e.Message); progress_dialog.ProgressText = Catalog.GetString ("Error"); Log.Exception (e); if (progress_dialog.PerformRetrySkip ()) { index--; photo_index--; } } } progress_dialog.Message = Catalog.GetString ("Done Sending Photos"); progress_dialog.Fraction = 1.0; progress_dialog.ProgressText = Catalog.GetString ("Upload Complete"); progress_dialog.ButtonLabel = Gtk.Stock.Ok; if (open && ids.Count != 0) { string view_url; if (current_service.Name == "Zooomr.com") view_url = string.Format ("http://www.{0}/photos/{1}/", current_service.Name, auth.User.UserName); else { view_url = string.Format ("http://www.{0}/tools/uploader_edit.gne?ids", current_service.Name); bool first = true; foreach (string id in ids) { view_url = view_url + (first ? "=" : ",") + id; first = false; } } GtkBeans.Global.ShowUri (Dialog.Screen, view_url); } }
/// <summary> /// The execute query. /// </summary> /// <param name="query">The query info.</param> /// <param name="parameterValues">The parameter values.</param> /// <param name="version">The version.</param> /// <param name="progress">The progress.</param> /// <returns> /// The <see cref="QueryInstanceResultInfo" />. /// </returns> public QueryInstanceResultInfo ExecuteQuery( QueryInfo query, QueryExecutionParams parameters, InstanceVersion version, ProgressItem progress ) { // Log.InfoFormat("107:query:'{0}'", // query // ); var groups = this .GetGroupsResolver() .GetGroups(query, parameters.Values, version); return this.ExecuteQuerySimple( query, parameters, version, progress, groups.ToArray() ); }
/// <summary> /// The execute query. /// </summary> /// <param name="query">The query.</param> /// <param name="parameterValues">The parameter values.</param> /// <param name="progress">The progress.</param> /// <param name="groups">The groups.</param> /// <param name="result">The result.</param> /// <param name="queryItem">The query item.</param> private void ExecuteQuery( QueryInfo query, QueryExecutionParams parameters, ProgressItem progress, GroupDefinition[] groups, QueryInstanceResultInfo result, QueryItemInfo queryItem ) { // Log.InfoFormat("query:'{0}'", // query // ); Debug.Assert(groups.Length <= 1); if (groups.Length == 0) { this.ExecuteQuery( query, parameters, result, queryItem, new GroupDefinition( this.Instance, string.Empty, string.Empty ), progress ); ProgressComplete(progress); } else { foreach (var group in groups) { if (group.ChildGroups.Count > 0) { var tempParams = parameters.Clone(); tempParams.AddValues( this.GetGroupsResolver().GetParametersFromDefinition(group) ); this.ExecuteQuery( query, tempParams, progress, group.ChildGroups.ToArray(), result, queryItem ); } ProgressItem subProgress = null; if (progress != null) { try { subProgress = progress.GetChild(); } catch (Exception) { } } this.ExecuteQuery( query, parameters, result, queryItem, @group, subProgress ); ProgressComplete(subProgress); } } }