public void Clear() { Entities.Clear(); Changes.Clear(); Statuses.Clear(); IsAction = false; }
public void Clear() { VehicleSettingsLuisResult = null; Entities.Clear(); Changes.Clear(); Statuses.Clear(); }
public async Task Clear() { var oldVals = _items.ToArray(); _items.Clear(); await Changed.Invoke(Changes.Clear <T>().Collect(oldVals, _items)); }
public void Dispose() { SyncTimerCallback(null); Counter.Clear(); Changes.Clear(); DbSyncTimer.Dispose(); }
/// <summary> /// Applies the filter. If another processing request was scheduled /// while processing the buffer, the method will recursively call /// itself. /// </summary> protected virtual async void Render() { try { if (_source != null) { Debug.WriteLine(DebugTag + Name + ": Rendering..."); // Apply the pending changes to the filter(s) foreach (var change in Changes) { change(); } Changes.Clear(); // Render the filters first to the temporary bitmap and // copy the changes then to the preview bitmap using (var renderer = new WriteableBitmapRenderer(_effect, _tmpBitmap)) { await renderer.RenderAsync(); } /* "using System.Runtime.InteropServices.WindowsRuntime" is * required for WriteableBitmap.PixelBuffer.CopyTo() and * WriteableBitmap.PixelBuffer.AsStream(). */ _tmpBitmap.PixelBuffer.CopyTo(_previewBitmap.PixelBuffer); _previewBitmap.Invalidate(); // Force a redraw } else { Debug.WriteLine(DebugTag + Name + ": Render(): No buffer set!"); } } catch (Exception e) { Debug.WriteLine(DebugTag + Name + ": Render(): " + e.Message); } finally { switch (State) { case States.Apply: // State machine transition : Apply -> Wait State = States.Wait; break; case States.Schedule: // State machine transition: Schedule -> Apply State = States.Apply; Render(); // Apply the filter break; default: // Do nothing break; } } }
private void ReplayHistoryInternal(IEnumerable <IAmAnEventMessage> history) { foreach (var @event in history.ToList()) { Tell(@event); } Changes.Clear(); Commands.Clear(); }
/// <summary> /// Clears all changes recorded since object creation or last Accept() /// </summary> /// <returns>true if there were changes</returns> protected virtual Boolean Accept() { if (Changes.Count > 0) { Changes.Clear(); return(true); } return(false); }
/// <summary> /// Gets the changes. /// </summary> /// <param name="andAccept">if set to <c>true</c> [and accept].</param> /// <returns></returns> public List <String> GetChanges(Boolean andAccept) { var l2 = Changes.ToList(); //.Clone(); if (andAccept) { Changes.Clear(); } return(l2); }
public override DirectoryRequest[] GetUpdate() { var result = base.GetUpdate(); ModifyRequest mr = (ModifyRequest)result[result.Length - 1]; SetAttribute(mr.Modifications, OPERATIONID, OperationId.ToString()); Changes.Clear(); return(result); }
public override DirectoryRequest[] GetUpdate() { var result = base.GetUpdate(); ModifyRequest mr = (ModifyRequest)result[result.Length - 1]; SetAttribute(mr.Modifications, LDAPQUERY, LdapQuery); Changes.Clear(); return(result); }
/// <summary> /// Removes all items from the <see cref="IList{T}"/>. /// </summary> public void Clear() { var hadItems = Current.Count > 0; Current.Clear(); Changes.Clear(); if (hadItems) { Changes.Add(new ClearListChange()); } }
public override DirectoryRequest[] GetUpdate() { var result = base.GetUpdate(); ModifyRequest mr = (ModifyRequest)result[result.Length - 1]; SetAttribute(mr.Modifications, BIZRULE, BizRule); SetAttribute(mr.Modifications, BIZRULELANGUAGE, BizRuleLanguage.ToString()); SetAttribute(mr.Modifications, BIZRULEPATH, BizRuleImportedPath); Changes.Clear(); return(result); }
public void Save() { string content = VerifOptions(); foreach (var pair in Changes) { var regex = new Regex(@"^.*\b" + pair.Key + @"\b.*$", RegexOptions.Multiline); content = regex.Replace(content, $"{pair.Key}={pair.Value}"); } Changes.Clear(); File.WriteAllText(path, content); }
protected override async void Render() { try { if (Source != null) { Debug.WriteLine(DebugTag + Name + ": Rendering..."); foreach (var change in Changes) { change(); } Changes.Clear(); _hdrEffect.Source = Source; using (var renderer = new WriteableBitmapRenderer(_hdrEffect, TmpBitmap)) { await renderer.RenderAsync(); } TmpBitmap.PixelBuffer.CopyTo(PreviewBitmap.PixelBuffer); PreviewBitmap.Invalidate(); // Force a redraw } else { Debug.WriteLine(DebugTag + Name + ": Render(): No buffer set!"); } } catch (Exception e) { Debug.WriteLine(DebugTag + Name + ": Render(): " + e.Message); } finally { switch (State) { case States.Apply: State = States.Wait; break; case States.Schedule: State = States.Apply; Render(); break; default: break; } } }
private void FileSystemWatcherOnError(object sender, ErrorEventArgs e) { _logger.Log($"File system watcher error: {e.GetException()}", LogLevel.Error); lock (_changes) { _needToScan = true; _pathScanner.Clear(); SetGitIsBusy(false); _changes.Clear(); } UpdateHasWork(); }
public virtual void Load() { IConfiguration config = Serialization.Load(this.GetType()); foreach (PropertyInfo pinfo in GetType().GetProperties()) { if (pinfo.GetCustomAttributes(typeof(ConfigurationPropertyAttribute), true).Length > 0) { pinfo.SetValue(this, pinfo.GetValue(config, null), null); } } Changes.Clear(); }
private void GetChangedSchools(List <School> oldSchools, List <School> newSchools) { Changes.Clear(); //ObservableCollection<School> changedSchools = new ObservableCollection<School>(); foreach (var newSchool in newSchools) { var oldTmp = oldSchools.FirstOrDefault(o => o.SchoolCode == newSchool.SchoolCode); if (oldTmp == null || oldTmp.Implode() != newSchool.Implode()) { Changes.Add(newSchool); } } //return changedSchools; }
/// <summary> /// Обновляет список изменений. /// </summary> public override void RefreshChanges() { Dictionary <String, ChangingValue <String> > changes = new Dictionary <String, ChangingValue <String> >(); changes.Add(RefMarketingFilesCard.MainInfo.Name, new ChangingValue <String>((GetControlValue(RefMarketingFilesCard.MainInfo.Name) ?? String.Empty).ToString())); changes.Add(RefMarketingFilesCard.Categories.Alias, new ChangingValue <String>(_Control_Categories.SelectedItems.Any() ? Context.GetObject <CategoriesCategory>(_Control_Categories.SelectedItems[0].ObjectId).Name : String.Empty)); if (!Changes.IsNull() && Changes.Keys.Contains(RefMarketingFilesCard.Categories.Alias) && Changes[RefMarketingFilesCard.Categories.Alias].IsChanged) { NeedAssign = true; } if (!Changes.IsNull()) { Changes.Clear(); } Changes = changes; }
private void SyncTimerCallback(object _) { lock (Locker) { if (Changes.Count == 0) { return; } var dataForUpdate = Counter.Where(o => Changes.Contains(o.Key)).ToDictionary(o => o.Key, o => o.Value); using (var repository = new GrillBotRepository(Config)) { repository.EmoteStats.UpdateEmoteStatistics(dataForUpdate); } Changes.Clear(); LoggingService.Write($"Emote statistics was synchronized with database. (Updated {dataForUpdate.Count} records)"); } }
private void PropagateChanges() { if (Targets.Count == 1 || Changes.Count == 0) { return; } var visitor = new PropertyPathVisitor(Changes); var target = Targets[0]; target.Visit(visitor); Changes.Clear(); var paths = visitor.GetPropertyPaths(); foreach (var path in paths) { // Get the value from the edited property. var resolution = path.Resolve(target); if (false == resolution.success) { continue; } var value = resolution.value; // And propagate to the other properties. for (var i = 1; i < Targets.Count; ++i) { var otherTarget = Targets[i]; var otherResolution = path.Resolve(otherTarget); if (false == otherResolution.success) { continue; } // TODO: not sure if this works in nested struct containers otherResolution.property.SetObjectValue(otherResolution.container, value); } } }
private void SyncTimerCallback(object _) { lock (Locker) { CleanInvalidWebTokens(); if (Changes.Count == 0) { return; } var itemsForUpdate = Counters.Where(o => Changes.Contains(o.Key)).Select(o => o.Value).ToList(); using (var repository = new GrillBotRepository(Config)) { repository.ChannelStats.UpdateChannelboard(itemsForUpdate); } Changes.Clear(); LoggingService.Write($"Channel statistics was synchronized with database. (Updated {itemsForUpdate.Count} records)"); } }
/// <summary> /// Reset the object to non-dirty /// </summary> public void Reset() { Changes.Clear(); NotifyPropertyChanged("IsDirty"); }
public void AcceptChanges() { Changes.Clear(); IsChanged = false; }
public virtual void Save() { Serialization.Save(this); Changes.Clear(); }
public void UpdateChanges() { var lChanges = new List <IChangedProperty>(); foreach (PropertyDescriptor lProperty in ((ICustomTypeDescriptor)this).GetProperties()) { var lChangedProperty = new ChangedProperty { PropertyName = lProperty.Name, PropertyType = lProperty.PropertyType, OldValue = Memento.StoredProperties.FirstOrDefault(x => x.Key.Name == lProperty.Name).Value, NewValue = GetPropertyValue(Target.GetType().GetProperty(lProperty.Name)) }; var lInterfaces = lChangedProperty.PropertyType.GetInterfaces(); //Type[] lGenericTypes = lChangedProperty.GetType().GetGenericArguments(); if (lInterfaces.Contains(typeof(IDictionary)) && lChangedProperty.NewValue != null) { var lNewDict = (IDictionary)lChangedProperty.NewValue; if (lChangedProperty.OldValue == null) { lChanges.AddRange( (from object lKey in lNewDict.Keys select new ChangedProperty { NewValue = lNewDict[lKey], Action = ChangeAction.Added })); continue; } var lOldDict = (IDictionary)lChangedProperty.OldValue; //Removed lChanges.AddRange((from object lKey in lOldDict.Keys where !lNewDict.Contains(lKey) select new ChangedProperty { OldValue = lOldDict[lKey], Action = ChangeAction.Removed })); //Added lChanges.AddRange((from object lKey in lNewDict.Keys where !lOldDict.Contains(lKey) select new ChangedProperty { NewValue = lNewDict[lKey], Action = ChangeAction.Added })); } else { if (lInterfaces.Contains(typeof(IEnumerable)) && lChangedProperty.NewValue != null) { IList lNewCollection = ((IEnumerable)lChangedProperty.NewValue).Cast <object>().ToList(); if (lChangedProperty.OldValue == null) { lChanges.AddRange((from object lItem in lNewCollection select new ChangedProperty { NewValue = lItem, Action = ChangeAction.Added, PropertyName = "Item", PropertyType = lItem.GetType() })); continue; } IList lOldCollection = ((IEnumerable)lChangedProperty.OldValue).Cast <object>().ToList(); //Removed foreach (var lItem in lOldCollection) { if (!lNewCollection.Contains(lItem)) { lChanges.Add(new ChangedProperty { OldValue = lItem, Action = ChangeAction.Removed }); } else { if (lOldCollection.IndexOf(lItem) != lNewCollection.IndexOf(lItem)) { } } } //Added lChanges.AddRange((from object lItem in lNewCollection where !lOldCollection.Contains(lItem) select new ChangedProperty { NewValue = lItem, Action = ChangeAction.Added })); } else { if (lChangedProperty.OldValue != lChangedProperty.NewValue) { lChanges.Add(lChangedProperty); } } } } Changes.Clear(); foreach (var changedProperty in lChanges) { var lProperty = (ChangedProperty)changedProperty; Changes.Add(lProperty); } }
public void Prepare() { Changes.Clear(); OnPrepare(); }
public void MarkChangesAsCommitted() { Changes.Clear(); }
/// <summary> Resets this object. </summary> public virtual void Reset() { Changes.Clear(); RaiseOnModified(""); }
/// <summary> /// Reset the object to non-dirty /// </summary> public void Reset() { Changes.Clear(); NotifyPropertyChanged("IsDirty");//LE MINH HIEP: Need to add this NotifyPropertyChanged: For the purpose of binding object: Always refresh binding when Reset (Atleast one visible object bind to this dirty property) }
// Clear change history public void ClearChanges() { Changes.Clear(); }