|
16 | 16 | */ |
17 | 17 | #endregion License |
18 | 18 |
|
19 | | -using Lightstreamer.DotNetStandard.Client; |
| 19 | +using com.lightstreamer.client; |
20 | 20 | using System.Diagnostics; |
21 | 21 | using Xamarin.Forms; |
22 | 22 |
|
23 | 23 | namespace XDemo5 |
24 | 24 | { |
25 | | - internal class DetailsListener : IHandyTableListener |
| 25 | + internal class DetailsListener : SubscriptionListener |
26 | 26 | { |
27 | 27 | private RTfeed rTfeed; |
28 | 28 |
|
29 | 29 | public DetailsListener(RTfeed rTfeed) |
30 | 30 | { |
31 | 31 | this.rTfeed = rTfeed; |
32 | 32 | } |
33 | | - private string NotifyUpdate(IUpdateInfo update) |
| 33 | + |
| 34 | + private string NotifyUpdate(ItemUpdate update) |
34 | 35 | { |
35 | 36 | return update.Snapshot ? "snapshot" : "update"; |
36 | 37 | } |
37 | 38 |
|
38 | | - public void OnUpdate(int itemPos, string itemName, IUpdateInfo update) |
| 39 | + // --- |
| 40 | + |
| 41 | + void SubscriptionListener.onClearSnapshot(string itemName, int itemPos) |
| 42 | + { |
| 43 | + Debug.WriteLine("Clear snapshot evernt received for " + itemName); |
| 44 | + } |
| 45 | + |
| 46 | + void SubscriptionListener.onCommandSecondLevelItemLostUpdates(int lostUpdates, string key) |
| 47 | + { |
| 48 | + throw new System.NotImplementedException(); |
| 49 | + } |
| 50 | + |
| 51 | + void SubscriptionListener.onCommandSecondLevelSubscriptionError(int code, string message, string key) |
| 52 | + { |
| 53 | + throw new System.NotImplementedException(); |
| 54 | + } |
| 55 | + |
| 56 | + void SubscriptionListener.onEndOfSnapshot(string itemName, int itemPos) |
39 | 57 | { |
| 58 | + Debug.WriteLine("End of snapshot received for " + itemName); |
| 59 | + } |
40 | 60 |
|
| 61 | + void SubscriptionListener.onItemLostUpdates(string itemName, int itemPos, int lostUpdates) |
| 62 | + { |
| 63 | + Debug.WriteLine("Lost " + lostUpdates + " updates for " + itemName); |
| 64 | + } |
| 65 | + |
| 66 | + void SubscriptionListener.onItemUpdate(ItemUpdate update) |
| 67 | + { |
41 | 68 | Debug.WriteLine("Details received."); |
42 | 69 |
|
43 | 70 | Debug.WriteLine(NotifyUpdate(update) + |
44 | | - " for " + itemPos + ":" + update.GetNewValue(1) + " - " + update.GetNewValue(3) |
| 71 | + " for " + update.ItemName + ":" + update.getValue(1) + " - " + update.getValue(3) |
45 | 72 | ); |
46 | | - |
47 | 73 |
|
48 | | - if (update.IsValueChanged(1)) |
| 74 | + |
| 75 | + if (update.isValueChanged(1)) |
49 | 76 | { |
50 | | - rTfeed.DetailsName = update.GetNewValue(1); |
| 77 | + rTfeed.DetailsName = update.getValue(1); |
51 | 78 | } |
52 | 79 |
|
53 | | - if (update.IsValueChanged(2)) |
| 80 | + if (update.isValueChanged(2)) |
54 | 81 | { |
55 | | - rTfeed.DetailsLast = update.GetNewValue(2); |
| 82 | + rTfeed.DetailsLast = update.getValue(2); |
56 | 83 | } |
57 | 84 |
|
58 | | - if (update.IsValueChanged(3)) |
| 85 | + if (update.isValueChanged(3)) |
59 | 86 | { |
60 | | - rTfeed.DetailsTime = update.GetNewValue(3); |
| 87 | + rTfeed.DetailsTime = update.getValue(3); |
61 | 88 | } |
62 | 89 |
|
63 | | - if (update.IsValueChanged(4)) |
| 90 | + if (update.isValueChanged(4)) |
64 | 91 | { |
65 | | - rTfeed.DetailsMin = update.GetNewValue(4); |
| 92 | + rTfeed.DetailsMin = update.getValue(4); |
66 | 93 | } |
67 | 94 |
|
68 | | - if (update.IsValueChanged(5)) |
| 95 | + if (update.isValueChanged(5)) |
69 | 96 | { |
70 | | - rTfeed.DetailsMax = update.GetNewValue(5); |
| 97 | + rTfeed.DetailsMax = update.getValue(5); |
71 | 98 | } |
72 | 99 |
|
73 | | - if (update.IsValueChanged(6)) |
| 100 | + if (update.isValueChanged(6)) |
74 | 101 | { |
75 | | - rTfeed.DetailsChg = update.GetNewValue(6); |
76 | | - if (float.Parse(update.GetNewValue(6)) > 0) |
| 102 | + rTfeed.DetailsChg = update.getValue(6); |
| 103 | + if (float.Parse(update.getValue(6)) > 0) |
77 | 104 | { |
78 | 105 | rTfeed.DetailsChgDiff = Color.Green; |
79 | | - } else |
| 106 | + } |
| 107 | + else |
80 | 108 | { |
81 | 109 | rTfeed.DetailsChgDiff = Color.Red; |
82 | 110 | } |
83 | 111 | } |
84 | 112 |
|
85 | | - if (update.IsValueChanged(7)) |
| 113 | + if (update.isValueChanged(7)) |
86 | 114 | { |
87 | | - rTfeed.DetailsBid = update.GetNewValue(7); |
| 115 | + rTfeed.DetailsBid = update.getValue(7); |
88 | 116 | } |
89 | 117 |
|
90 | | - if (update.IsValueChanged(8)) |
| 118 | + if (update.isValueChanged(8)) |
91 | 119 | { |
92 | | - rTfeed.DetailsAsk = update.GetNewValue(8); |
| 120 | + rTfeed.DetailsAsk = update.getValue(8); |
93 | 121 | } |
| 122 | + } |
94 | 123 |
|
| 124 | + void SubscriptionListener.onListenEnd(Subscription subscription) |
| 125 | + { |
| 126 | + // ... |
| 127 | + } |
| 128 | + |
| 129 | + void SubscriptionListener.onListenStart(Subscription subscription) |
| 130 | + { |
| 131 | + // ... |
95 | 132 | } |
96 | 133 |
|
97 | | - public void OnSnapshotEnd(int itemPos, string itemName) |
| 134 | + void SubscriptionListener.onSubscription() |
98 | 135 | { |
99 | | - Debug.WriteLine("end of snapshot for " + itemPos); |
| 136 | + Debug.WriteLine("Subscription"); |
100 | 137 | } |
101 | 138 |
|
102 | | - public void OnRawUpdatesLost(int itemPos, string itemName, int lostUpdates) |
| 139 | + void SubscriptionListener.onSubscriptionError(int code, string message) |
103 | 140 | { |
104 | | - Debug.WriteLine(lostUpdates + " updates lost for " + itemPos); |
| 141 | + Debug.WriteLine("Subscription Error: " + message + " (" + code +")."); |
105 | 142 | } |
106 | 143 |
|
107 | | - public void OnUnsubscr(int itemPos, string itemName) |
| 144 | + void SubscriptionListener.onUnsubscription() |
108 | 145 | { |
109 | | - Debug.WriteLine("unsubscr " + itemPos); |
| 146 | + Debug.WriteLine("Unsubscription"); |
110 | 147 | } |
111 | 148 |
|
112 | | - public void OnUnsubscrAll() |
| 149 | + void SubscriptionListener.onRealMaxFrequency(string frequency) |
113 | 150 | { |
114 | | - Debug.WriteLine("unsubscr table"); |
| 151 | + Debug.WriteLine("Real Max Frequency: " + frequency); |
115 | 152 | } |
116 | 153 | } |
117 | 154 | } |
0 commit comments