private async System.Threading.Tasks.Task SendMessageAsync() { var data = "{\"format\":\"raw\",\"freq\":38,\"data\":[4713,1190,1190,1190,1190,1190,1037,1319,1150,1150,1150,1150,1150,1150,1150,1150,2368,1150,1150,1150,1150,1150,1150,1150,1150,54214,4554,1190,1190,1190,1037,1319,1150,1150,1150,1319,1150,1319,1150,1319,1150,1319,2288,1190,1190,1190,1037,1319,1037,1319,1037,54214,4554,1232,1111,1232,1111,1232,1111,1232,1111,1232,1111,1232,1111,1232,1111,1232,2288,1319,1002,1319,1111,1232,1111,1232,1111,54214,4554,1232,1111,1232,1111,1366,1111,1111,1111,1232,1037,1232,1037,1232,1037,1232,2288,1232,1232,1232,1111,1275,1111,1275,1111,54214,4554,1232,1037,1232,1232,1232,1037,1232,1037,1232,1037,1232,1037,1232,1037,1232,2211,1319,1111,1232,1111,1111,1111,1232,1111,54214,4713,1232,1111,1232,1111,1232,1002,1366,1111,1232,1111,1232,1111,1232,1111,1232,2211,1319,1150,1150,1150,1150,1150,1150,1150]}"; //var content = new StringContent(data, Encoding.UTF8); //var request = new HttpRequestMessage(HttpMethod.Post, "http://192.168.0.4/messages"); //request.Headers.Add("X-Requested-With", "curl"); //request.Content = content; //var response = await httpClient.SendAsync(request); Models.IRCommand command = new Models.IRCommand("地デジNHK", data); Models.IRKit iRKit = new Models.IRKit(); await iRKit.ExecCommandAsync(command); }
public MainWindowViewModel(IDialogService dialogService, Models.IRKit iRKit) { GetIPAddress.Subscribe(async _ => await SendMessageAsync()); httpClient = new HttpClient(); this.iRKit = iRKit; IRCommandList = iRKit.IRCommandList.ToReadOnlyReactiveCollection(); AddList = new ReactiveCommand(); AddList.Subscribe(_ => iRKit.IRCommandList.Add(new Models.IRCommand("コマンド3", "3"))); IDialogResult result = null; OpenDialog = new ReactiveCommand <object>() .WithSubscribe(_ => dialogService.ShowDialog("AddIRCommandDialog", null, ret => result = ret)) .AddTo(disposables); ExecIRCommand = new ReactiveCommand <object>() .WithSubscribe(async _ => await ExecIRCommandAsync()) .AddTo(disposables); SelectedIRCommand = null; }