public GeoObjectListProperty(ListWithEvents <IGeoObject> list, string resourceId, string contextMenuId, ICommandHandler contextHandler) { this.list = list; base.resourceId = resourceId; this.contextMenuId = contextMenuId; this.contextHandler = contextHandler; }
/// <summary> /// Gets the image to use for the right side of the tab. For Chrome, we pick a specific image for inactive tabs that aren't at the end of the list to allow for the separation between inactive tabs to be more clearly defined /// </summary> /// <param name="tab">Tab that we are retrieving the image for</param> /// <returns>Right-side image for <paramref name="tab"/></returns> protected override Image GetTabRightImage(TitleBarTab tab) { ListWithEvents <TitleBarTab> allTabs = tab.Parent.Tabs; if (tab.Active || allTabs.IndexOf(tab) == allTabs.Count - 1) { return(base.GetTabRightImage(tab)); } return(InactiveRightSideShadowImage); }
private void Connections_CollectionModified(object sender, ListModificationEventArgs e) { ListWithEvents <HistoricalConnection> history = sender as ListWithEvents <HistoricalConnection>; if (e.Modification == ListModification.ItemModified || e.Modification == ListModification.ItemAdded || e.Modification == ListModification.RangeAdded) { for (int i = e.StartIndex; i < e.StartIndex + e.Count; i++) { HistoricalConnection historyEntry = history[i]; if (_historyListView.Groups[historyEntry.LastConnection.ToString("yyyy-MM-dd")] == null) { int insertIndex = 0; string groupName = historyEntry.LastConnection.ToString("yyyy-MM-dd"); for (insertIndex = 0; insertIndex < _historyListView.Groups.Count; insertIndex++) { if (String.Compare(_historyListView.Groups[insertIndex].Name, groupName, StringComparison.Ordinal) < 0) { break; } } _historyListView.Groups.Insert(insertIndex, new ListViewGroup(groupName, historyEntry.LastConnection.ToLongDateString())); } // To account for legacy versions of the application where everything was an RDP connection, if a history entry was LegacyHistoricalConnection, // we use the RDP icon ListViewItem listViewItem = new ListViewItem( historyEntry.LastConnection.ToLongTimeString(), _connectionTypeIcons[historyEntry.Connection.GetType() == typeof(LegacyHistoricalConnection) ? typeof(RdpConnection) : historyEntry.Connection.GetType()]); listViewItem.SubItems.Add(historyEntry.Connection.DisplayName); listViewItem.SubItems.Add(historyEntry.Connection.Host); _connections[listViewItem] = historyEntry; _historyListView.Items.Add(listViewItem); _historyListView.Groups[historyEntry.LastConnection.ToString("yyyy-MM-dd")].Items.Add(listViewItem); _historyListView.Columns[0].Width = 119; _historyListView.Columns[1].Width = 143; _historyListView.Columns[2].Width = 419; } if (IsHandleCreated) { _historyListView.BeginInvoke(new Action(_historyListView.Sort)); } } }
private static ListWithEvents <Item> Create(bool successfulAdds = true, bool successfulRemoves = true, bool successfulClears = true, bool successfulReplaces = true, bool successfulRangeAdds = true, bool successfulRangeRemovals = true) { var list = new ListWithEvents <Item>(); list.Added += (items, i, item) => { item.Added++; }; list.BeforeAdding += (items, i, item) => { item.BeforeAdding++; return(successfulAdds); }; list.BeforeRangeAddition += (items, i, range) => { foreach (var item in range) { item.BeforeRangeAdding++; } return(successfulRangeAdds); }; list.BeforeRangeRemoval += (items, i, length) => { foreach (var item in items.Skip(i).Take(length)) { item.BeforeRangeRemoval++; } return(successfulRangeRemovals); }; list.RangeAdded += (items, i, length) => { foreach (var item in items.Skip(i).Take(length)) { item.RangeAdded++; } }; list.RangeRemoved += (items, range) => { foreach (var item in range) { item.RangeRemoved++; } }; list.BeforeRemoval += (items, i, item) => { item.BeforeRemoval++; return(successfulRemoves); }; list.BeforeReplacing += (items, i, replaced, replacee) => { replaced.BeforeReplacing++; replacee.BeforeReplacing++; return(successfulReplaces); }; list.BeforeClearing += items => { foreach (var item in items) { item.BeforeClearing++; } return(successfulClears); }; list.Removed += (items, i, item) => { item.Removed++; }; list.Replaced += (items, i, replaced, replacee) => { replaced.Replaced++; replacee.Replaced++; }; return(list); }
public GeoObjectListProperty(ListWithEvents <IGeoObject> list, string resourceId) { this.list = list; base.resourceId = resourceId; }
public void When_absent_item_is_checked_for_containment_Then_true_is_returned_when_item_is_in_the_list() { var list = new ListWithEvents <int>(new[] { 1, 2, 3, 4 }); Assert.That(list.Contains(0), Is.False); }
public void When_list_is_created_Then_it_is_empty() { var list = new ListWithEvents <int>(); Assert.That(list.Count, Is.Zero); }
public TisSystemUsersMngr() { m_oSystemUsers = new ListWithEvents <TisSystemUser>(); }
public TisWritablePermissions() { m_oPermissions = new ListWithEvents <string>(); m_oPermissions.ItemRemoved += new EventHandler <EventArgs>(OnItemRemoved); }
public PhaseShiftDeviceControllerAdapter() { PortNames = new ListWithEvents <string>(); UpdatePortNames(); }