private void OnTextEntryMoved(object sender, ListModificationEventArgs e)
 {
     if (MouseOverRect == e.EventOldIndex)
     {
         MouseOverRect = e.EventNewIndex;
     }
 }
        private void OnTextEntryMoved(object sender, ListModificationEventArgs e)
        {
            var tmp2 = TextEntriesStackPanel.Children[e.EventOldIndex];

            TextEntriesStackPanel.Children.RemoveAt(e.EventOldIndex);
            TextEntriesStackPanel.Children.Insert(e.EventNewIndex, tmp2);
            ConfigureButtons();
        }
Esempio n. 3
0
 /// <summary>
 /// Handler method that's called when the contents of <see cref="_bookmarks"/> are modified.  Sets the <see cref="IConnection.ParentFolder"/> property
 /// of each added/modified bookmark to this folder.
 /// </summary>
 /// <param name="sender">Object from which this event originated; <see cref="_bookmarks"/> in this case.</param>
 /// <param name="e">Arguments associated with this event.</param>
 private void _bookmarks_CollectionModified(object sender, ListModificationEventArgs e)
 {
     if (e.Modification == ListModification.ItemAdded || e.Modification == ListModification.RangeAdded || e.Modification == ListModification.ItemModified)
     {
         for (int i = e.StartIndex; i < e.StartIndex + e.Count; i++)
         {
             _bookmarks[i].ParentFolder = this;
         }
     }
 }
Esempio n. 4
0
 /// <summary>
 ///     Handles the CollectionModified event of the items control.
 /// </summary>
 /// <param name = "sender">The source of the event.</param>
 /// <param name = "e">The <see cref = "System.EventArgs" /> instance containing the event data.</param>
 private void ItemsCollectionModified(object sender, ListModificationEventArgs e)
 {
     Controls.Clear();
     foreach (ActiveButton button in Items)
     {
         Controls.Add(button);
     }
     CalcSize();
     OnPosition();
 }
Esempio n. 5
0
        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 void OnTextEntryRemoved(object sender, ListModificationEventArgs e)
 {
     TextEntriesStackPanel.Children.RemoveAt(e.EventOldIndex);
     ConfigureButtons();
 }
 private void OnTextEntryAdded(object sender, ListModificationEventArgs e)
 {
     TextEntriesStackPanel.Children.Insert(e.EventNewIndex, new TextEntryListView((Text)e.EventObject, _pageManager));
     ConfigureButtons();
 }
 /// <summary>
 /// 	Handles the CollectionModified event of the items control.
 /// </summary>
 /// <param name = "sender">The source of the event.</param>
 /// <param name = "e">The <see cref = "System.EventArgs" /> instance containing the event data.</param>
 private void ItemsCollectionModified(object sender, ListModificationEventArgs e)
 {
     Controls.Clear();
     foreach (ActiveButton button in Items)
     {
         Controls.Add(button);
     }
     CalcSize();
     OnPosition();
 }