@@ -190,42 +190,55 @@ protected override Task Load(bool forceCacheInvalidation)
190190
191191 public ICommand ToggleWatchCommand
192192 {
193- get { return new MvxCommand ( ToggleWatch , ( ) => IsWatched != null ) ; }
193+ get { return new MvxCommand ( ( ) => ToggleWatch ( ) , ( ) => IsWatched != null ) ; }
194194 }
195195
196- private async void ToggleWatch ( )
196+ private async Task ToggleWatch ( )
197197 {
198198 if ( IsWatched == null )
199199 return ;
200200
201- if ( IsWatched . Value )
202- await this . GetApplication ( ) . Client . ExecuteAsync ( this . GetApplication ( ) . Client . Users [ Username ] . Repositories [ RepositoryName ] . StopWatching ( ) ) ;
203- else
204- await this . GetApplication ( ) . Client . ExecuteAsync ( this . GetApplication ( ) . Client . Users [ Username ] . Repositories [ RepositoryName ] . Watch ( ) ) ;
205-
206- IsWatched = ! IsWatched ;
201+ try
202+ {
203+ if ( IsWatched . Value )
204+ await this . GetApplication ( ) . Client . ExecuteAsync ( this . GetApplication ( ) . Client . Users [ Username ] . Repositories [ RepositoryName ] . StopWatching ( ) ) ;
205+ else
206+ await this . GetApplication ( ) . Client . ExecuteAsync ( this . GetApplication ( ) . Client . Users [ Username ] . Repositories [ RepositoryName ] . Watch ( ) ) ;
207+ IsWatched = ! IsWatched ;
208+ }
209+ catch ( Exception e )
210+ {
211+ ReportError ( e ) ;
212+ }
207213 }
208214
209215 public ICommand ToggleStarCommand
210216 {
211- get { return new MvxCommand ( ToggleStar , ( ) => IsStarred != null ) ; }
217+ get { return new MvxCommand ( ( ) => ToggleStar ( ) , ( ) => IsStarred != null ) ; }
212218 }
213219
214220 public bool IsPinned
215221 {
216222 get { return this . GetApplication ( ) . Account . PinnnedRepositories . GetPinnedRepository ( Username , RepositoryName ) != null ; }
217223 }
218224
219- private async void ToggleStar ( )
225+ private async Task ToggleStar ( )
220226 {
221227 if ( IsStarred == null )
222228 return ;
223229
224- if ( IsStarred . Value )
225- await this . GetApplication ( ) . Client . ExecuteAsync ( this . GetApplication ( ) . Client . Users [ Username ] . Repositories [ RepositoryName ] . Unstar ( ) ) ;
226- else
227- await this . GetApplication ( ) . Client . ExecuteAsync ( this . GetApplication ( ) . Client . Users [ Username ] . Repositories [ RepositoryName ] . Star ( ) ) ;
228- IsStarred = ! IsStarred ;
230+ try
231+ {
232+ if ( IsStarred . Value )
233+ await this . GetApplication ( ) . Client . ExecuteAsync ( this . GetApplication ( ) . Client . Users [ Username ] . Repositories [ RepositoryName ] . Unstar ( ) ) ;
234+ else
235+ await this . GetApplication ( ) . Client . ExecuteAsync ( this . GetApplication ( ) . Client . Users [ Username ] . Repositories [ RepositoryName ] . Star ( ) ) ;
236+ IsStarred = ! IsStarred ;
237+ }
238+ catch ( Exception e )
239+ {
240+ ReportError ( e ) ;
241+ }
229242 }
230243
231244 public class NavObject
0 commit comments