* Rename variable 'traffic' to 'trafficPerSecondQueue' and 'trafficInfoQueue'
* Remove class QueueLast<T> by using linq Queue.Last()
* Slight changes, such as rename, move several variables from function domain to class domain to improve performance.
Logic remains the same.
* Update the logic of copying queue from Controller to View.
* Move the TrafficInfo declaration into LogForm class
Overwise, the VS UI designer does not work.
- Use readonly object as lock
Info from stackoverflow:
If I want to be sure that it will be locked for all threads inside my
application:
The lock object has to be static, if it locks access to static state.
Otherwise it has to be instance, because there's no need to lock state of
one class instance, and prevent other threads to work with another class
instance at the same time.
everyone says that the object has to be "readonly" I didn't found the
reason
Well, it doesn't have to be. This is just a best practice, which helps you
to avoid errors.
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
Squashed commit of the following:
commit 48eb4d8839
Author: Syrone Wong <wong.syrone@gmail.com>
Date: Sun Sep 18 15:46:09 2016 +0800
Drop useless interface impl
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
commit c0a4f3421a
Author: Logan Zhou <xorcererzc@gmail.com>
Date: Sun Sep 18 00:58:02 2016 +0800
Revert "Updated to meet the hint from Wongsyrone."
This reverts commit 84c8053577.
commit 84c8053577
Author: Logan Zhou <xorcererzc@gmail.com>
Date: Sun Sep 18 00:52:21 2016 +0800
Updated to meet the hint from Wongsyrone.
commit 333ccb6d1f
Author: Logan Zhou <xorcererzc@gmail.com>
Date: Sun Sep 18 00:34:52 2016 +0800
Added duplicate button to config form.
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
Design:
Use the plain string for both config and hotkey parsing
and make use of KeyConverter, ModifierKeysConverter
to make it more rubust.
Find corresponding label (to display operation result) and callback (to do the real work) based on textbox name. In this case, they should be named as `<Feature-Name><Control-Name>`.
ShowLogsTextBox,
ShowLogsLabel,
ShowLogsCallback.
If this requirement doesn't meet, throw an exception at runtime.
Logic:
How to input keys:
1. put focus in the corresponding textbox
2. press the key combination you want to use
3. when you think it is ready, release all keys
4. the textbox shows your input
How to change keys:
1. put focus in the corresponding textbox
2. press BackSpace to clear content
3. re-input new one
How to deactivate:
1. clear content in the textbox
2. press OK button
Meaning of label color:
- Green: this combination is not occupied by other programs and register successfully
- Yellow: this combination is occupied by other programs and you have to change to another one
- Transparent without color: initial status
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
- Revert bandwidthScale when throughput gets smaller
- Don't save coordinates when LogForm is minimized. Otherwise, we get negative values
- activate ConfigForm & ProxyForm & LogForm
User wants to use that server after selected it in the ConfigForm. If user deletes
the server in use, we can't find its index, then the previous logic will revert to
index 0, which is not expected behaviour.
Since we handled 'ServersListBox.SelectedIndex' in various event handlers, we can
trust it all the time.
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
- Drop redundant code.
I should read code carefully, mbed TLS will set operation
when invoking mbedtls_cipher_setkey(), the last param
const mbedtls_operation_t operation is what we want.
- minor changes
Signed-off-by: Syrone Wong <wong.syrone@gmail.com>