public void Pushback(Model.Model model) { while (!ModelClone.TryAdd(model)) { System.Threading.Thread.Sleep(1); } }
public FillingPresenter(DatabaseContext context, IFillingForm fillingForm) { Context = context; FillingForm = fillingForm; FillingForm.CheckProperty += FillingForm_CheckProperty; FillingForm.CheckModel += FillingForm_CheckModel; FillingForm.SuccessfullyFilled += (model) => { ModelClone.DeepCloneTo(Model); FillingCompleted.Invoke(FillType); }; FillingForm.FormClosure += () => PresenterClosure.Invoke(); }
protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { // TODO: dispose managed state (managed objects) PopupVisible = false; ModelClone?.Dispose(); } // TODO: free unmanaged resources (unmanaged objects) and override finalizer // TODO: set large fields to null disposedValue = true; } }
private void Process() { while (!Initializer.Terminate) { Request.WaitOne(); while (ModelClone.Count > 0) { Model.Model model; while (!ModelClone.TryTake(out model)) { System.Threading.Thread.Sleep(1); } Save(model); Console.WriteLine("Epoch({0})Model SaveProcessCompleted", model.Epoch); } Request.Reset(); } }