public void RemovedHandler_HandleMessage_DeserializeAndCallsCollectionManager() { var connectionMock = new Mock<IDdpConnectionSender>(); var collectionMock = new Mock<ICollectionManager>(); var resultHandlerMock = new Mock<IResultHandler>(); var testObject = new SimpleDdpObject { IsTrue = false }; var added = new Removed() {Collection = "Test", Id = "ID"}; var handler = new RemovedHandler(); handler.HandleMessage(connectionMock.Object, collectionMock.Object, resultHandlerMock.Object, JsonConvert.SerializeObject(added)); collectionMock.Verify(collection => collection.Removed(It.IsAny<Removed>()), Times.Once()); }
public void Remove <TEntity>(TEntity entity) { Removed?.Invoke(entity); }
protected void RemoveHazard() { Removed?.Invoke(this); Hazard = null; }
public void Remove(IDataRecord item) { Repository.Signal <IDataRecordRemoving>(_ => _.RecordRemoving(item)); Removed.Add(item.Identifier); Repository.Signal <IDataRecordRemoved>(_ => _.RecordRemoved(item)); }
void IOdeToFoodDb.Remove <T>(T entity) { Removed.Add(entity); }
public void Remove() { Removed.InvokeSafe(this); WrappedValue = null; }
public void RemoveAt(int index) { NumberList.RemoveAt(index); Removed?.Invoke(this, $"Removed number at index #{index} from series"); }
/// <summary> /// Raises the Removed event. /// </summary> /// <param name="e">A NavButtonSpecEventArgs instance containing event data.</param> protected void OnRemoved(ButtonSpecEventArgs e) { Removed?.Invoke(this, e); }
/// <summary> /// Raises the <see cref="Removed"/> event. /// </summary> /// <param name="e">An <see cref="EventArgs"/> that contains the event data.</param> protected virtual void OnRemoved(EventArgs e) => Removed?.Invoke(this, e);
/// <summary> /// Sends a removed message for the given <paramref name="key"/> in <paramref name="region"/>. /// </summary> /// <param name="key">The key.</param> /// <param name="region">The region.</param> protected internal void TriggerRemoved(string key, string region) { Removed?.Invoke(this, new CacheItemEventArgs(key, region)); }
/// <summary> /// Remove a quest prop /// </summary> /// <param name="index"></param> public void Remove(int index) { Props.RemoveAt(index); Removed?.Invoke(this, new RemovedArgs(index, typeof(QuestProp))); }
public void Remove(object content) { Removed.Add(content.ToString()); }
/// <summary> /// Removes the component from it's owning GameObject. /// </summary> public void Remove() { OnRemove(); Removed?.Invoke(this); }
void RaiseRemoved() { Removed?.Invoke(this, EventArgs.Empty); }
private void RaiseRemoved(DeviceInformation deviceInformation) { Removed?.Invoke(this, deviceInformation); }
private void DoRemoved(params TSectorEntity[] entities) { var args = new ManagerItemsChangedEventArgs <TSectorEntity>(entities); Removed?.Invoke(this, args); }
internal void RaiseRemoved(Entity entity, T previous) => Removed?.Invoke(entity, previous);
public void Remove(Number number) { NumberList.Remove(number); Removed?.Invoke(this, $"Removed {number} from series"); }
/// <summary> /// Run the diff operation. Until this is called, all lists will be empty /// </summary> /// <returns>true if anything is different between index, tree, and workdir</returns> private void UpdateDirectory(IEnumerable <string> paths, bool recursive) { RevWalk rw = new RevWalk(Repository); ObjectId id = Repository.Resolve(Constants.HEAD); var commit = id != null?rw.ParseCommit(id) : null; TreeWalk treeWalk = new TreeWalk(Repository); treeWalk.Reset(); treeWalk.Recursive = false; if (commit != null) { treeWalk.AddTree(commit.Tree); } else { treeWalk.AddTree(new EmptyTreeIterator()); } DirCache dc = Repository.ReadDirCache(); treeWalk.AddTree(new DirCacheIterator(dc)); FileTreeIterator workTree = new FileTreeIterator(Repository.WorkTree, Repository.FileSystem, WorkingTreeOptions.KEY.Parse(Repository.GetConfig())); treeWalk.AddTree(workTree); List <TreeFilter> filters = new List <TreeFilter> (); filters.Add(new SkipWorkTreeFilter(1)); var pathFilters = paths.Where(p => p != ".").Select(p => PathFilter.Create(p)).ToArray(); if (pathFilters.Length > 1) { filters.Add(OrTreeFilter.Create(pathFilters)); // Use an OR to join all path filters } else if (pathFilters.Length == 1) { filters.Add(pathFilters[0]); } if (filters.Count > 1) { treeWalk.Filter = AndTreeFilter.Create(filters); } else { treeWalk.Filter = filters[0]; } while (treeWalk.Next()) { AbstractTreeIterator treeIterator = treeWalk.GetTree <AbstractTreeIterator>(0); DirCacheIterator dirCacheIterator = treeWalk.GetTree <DirCacheIterator>(1); WorkingTreeIterator workingTreeIterator = treeWalk.GetTree <WorkingTreeIterator>(2); NGit.FileMode fileModeTree = treeWalk.GetFileMode(0); if (treeWalk.IsSubtree) { treeWalk.EnterSubtree(); continue; } int stage = dirCacheIterator != null?dirCacheIterator.GetDirCacheEntry().Stage : 0; if (stage > 1) { continue; } else if (stage == 1) { MergeConflict.Add(dirCacheIterator.EntryPathString); changesExist = true; continue; } if (treeIterator != null) { if (dirCacheIterator != null) { if (!treeIterator.EntryObjectId.Equals(dirCacheIterator.EntryObjectId)) { // in repo, in index, content diff => changed Modified.Add(dirCacheIterator.EntryPathString); changesExist = true; } } else { // in repo, not in index => removed if (!fileModeTree.Equals(NGit.FileMode.TYPE_TREE)) { Removed.Add(treeIterator.EntryPathString); changesExist = true; } } } else { if (dirCacheIterator != null) { // not in repo, in index => added Added.Add(dirCacheIterator.EntryPathString); changesExist = true; } else { // not in repo, not in index => untracked if (workingTreeIterator != null && !workingTreeIterator.IsEntryIgnored()) { Untracked.Add(workingTreeIterator.EntryPathString); changesExist = true; } } } if (dirCacheIterator != null) { if (workingTreeIterator == null) { // in index, not in workdir => missing Missing.Add(dirCacheIterator.EntryPathString); changesExist = true; } else { // Workaround to file time resolution issues long itime = dirCacheIterator.GetDirCacheEntry().LastModified; long ftime = workingTreeIterator.GetEntryLastModified(); if (itime / 1000 != ftime / 1000) { if (!dirCacheIterator.IdEqual(workingTreeIterator)) { // in index, in workdir, content differs => modified Modified.Add(dirCacheIterator.EntryPathString); changesExist = true; } } } } } }
public void Remove <T>(T entity) where T : class { Removed.Add(entity); }
public void Start() { if (!_started) { _threadWatch = new Thread(() => { _ownerManager.OnLogMessageAvailable($"PortSerial device watcher started @ Thread {_threadWatch.ManagedThreadId} [ProcessID: {Process.GetCurrentProcess().Id}]"); _ports = new List <string>(); _started = true; Status = DeviceWatcherStatus.Started; while (_started) { try { var ports = GetPortNames(); // process ports that have arrived foreach (var port in ports) { if (!_ports.Contains(port)) { _ports.Add(port); Added?.Invoke(this, port); } } // check for ports that departed List <string> portsToRemove = new(); foreach (var port in _ports) { if (!ports.Contains(port)) { portsToRemove.Add(port); } } // process ports that have departed foreach (var port in portsToRemove) { if (_ports.Contains(port)) { _ports.Remove(port); Removed?.Invoke(this, port); } } Thread.Sleep(200); } #if DEBUG catch (Exception ex) #else catch #endif { // catch all so the watcher can always do it's job // on any exception the thread will get back to the loop or exit on the while loop condition } } _ownerManager.OnLogMessageAvailable($"PortSerial device watcher stopped @ Thread {_threadWatch.ManagedThreadId}"); Status = DeviceWatcherStatus.Stopped; }) { IsBackground = true, Priority = ThreadPriority.Lowest }; _threadWatch.Start(); } }
public void HandleRemoveCallback() { Removed?.Invoke(); }
public bool IsRemoved(IDataRecord item) { return(Removed.Contains(item.Identifier)); }
public IEnumerable <IDataRecord> GetAll() { LoadRecordsIntoCache(); return(Cached.Values.Where(p => !Removed.Contains(p.Identifier))); }
public void Remove(string key) { _cache.Remove(key); Removed?.Invoke(this, key); }
protected internal virtual void OnRemoved(ConnectionChannelRemovedEventArgs e) { Removed.RaiseEvent(this, e); }
internal void OnDisplayChange() { var addedDisplays = new List <Win32Display>(); var removedDisplays = new List <Win32Display>(); IDisplay oldPrimaryDisplay; IDisplay newPrimaryDisplay; lock (m_displays) { oldPrimaryDisplay = PrimaryDisplay; var newMonitors = GetMonitors(); var handles = m_displays.Select(x => x.Handle); var added = newMonitors.Except(handles).ToList(); var removed = handles.Except(newMonitors).ToList(); foreach (var hMonitor in removed) { var disp = m_displays.First(x => x.Handle == hMonitor); removedDisplays.Add(disp); } m_displays.RemoveWhere(x => removed.Contains(x.Handle)); foreach (var hMonitor in added) { var disp = new Win32Display(this, hMonitor); m_displays.Add(disp); addedDisplays.Add(disp); } newPrimaryDisplay = m_displays.First(x => x.Bounds.TopLeft == new Point(0, 0)); if (!oldPrimaryDisplay.Equals(newPrimaryDisplay)) { PrimaryDisplay = newPrimaryDisplay; } } try { // Added events try { foreach (var added in addedDisplays) { Added?.Invoke(added, new DisplayChangedEventArgs(added)); } } finally { // Removed events foreach (var removed in removedDisplays) { try { removed.OnRemoved(); } finally { Removed?.Invoke(removed, new DisplayChangedEventArgs(removed)); } } } } finally { if (!oldPrimaryDisplay.Equals(newPrimaryDisplay)) { PrimaryDisplayChanged?.Invoke(this, new PrimaryDisplayChangedEventArgs(newPrimaryDisplay, oldPrimaryDisplay)); } } }
public void EntryRemoved(EntryEvent<TKey, TValue> @event) { Removed?.Invoke(@event); }
private void CheckRoster() { SortedDictionary <string, TreeNode> Contacts = this.children; Dictionary <string, TreeNode> Existing = new Dictionary <string, TreeNode>(); LinkedList <TreeNode> Added = null; LinkedList <KeyValuePair <string, TreeNode> > Removed = null; LinkedList <RosterItem> Resubscribe = null; LinkedList <RosterItem> Reunsubscribe = null; if (Contacts == null) { Contacts = new SortedDictionary <string, TreeNode>(); } lock (Contacts) { foreach (RosterItem Item in this.client.Roster) { if (Contacts.TryGetValue(Item.BareJid, out TreeNode Contact)) { Existing[Item.BareJid] = Contact; } else { if (Item.IsInGroup(ConcentratorGroupName)) { Contact = new XmppConcentrator(this, this.client, Item.BareJid, Item.IsInGroup(EventsGroupName)); } else if (Item.IsInGroup(ActuatorGroupName)) { Contact = new XmppActuator(this, this.client, Item.BareJid, Item.IsInGroup(SensorGroupName), Item.IsInGroup(EventsGroupName)); } else if (Item.IsInGroup(SensorGroupName)) { Contact = new XmppSensor(this, this.client, Item.BareJid, Item.IsInGroup(EventsGroupName)); } else if (Item.IsInGroup(OtherGroupName)) { Contact = new XmppOther(this, this.client, Item.BareJid); } else { Contact = new XmppContact(this, this.client, Item.BareJid); } Contacts[Item.BareJid] = Contact; if (Added == null) { Added = new LinkedList <TreeNode>(); } Added.AddLast(Contact); } switch (Item.PendingSubscription) { case PendingSubscription.Subscribe: if (Resubscribe == null) { Resubscribe = new LinkedList <RosterItem>(); } Resubscribe.AddLast(Item); break; case PendingSubscription.Unsubscribe: if (Reunsubscribe == null) { Reunsubscribe = new LinkedList <RosterItem>(); } Reunsubscribe.AddLast(Item); break; } } if (this.children == null) { this.children = Contacts; } else { foreach (KeyValuePair <string, TreeNode> P in this.children) { if (P.Value is XmppContact Contact && !Existing.ContainsKey(Contact.BareJID)) { if (Removed == null) { Removed = new LinkedList <KeyValuePair <string, TreeNode> >(); } Removed.AddLast(P); } } if (Removed != null) { foreach (KeyValuePair <string, TreeNode> P in Removed) { this.children.Remove(P.Key); } } } } if (Added != null) { foreach (TreeNode Node in Added) { this.connections.Owner.MainView.NodeAdded(this, Node); } } if (Removed != null) { foreach (KeyValuePair <string, TreeNode> P in Removed) { this.connections.Owner.MainView.NodeRemoved(this, P.Value); } } if (Resubscribe != null) { foreach (RosterItem Item in Resubscribe) { this.client.RequestPresenceSubscription(Item.BareJid); } } if (Reunsubscribe != null) { foreach (RosterItem Item in Reunsubscribe) { this.client.RequestPresenceUnsubscription(Item.BareJid); } } this.OnUpdated(); }
public void OnRemoveServer(Server model) { ServerRepository.Delete(model.Id); Removed.InvokeAsync(model); }
/// <summary> /// /// </summary> protected virtual void OnRemoved() => Removed?.Invoke(this, EventArgs.Empty);