public void EventDispatcher(HexTile tile, GridEvent gridEvent) { EventHandler <GridEventInfo> eventToDispatch = null; switch (gridEvent) { case GridEvent.TileMouseDownL: { eventToDispatch = TileMouseDownL; break; } case GridEvent.TileMouseDownR: { eventToDispatch = TileMouseDownR; break; } case GridEvent.TileMouseDownM: { eventToDispatch = TileMouseDownM; break; } case GridEvent.TileMouseEnter: { eventToDispatch = TileMouseEnter; break; } case GridEvent.TileMouseExit: { eventToDispatch = TileMouseExit; break; } } if (eventToDispatch == null) { return; } var eventInfo = new GridEventInfo() { Tile = tile, Event = gridEvent }; eventToDispatch(this, eventInfo); }
private static async Task SendEvent(string key, string endpoint, EmployeeInfo data) { var gridEvent = new GridEvent <EmployeeInfo>() { Id = Guid.NewGuid().ToString("N"), EventType = "EmployeeAdded", Subject = "Department/Engineering", EventTime = DateTimeOffset.Now.ToString("o"), Data = data }; var gridEvents = new List <GridEvent <EmployeeInfo> > { gridEvent }; var json = JsonConvert.SerializeObject(gridEvents); Console.WriteLine(json); var client = new HttpClient(); client.DefaultRequestHeaders.Add("aeg-sas-key", key); var content = new StringContent(json, Encoding.UTF8, "application/json"); var result = await client.PostAsync(endpoint, content); Console.WriteLine(); Console.WriteLine($"Response: {result.ReasonPhrase}."); }
private static void CreateOutGoingAzureIntegrationCallRecord() { List <GridEvent <DataPayLoad> > gridEventDataPayloadList = new List <GridEvent <DataPayLoad> >(); GridEvent <DataPayLoad> gridEventDataPayload = new GridEvent <DataPayLoad>(); gridEventDataPayload.EventTime = DateTime.Now.ToString(); gridEventDataPayload.EventType = "allEvents"; gridEventDataPayload.Id = Guid.NewGuid().ToString(); gridEventDataPayload.Subject = $"Turn Process : {Events.JOB_COMPLETED.ToString()}"; gridEventDataPayload.data = new DataPayLoad(); gridEventDataPayload.data.Date1 = DateTime.Now.ToString(); gridEventDataPayload.data.Event = Events.JOB_COMPLETED; gridEventDataPayload.data.IsForce = false; gridEventDataPayload.data.PropertyID = "10139104"; gridEventDataPayload.Topic = string.Empty; gridEventDataPayloadList.Add(gridEventDataPayload); Entity azIntCallEntity = new Entity(Constants.AzureIntegrationCalls.LogicalName); azIntCallEntity[Constants.AzureIntegrationCalls.EventData] = CommonMethods.Serialize(gridEventDataPayloadList); azIntCallEntity[Constants.AzureIntegrationCalls.Direction] = true; azIntCallEntity[Constants.AzureIntegrationCalls.EventName] = Events.JOB_COMPLETED.ToString(); service.Create(azIntCallEntity); }
protected virtual void TaskGrid_CompleteSync() { gridEvent = GridEvent.Completed; SendToServer(); TaskGrid.SetCompleted(); }
static void Main(string[] args) { string KEY = "St1U1jE6E4Pz5QLmCDpipV3+Dlt9iaQ1b3uSUrVxnCc="; string TOPIC_ENDPOINT = "https://eventgridtopicfp.eastus-1.eventgrid.azure.net/api/events"; // Create a HTTP client which we will use to post to the Event Grid Topic var httpClient = new HttpClient(); // Add key in the request headers httpClient.DefaultRequestHeaders.Add("aeg-sas-key", KEY); var ediEvent = new GridEvent(); ediEvent.EventTime = DateTime.UtcNow.ToString("o"); // Embed the EDI into the json ediEvent.EventType = "ISA*00* *00* *01*123456789 *01*987654321 *140829*1506*U*00400*004200369*0*P*>~GS*PO*123456789*987654321*20140829*1506*9405568*X*004010~ST*850*055680001~BEG*00*NE*4523184348**20140829~CUR*VN*USD~PER*CN*Med Team 03~N9*ME*MED PRODS SRVS~N1*BT*MED PRODS AND SRVCS~N3*SUPPLY PROD*P.O. Box 2279~N4*EL PASO*TX*79998~N1*DB*Montgomery , KY DC*6*D0OC~N1*MF*PACKAGING*92*000055~N1*SF*PACKAGING*92*00055~N3*4 CORPORATE DR 304~N4*LATITZ*PA*19047~N1*ST*HEALTH MED PRODS AND SRVCS~N3*Montgomery , KY DC*500 Nee Road~N4*Montgomery*KY*12345~PO1*00010*20*CA*55**CB*AD6X10LAWH*VC*AD6X10LAWH***IN*AD6X10LAWH*UK*50885380066458~PID*F****6 X 10 LAWRENCE HOSPITAL CENTER SPECIM~DTM*002*20140829~CTT*1*20~SE*21*055680001~GE*1*9405568~IEA*1*004200369~"; ediEvent.Id = Guid.NewGuid().ToString(); ediEvent.Subject = "EDI850"; // Event grid expects event data as JSON var json = JsonConvert.SerializeObject(ediEvent); // Create request which will be sent to the topic var content = new StringContent(json, Encoding.UTF8, "application/json"); // Send request Console.WriteLine("Sending event to Event Grid..."); var result = httpClient.PostAsync(TOPIC_ENDPOINT, content); // Show result Console.WriteLine($"Event sent with result: {result.ToString()}"); Console.ReadLine(); }
void InsertPlayerOX() { // Get grid's position and instantiate player OX object RaycastHit2D objectHit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero); if (objectHit.transform != null) { //Get the scripts of the raycasted object GridEvent gridEvent = objectHit.transform.GetComponent <GridEvent>(); //Insert the sprite based on turn if (gridEvent.getGridValue() == 0) //If gridValue still 0, means the grid is still empty { gameVisual.InsertMark(objectHit.transform.gameObject, xTurn); //Insert the sprite of the current player to the grid if (xTurn) { gridEvent.setGridValue(xValue); } else { gridEvent.setGridValue(oValue); } emptyGridCount--; //Decrease empty grid count xTurn = !xTurn; //Switch turn to the other player if (!gameEnd) { checkWinner(gridEvent.getGridPos()); } } } }
protected virtual void TaskGrid_ItemMoveSync(Container container) { containerPosition = TaskGrid.GetPosition(container); gridEvent = GridEvent.ItemMoved; SendToServer(); TaskGrid.SetItemMoved(container); }
//----------------------------------------------------------------------------- // Cell change ?? Change the corresponding dataset also private void OnGridCellChange(object sender, Event e) { GridEvent ge = e as GridEvent; string s = GetColLabelValue(ge.Col); DataRow row = myDataSet.Tables[tablename].Rows[ge.Row]; row[s] = GetCellValue(ge.Row, ge.Col); }
protected virtual void TaskGrid_SetZoomingSync(bool isZooming) { this.isZooming = isZooming; gridEvent = GridEvent.SetZooming; SendToServer(); TaskGrid.SetZoomed(isZooming); }
private async Task CreateTableEntity(string entityId, GridEvent <StorageEvent> gridEvent) { var deletedTime = gridEvent.Data.Operation == StorageOperation.Delete ? (DateTime?)gridEvent.EventTime : null; var data = gridEvent.Data.Operation == StorageOperation.Delete ? null : TransformModelData(gridEvent.Data.Data, gridEvent.Data.Collection); var entity = new StorageEventTableEntity(entityId, gridEvent.EventTime, gridEvent.EventTime, deletedTime, data); await tables[gridEvent.Data.Collection].Insert(entity); }
private static EventHistoryTableEntity CreateTableEntity(GridEvent <JObject> gridEvent) { var eventData = Json.SerializeObject(gridEvent); return(new EventHistoryTableEntity(gridEvent.EventTime, gridEvent.EventType, DataToJObject("name")?.ToString(), DataToGuid("organizationId"), DataToGuid("subscriptionId"), eventData)); JToken DataToJObject(string name) => gridEvent.Data.GetValue(name, StringComparison.OrdinalIgnoreCase); Guid?DataToGuid(string name) => DataToJObject(name)?.ToObject <Guid?>(); }
protected virtual void TaskGrid_ItemSelectSync(Item item) { var container = TaskGrid.GetContainer(item); containerPosition = TaskGrid.GetPosition(container); itemIndex = container.Elements.IndexOf(item); gridEvent = GridEvent.ItemSelected; SendToServer(); TaskGrid.SetItemSelected(item, container); }
protected override async Task ProcessEvent(GridEvent <JObject> gridEvent) { if (!IsValidEvent(gridEvent)) { Logger.LogWarning("Ignoring unsupported event: Subject={Subject}, EventType={EventType}", gridEvent.Subject, gridEvent.EventType); return; } Logger.LogInformation("Processing Event {EventType} from {Subject}", gridEvent.EventType, gridEvent.Subject); var tableEntity = CreateTableEntity(gridEvent); await eventsStorage.Insert(tableEntity); }
private async Task UpdateTableEntity(StorageEventTableEntity entity, GridEvent <StorageEvent> gridEvent) { entity.Modified = gridEvent.EventTime; if (gridEvent.Data.Operation == StorageOperation.Delete) { entity.Deleted = gridEvent.EventTime; } else { entity.Data = TransformModelData(gridEvent.Data.Data, gridEvent.Data.Collection); } await tables[gridEvent.Data.Collection].Replace(entity); }
public async Task Post(GridEvent <LoadInfo> data) { var events = await stateManager.GetOrAddAsync <IReliableDictionary <long, IList <LoadMetricInformation> > >("Events"); var inbox = await stateManager.GetOrAddAsync <IReliableConcurrentQueue <long> >("Inbox"); using (ITransaction tx = this.stateManager.CreateTransaction()) { await inbox.EnqueueAsync(tx, long.Parse(data.Id)); await events.AddAsync(tx, long.Parse(data.Id), data.Data.ClusterLoadInfo); await tx.CommitAsync(); } return; }
private static async Task ProcessGridEvent( GridEvent <EmployeeInfo> gridEvent, TraceWriter log) { const string QUEUENAME = "equipmentorders"; var account = CloudStorageAccount.Parse( ConfigurationManager.AppSettings["AzureWebJobsStorage"]); var client = account.CreateCloudQueueClient(); var queue = client.GetQueueReference(QUEUENAME); await queue.CreateIfNotExistsAsync(); var json = JsonConvert.SerializeObject(gridEvent.Data); await queue.AddMessageAsync(new CloudQueueMessage(json)); log.Info($"Posted {json} to the \"{QUEUENAME}\" queue."); }
protected override async Task ProcessEvent(GridEvent <StorageEvent> gridEvent) { if (!IsValidEvent(gridEvent)) { Logger.LogWarning("Ignoring unsupported event: Subject={Subject}, EventType={EventType}", gridEvent.Subject, gridEvent.EventType); return; } if (!tables.ContainsKey(gridEvent.Data.Collection)) { Logger.LogWarning("Ignoring unsupported collection: {Collection}", gridEvent.Data.Collection); return; } var collectionId = GetCollectionId(gridEvent.Data); Logger.LogInformation( "Processing StorageEvent: Name={Name}, Collection={Collection}, Operation={Operation}, CollectionId={CollectionId}, UserId={UserId}", gridEvent.Data.Name, gridEvent.Data.Collection, gridEvent.Data.Operation, collectionId, gridEvent.Data.UserId); var tableEntity = GetTableEntity(gridEvent.Data.Collection, collectionId); if (tableEntity == null) { await CreateTableEntity(collectionId, gridEvent); return; } if (gridEvent.EventTime <= tableEntity.Modified) { Logger.LogWarning("Skipping superseded update: Name={Name}, Collection={Collection}.", gridEvent.Data.Name, gridEvent.Data.Collection); return; } await UpdateTableEntity(tableEntity, gridEvent); }
protected abstract Task ProcessEvent(GridEvent <TEvent> gridEvent);
private static bool IsValidEvent(GridEvent <JObject> gridEvent) { return(Services.All.Contains(gridEvent.Subject)); }
private async Task <HttpResponseMessage> RunStorageEvent(GridEvent <StorageEvent> gridEvent) { return(await RunStorageEvent(Json.SerializeObject(new[] { gridEvent }))); }
private async Task <HttpResponseMessage> RunStoreEventHistory(GridEvent <JObject> gridEvent) { return(await RunStoreEventHistory(new[] { gridEvent })); }
private static bool IsValidEvent(GridEvent <StorageEvent> gridEvent) { return(gridEvent.Subject == Services.ASupervisor && gridEvent.EventType == nameof(StorageEvent)); }