public FindESPViewModel(IESPMessageService messageService, IDispatcher dispatcher, INavigationService navigationService) { Name = "Connection"; FoundEsps = new ObservableCollection <ESP>(); CancelCommand = Make.UICommand.Do(() => { IsSearching = false; }); StartSearchCommand = Make.UICommand.Do(() => ESPPingAsync(dispatcher)); ConnectCommand = Make.UICommand <ESPEcho> .Do((esp) => Connect(navigationService, esp)); this.messageService = messageService; messageService.AddListener(0, (message) => ProcessMessage(message, dispatcher)); ESPPingAsync(dispatcher); }
public OTAUpdateViewModel(ESPEcho esp, IESPMessageService messageService, IHTTPServer httpsServer, IDispatcher dispatcher) { this.esp = esp; this.messageService = messageService; this.httpsServer = httpsServer; this.dispatcher = dispatcher; Name = "OTA update for " + esp.Name; FileName = OTA.Default.FilePath; BrowseCommand = Make.UICommand.Do(() => Browse()); UpdateCommand = Make.UICommand.When(() => !string.IsNullOrEmpty(FileName)).Do(() => Update()); CancelCommand = Make.UICommand.Do(() => Cancel()); messageService.AddListener(1, (message) => ProcessMessage(message)); IsEnabled = true; }