public LoadForm(BlockConfigurationIO bios, HandleIO handle) { InitializeComponent(); pBios = bios; hio = handle; pBios.eCompleteReadEpromLine += new EventHandler(pBios_eCompleteReadEpromLine); pBios.eMorePopitReadEpromLine += new EventHandler(pBios_eMorePopitReadEpromLine); pBios.eTimeoutReadEpromLine += new EventHandler(pBios_eTimeoutReadEpromLine); incer = new Incer(IncP); initer = new Initer(InitProgressBar); mes = new Messeger(ShowMessage); obj = new object(); }
public LoadeForm(BIOS bios, ObjectCurrentState currentState) { InitializeComponent(); pBios = bios; pObject = currentState; pBios.eCompleteReadEpromLine += new EventHandler(pBios_eCompleteReadEpromLine); pBios.eMorePopitReadEpromLine += new EventHandler(pBios_eMorePopitReadEpromLine); pBios.eTimeoutReadEpromLine += new EventHandler(pBios_eTimeoutReadEpromLine); incer = new Incer(IncP); initer = new Initer(InitProgressBar); mes = new Messeger(ShowMessage); obj = new object(); }
public SaveForm(BIOS bios, ObjectCurrentState currentState) { InitializeComponent(); incer = new Incer(IncP); initer = new Initer(InitProgressBar); DialogResult = DialogResult.OK; pBios = bios; pObject = currentState; pBios.eSaveCompleteReadEpromLine += new EventHandler(pBios_eSaveCompleteReadEpromLine); pBios.eSaveMorePopitReadEpromLine += new EventHandler(pBios_eSaveMorePopitReadEpromLine); pBios.eSaveTimeoutReadEpromLine += new EventHandler(pBios_eSaveTimeoutReadEpromLine); mes = new Messeger(ShowMessage); }
public async Task <ActionResult <Conversation> > PostMesseger(CreateMessageRequest request) { var id = 0; var consevation1 = _context.Conversations.Where(a => a.UserIdOne == request.SenderId && a.UserIdTwo == request.ReceiverId).FirstOrDefault(); var consevation2 = _context.Conversations.Where(a => a.UserIdOne == request.ReceiverId && a.UserIdTwo == request.SenderId).FirstOrDefault(); if (consevation1 == null) { if (consevation2 == null) { Conversation conversationnew = new Conversation(); conversationnew.UserIdOne = request.SenderId; conversationnew.UserIdTwo = request.ReceiverId; _context.Conversations.Add(conversationnew); await _context.SaveChangesAsync(); id = conversationnew.Id; } else { id = consevation2.Id; } } else { id = consevation1.Id; } var notification1 = _context.Notifications.Where(a => a.UserSender == request.SenderId && a.UserReceiver == request.ReceiverId).FirstOrDefault(); var notification2 = _context.Notifications.Where(a => a.UserSender == request.ReceiverId && a.UserReceiver == request.SenderId).FirstOrDefault(); if (notification1 == null) { if (notification2 == null) { Notification notificationNew = new Notification(); notificationNew.UserReceiver = request.ReceiverId; notificationNew.SeeReceiver = false; notificationNew.UserSender = request.SenderId; notificationNew.SeeSender = true; notificationNew.ConversationId = id; _context.Notifications.Add(notificationNew); } else { notification2.SeeSender = false; _context.Entry(notification2).State = EntityState.Modified; } } else { notification1.SeeReceiver = false; _context.Entry(notification1).State = EntityState.Modified; } Messeger messeger = new Messeger(); messeger.Message = request.Content; messeger.Date = DateTime.Now; messeger.ConversationId = id; messeger.UserId = request.SenderId; _context.Messegers.Add(messeger); try { await _context.SaveChangesAsync(); await _hubContext.Clients.All.BroadcastMessage(); } catch (DbUpdateException) { throw; } return(Ok(new { Message = "Request complete!" })); }