Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Titanium-Web-Proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Titanium-Web-Proxy
Commits
7b5ee1ca
Commit
7b5ee1ca
authored
Apr 26, 2019
by
Honfika
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
faster delete the sessions from wpf sample app
parent
8ac79145
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
1 deletion
+40
-1
MainWindow.xaml.cs
examples/Titanium.Web.Proxy.Examples.Wpf/MainWindow.xaml.cs
+4
-1
ObservableCollectionEx.cs
...Titanium.Web.Proxy.Examples.Wpf/ObservableCollectionEx.cs
+36
-0
No files found.
examples/Titanium.Web.Proxy.Examples.Wpf/MainWindow.xaml.cs
View file @
7b5ee1ca
...
...
@@ -101,7 +101,7 @@ namespace Titanium.Web.Proxy.Examples.Wpf
InitializeComponent
();
}
public
ObservableCollection
<
SessionListItem
>
Sessions
{
get
;
}
=
new
ObservableCollection
<
SessionListItem
>();
public
ObservableCollection
Ex
<
SessionListItem
>
Sessions
{
get
;
}
=
new
ObservableCollectionEx
<
SessionListItem
>();
public
SessionListItem
SelectedSession
{
...
...
@@ -280,11 +280,14 @@ namespace Titanium.Web.Proxy.Examples.Wpf
if
(
e
.
Key
==
Key
.
Delete
)
{
var
selectedItems
=
((
ListView
)
sender
).
SelectedItems
;
Sessions
.
SuppressNotification
=
true
;
foreach
(
var
item
in
selectedItems
.
Cast
<
SessionListItem
>().
ToArray
())
{
Sessions
.
Remove
(
item
);
sessionDictionary
.
Remove
(
item
.
HttpClient
);
}
Sessions
.
SuppressNotification
=
false
;
}
}
...
...
examples/Titanium.Web.Proxy.Examples.Wpf/ObservableCollectionEx.cs
0 → 100644
View file @
7b5ee1ca
using
System.Collections.ObjectModel
;
using
System.Collections.Specialized
;
namespace
Titanium.Web.Proxy.Examples.Wpf
{
public
class
ObservableCollectionEx
<
T
>
:
ObservableCollection
<
T
>
{
private
bool
notificationSuppressed
;
private
bool
suppressNotification
;
public
bool
SuppressNotification
{
get
=>
suppressNotification
;
set
{
suppressNotification
=
value
;
if
(
suppressNotification
==
false
&&
notificationSuppressed
)
{
OnCollectionChanged
(
new
NotifyCollectionChangedEventArgs
(
NotifyCollectionChangedAction
.
Reset
));
notificationSuppressed
=
false
;
}
}
}
protected
override
void
OnCollectionChanged
(
NotifyCollectionChangedEventArgs
e
)
{
if
(
SuppressNotification
)
{
notificationSuppressed
=
true
;
return
;
}
base
.
OnCollectionChanged
(
e
);
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment