Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 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;
 }