public static void OnKickUser(dynamic message, SyncService s, SyncRoom room) { if (s.Permissions == UserPermissionLevel.OWNER) { SyncService target = room.GetServiceByNickname((string)message.TargetNickname); var res = new { CommandType = CommandType.KICKUSER.Value }; target.SendMessage(JsonConvert.SerializeObject(res)); target.Disconnect(); } }
public SettingsViewModel(ISettingsService settings, SyncService sync, IIAPService iapService) { if (settings == null) { throw new ArgumentNullException("settings"); } _settings = settings; if (sync == null) { throw new ArgumentNullException("sync"); } _syncService = sync; if (iapService == null) { throw new ArgumentNullException("iapService"); } _iapService = iapService; #pragma warning disable 1998 ConnectCommand = new AsyncRelayCommand(async(o) => { if (!_syncService.IsConnected) { await _syncService.Authenticate(); } else { _syncService.Disconnect(); } }, null, async() => { if (SyncEnabled && _syncService.IsConnected) { SyncCommand.Execute(null); } RaisePropertyChanged(() => SyncEnabled); RaisePropertyChanged(() => IsConnected); RaisePropertyChanged(() => ConnectLabel); RaisePropertyChanged(() => OnOffText); }, (ex) => { //TODO: Handle Error }); SyncCommand = new AsyncRelayCommand(async(o) => { SyncRunning = true; await _syncService.Sync(); }, null, async() => { SyncRunning = false; }, (ex) => { //TODO: Handle Error SyncRunning = false; throw ex; }); #pragma warning restore 1998 }