@@ -30,14 +30,12 @@ public MainWindowViewModel()
3030
3131 Version ver = Assembly . GetExecutingAssembly ( ) . GetName ( ) . Version ?? new Version ( 0 , 0 , 0 ) ;
3232 VersionString = ver . ToString ( 3 ) ;
33-
34- _rawTx = string . Empty ;
3533 }
3634
3735 public string VersionString { get ; }
3836
3937
40- private string _rawTx ;
38+ private string _rawTx = string . Empty ;
4139 public string RawTx
4240 {
4341 get => _rawTx ;
@@ -79,7 +77,7 @@ public enum Networks
7977 private Networks _selNet ;
8078 public Networks SelectedNetwork
8179 {
82- get { return _selNet ; }
80+ get => _selNet ;
8381 set
8482 {
8583 if ( SetField ( ref _selNet , value ) )
@@ -93,122 +91,122 @@ private void SetApiList()
9391 switch ( SelectedNetwork )
9492 {
9593 case Networks . Bitcoin :
96- ApiList = new ObservableCollection < Api > ( )
97- {
94+ ApiList =
95+ [
9896 new Blockchair ( Blockchair . Chain . BTC ) ,
9997 new Smartbit ( ) ,
10098 new BlockCypher ( ) ,
10199 new P2P ( true )
102- } ;
100+ ] ;
103101 break ;
104102 case Networks . BitcoinCash :
105- ApiList = new ObservableCollection < Api > ( )
106- {
103+ ApiList =
104+ [
107105 new Blockchair ( Blockchair . Chain . BCH ) ,
108- } ;
106+ ] ;
109107 break ;
110108 case Networks . Dogecoin :
111- ApiList = new ObservableCollection < Api > ( )
112- {
109+ ApiList =
110+ [
113111 new Blockchair ( Blockchair . Chain . DOGE ) ,
114- } ;
112+ ] ;
115113 break ;
116114 case Networks . Litecoin :
117- ApiList = new ObservableCollection < Api > ( )
118- {
115+ ApiList =
116+ [
119117 new Blockchair ( Blockchair . Chain . LTC ) ,
120- } ;
118+ ] ;
121119 break ;
122120 case Networks . Monero :
123- ApiList = new ObservableCollection < Api > ( )
124- {
121+ ApiList =
122+ [
125123 new Blockchair ( Blockchair . Chain . XMR ) ,
126- } ;
124+ ] ;
127125 break ;
128126 case Networks . BitcoinTestnet :
129- ApiList = new ObservableCollection < Api > ( )
130- {
127+ ApiList =
128+ [
131129 new Blockchair ( Blockchair . Chain . TBTC ) ,
132130 new P2P ( false )
133- } ;
131+ ] ;
134132 break ;
135133 case Networks . BitcoinSV :
136- ApiList = new ObservableCollection < Api > ( )
137- {
134+ ApiList =
135+ [
138136 new Blockchair ( Blockchair . Chain . BSV ) ,
139- } ;
137+ ] ;
140138 break ;
141139 case Networks . Zcash :
142- ApiList = new ObservableCollection < Api > ( )
143- {
140+ ApiList =
141+ [
144142 new Blockchair ( Blockchair . Chain . ZEC ) ,
145- } ;
143+ ] ;
146144 break ;
147145 case Networks . Ripple :
148- ApiList = new ObservableCollection < Api > ( )
149- {
146+ ApiList =
147+ [
150148 new Blockchair ( Blockchair . Chain . XRP ) ,
151- } ;
149+ ] ;
152150 break ;
153151 case Networks . Stellar :
154- ApiList = new ObservableCollection < Api > ( )
155- {
152+ ApiList =
153+ [
156154 new Blockchair ( Blockchair . Chain . XLM ) ,
157- } ;
155+ ] ;
158156 break ;
159157 case Networks . Cardano :
160- ApiList = new ObservableCollection < Api > ( )
161- {
158+ ApiList =
159+ [
162160 new Blockchair ( Blockchair . Chain . ADA ) ,
163- } ;
161+ ] ;
164162 break ;
165163 case Networks . Mixin :
166- ApiList = new ObservableCollection < Api > ( )
167- {
164+ ApiList =
165+ [
168166 new Blockchair ( Blockchair . Chain . XIN ) ,
169- } ;
167+ ] ;
170168 break ;
171169 case Networks . Tezos :
172- ApiList = new ObservableCollection < Api > ( )
173- {
170+ ApiList =
171+ [
174172 new Blockchair ( Blockchair . Chain . XTZ ) ,
175- } ;
173+ ] ;
176174 break ;
177175 case Networks . EOS :
178- ApiList = new ObservableCollection < Api > ( )
179- {
176+ ApiList =
177+ [
180178 new Blockchair ( Blockchair . Chain . EOS ) ,
181- } ;
179+ ] ;
182180 break ;
183181 case Networks . Ethereum :
184- ApiList = new ObservableCollection < Api > ( )
185- {
182+ ApiList =
183+ [
186184 new Blockchair ( Blockchair . Chain . ETH ) ,
187- } ;
185+ ] ;
188186 break ;
189187 case Networks . EthereumTestnet :
190- ApiList = new ObservableCollection < Api > ( )
191- {
188+ ApiList =
189+ [
192190 new Blockchair ( Blockchair . Chain . ΤETH ) ,
193- } ;
191+ ] ;
194192 break ;
195193 case Networks . Groestlcoin :
196- ApiList = new ObservableCollection < Api > ( )
197- {
194+ ApiList =
195+ [
198196 new Blockchair ( Blockchair . Chain . GRS ) ,
199- } ;
197+ ] ;
200198 break ;
201199 case Networks . Dash :
202- ApiList = new ObservableCollection < Api > ( )
203- {
200+ ApiList =
201+ [
204202 new Blockchair ( Blockchair . Chain . DASH ) ,
205- } ;
203+ ] ;
206204 break ;
207205 case Networks . BitcoinABC :
208- ApiList = new ObservableCollection < Api > ( )
209- {
206+ ApiList =
207+ [
210208 new Blockchair ( Blockchair . Chain . ABC ) ,
211- } ;
209+ ] ;
212210 break ;
213211 }
214212 }
@@ -282,8 +280,8 @@ private async void BroadcastTx()
282280 if ( IsCheckTxVisible && CheckTx )
283281 {
284282 Debug . Assert ( result != null ) ;
285- var stream = new FastStreamReader ( result ) ;
286- var tx = new Transaction ( ) ;
283+ FastStreamReader stream = new ( result ) ;
284+ Transaction tx = new ( ) ;
287285 if ( ! tx . TryDeserialize ( stream , out Errors error ) )
288286 {
289287 Status = $ "Invalid transaction. Error message: { error . Convert ( ) } ";
@@ -325,14 +323,7 @@ private async void BroadcastTx()
325323 }
326324 private bool CanBroadcast ( )
327325 {
328- if ( ! string . IsNullOrWhiteSpace ( RawTx ) && ! IsSending && SelectedApi != null )
329- {
330- return true ;
331- }
332- else
333- {
334- return false ;
335- }
326+ return ! string . IsNullOrWhiteSpace ( RawTx ) && ! IsSending && SelectedApi != null ;
336327 }
337328 }
338329}
0 commit comments