WingMan – Diff between revs 14 and 21

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 14 Rev 21
Line 34... Line 34...
34 MouseKeyGloalHook.KeyUp += MouseKeyGloalHookOnKeyUp; 34 MouseKeyGloalHook.KeyUp += MouseKeyGloalHookOnKeyUp;
35 MouseKeyGloalHook.KeyDown += MouseKeyGloalHookOnKeyDown; 35 MouseKeyGloalHook.KeyDown += MouseKeyGloalHookOnKeyDown;
36 } 36 }
Line 37... Line 37...
37   37  
38 private BatchBlock<string> KeyComboBatchBlock { get; set; } -  
39   38 private BatchBlock<string> KeyComboBatchBlock { get; set; }
40 private ActionBlock<string[]> KeyComboActionBlock { get; set; } -  
41   39 private ActionBlock<string[]> KeyComboActionBlock { get; set; }
42 private IDisposable KeyComboDataFlowLink { get; set; } -  
43   40 private IDisposable KeyComboDataFlowLink { get; set; }
44 private SemaphoreSlim DataFlowSemaphoreSlim { get; } -  
45   41 private SemaphoreSlim DataFlowSemaphoreSlim { get; }
46 private RemoteKeyBindings RemoteKeyBindings { get; } 42 private RemoteKeyBindings RemoteKeyBindings { get; }
47 private MqttCommunication MqttCommunication { get; } 43 private MqttCommunication MqttCommunication { get; }
48 private TaskScheduler TaskScheduler { get; } 44 private TaskScheduler TaskScheduler { get; }
49 private CancellationToken CancellationToken { get; } -  
50   45 private CancellationToken CancellationToken { get; }
Line 51... Line 46...
51 private IKeyboardMouseEvents MouseKeyGloalHook { get; set; } 46 private IKeyboardMouseEvents MouseKeyGloalHook { get; set; }
52   47  
53 public void Dispose() 48 public void Dispose()
Line 73... Line 68...
73 KeyComboDataFlowLink?.Dispose(); 68 KeyComboDataFlowLink?.Dispose();
74 KeyComboDataFlowLink = null; 69 KeyComboDataFlowLink = null;
Line 75... Line 70...
75   70  
76 // Create a sliding window of size equal to the longest key combination. 71 // Create a sliding window of size equal to the longest key combination.
-   72 var maxKeyComboLength = RemoteKeyBindings.Bindings.Max(binding => binding.Keys.Count);
-   73 if (maxKeyComboLength <= 0)
Line 77... Line 74...
77 var maxKeyComboLength = RemoteKeyBindings.Bindings.Max(binding => binding.Keys.Count); 74 return;
78   75  
79 KeyComboBatchBlock = 76 KeyComboBatchBlock =
80 new BatchBlock<string>(maxKeyComboLength); 77 new BatchBlock<string>(maxKeyComboLength);
Line 137... Line 134...
137 return; 134 return;
Line 138... Line 135...
138   135  
139 await DataFlowSemaphoreSlim.WaitAsync(CancellationToken); 136 await DataFlowSemaphoreSlim.WaitAsync(CancellationToken);
140 try 137 try
-   138 {
141 { 139 if (KeyComboBatchBlock != null)
142 if (KeyComboBatchBlock != null) await KeyComboBatchBlock.SendAsync(key, CancellationToken); 140 await KeyComboBatchBlock.SendAsync(key, CancellationToken);
143 } 141 }
144 finally 142 finally
145 { 143 {
146 DataFlowSemaphoreSlim.Release(); 144 DataFlowSemaphoreSlim.Release();