public IncomingCheckViewModel() { Title = "IncomingItems"; Items = new ObservableCollection <IncomingItem>(); LoadItemsCommand = new Command(async() => await ExecuteLoadItemsCommand()); ItemTapped = new Command <IncomingItem>(OnItemSelected); AddItemCommand = new Command(OnAddItem); ScanCommand = new Command(ScanAction); if (Signalr.Connection.State != HubConnectionState.Connected) { Task.Run(() => Signalr.Connect()); } Signalr.Connection.On <IncomingItem>("RecieveIncomingItem", model => { var item = Source.Datas.Where(x => x.ProductId == model.ProductId && x.PembelianId == model.PembelianId).FirstOrDefault(); if (item != null && item.ActualValue != model.ActualValue) { item.ActualValue = model.ActualValue; } }); Pembelians = new ObservableCollection <Pembelian>(); LoadItemsCommand.Execute(null); }
public ChatHub() { IConfigurationRoot configuration = new ConfigurationBuilder() .SetBasePath(Environment.CurrentDirectory) .AddJsonFile("appsettings.json") .Build(); var options = new DbContextOptionsBuilder <Signalr>() .UseSqlServer(configuration.GetConnectionString("Signalr")) .Options; appContext = new Signalr(options); }
public IHttpActionResult Sendid(Signalr signalr) { //拿已登入的流水 string token = Request.Headers.Authorization.Parameter; JwtAuthUtil jwtAuthUtil = new JwtAuthUtil(); string userseq = jwtAuthUtil.Getuserseq(token); string user = userseq.Substring(0, 1); signalr.whoseq = userseq; signalr.postday = DateTime.Now; db.Signalr.Add(signalr); db.SaveChanges(); return(Ok(new { result = "連線加入成功" })); }
private async Task Item_UpdateEvent(IncomingItem arg) { await Signalr.UpdateIncomingItem(arg); }
public ChatMessagesController(Signalr context, IHubContext <ChatHub> hubContext) { _context = context; _hubContext = hubContext; }
public ChatHistoryController(Signalr context) { _context = context; }