/// <summary/> protected internal override TimeSpan DefineTimeline(ParallelTimeline parentTimeline, TimeSpan parentOffset) { var timeline = new DoubleAnimation(); var trigger = new ActionTrigger(Action); timeline.CurrentTimeInvalidated += (sender, e) => trigger.Tick((Clock)sender); parentTimeline.Children.Add(timeline); return DefineTimelineCore(timeline, parentOffset); }
public byte[] Execute(ActionTrigger actionTrigger, ActionContext context) { //<MAINCODE> actionTrigger(this, context); return(null); }
public async Task<ActionResult<ActionTrigger>> PostActionTrigger(ActionTrigger actionTrigger) { _context.Trigger.Add(actionTrigger); await _context.SaveChangesAsync(); return CreatedAtAction("GetActionTrigger", new { id = actionTrigger.ActionTriggerID }, actionTrigger); }
public void Pause(ActionTrigger onPause) { this.ReadyState = Transport.ReadyStateEnum.PAUSED; ActionTrigger pause = (ActionTrigger)(() => { this.ReadyState = Transport.ReadyStateEnum.PAUSED; onPause(); }); if (this.IsPolling || !this.Writable) { int[] total = new int[1]; if (this.IsPolling) { ++total[0]; this.Once(Polling.EVENT_POLL_COMPLETE, (IListener) new Polling.PauseEventPollCompleteListener(total, pause)); } if (this.Writable) { return; } ++total[0]; this.Once(Transport.EVENT_DRAIN, (IListener) new Polling.PauseEventDrainListener(total, pause)); } else { pause(); } }
internal void OnDrain() { for (int index = 0; index < this.PrevBufferLen; ++index) { try { ActionTrigger actionTrigger = this.CallbackBuffer[index]; if (actionTrigger != null) { actionTrigger(); } } catch (ArgumentOutOfRangeException ex) { this.WriteBuffer = this.WriteBuffer.Clear(); this.CallbackBuffer = this.CallbackBuffer.Clear(); this.PrevBufferLen = 0; } } try { this.WriteBuffer = this.WriteBuffer.RemoveRange(0, this.PrevBufferLen); this.CallbackBuffer = this.CallbackBuffer.RemoveRange(0, this.PrevBufferLen); } catch (Exception ex) { this.WriteBuffer = this.WriteBuffer.Clear(); this.CallbackBuffer = this.CallbackBuffer.Clear(); } this.PrevBufferLen = 0; if (this.WriteBuffer.Count == 0) { this.Emit(Socket.EVENT_DRAIN); } else { this.Flush(); } }
protected void RegistEvent <T1, T2>(string eventName, Action <T1, T2> aAction) { var actionTrigger = new ActionTrigger <T1, T2>(aAction); this.exBase.RegistEvent(eventName, actionTrigger); AddToRegistedTriggers(actionTrigger); }
private void ExecuteActions(ActionTrigger location) { var actions = _actionRepository.GetToExecute(location); var fifthplayCredentials = _credentialsRepository.GetFifthplay(); var iftttKey = _credentialsRepository.GetIfttt(); var timestamp = DateTimeOffset.UtcNow; Parallel.ForEach(actions, action => { try { switch (action.ActionTypeName) { case "switch": _fifthplayRepository.SwitchSmartPlug(fifthplayCredentials.Username, fifthplayCredentials.Password, action.DeviceIdentifier, (action.ActionArgumentValue == "on" ? true : false)); break; case "IFTTT Maker Event": _iftttRepository.TriggerEvent(iftttKey, "homebased", location.ToString(), null, null); break; default: throw new InvalidOperationException($"Action type {action.ActionTypeName} unsupported"); } _logger.Log(action, timestamp); } catch (Exception ex) { _logger.Log(ex, action, timestamp); } }); }
public byte[] Execute(ActionTrigger actionTrigger, ActionContext context) { try { Context = context; ActionTrigger = actionTrigger; using (var sourceConnection = new SqlConnection(ConnectionString)) { sourceConnection.Open(); // Get data from the source table as a SqlDataReader. var commandSourceData = new SqlCommand(BulkSelectQuery, sourceConnection); var dataTable = new DataTable(); var dataAdapter = new SqlDataAdapter(commandSourceData); dataAdapter.Fill(dataTable); DataContext = Serialization.DataTableToByteArray(dataTable); actionTrigger(this, context); } return(null); } catch (Exception) { // ignored return(null); } }
public async Task<IActionResult> PutActionTrigger(int id, ActionTrigger actionTrigger) { if (id != actionTrigger.ActionTriggerID) { return BadRequest(); } _context.Entry(actionTrigger).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ActionTriggerExists(id)) { return NotFound(); } else { throw; } } return NoContent(); }
void Awake() { _horizontalInput = new AxisTrigger(); _useBonusInput = new ActionTrigger(); _carPhysics = GetComponent <CarPhysics>(); }
public byte[] Execute(ActionTrigger actionTrigger, ActionContext context) { try { var script = string.Empty; var metaProvider = new MetadataFileProvider(); metaProvider.GetReference(context.GetType().Assembly.Location); var scriptEngine = new ScriptEngine(metaProvider); var session = scriptEngine.CreateSession(context); session.AddReference( @"C:\Users\ninoc\Documents\Visual Studio 2015\Projects\HybridIntegrationServices\Framework\bin\Debug\Framework.exe"); session.AddReference( @"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Windows.Forms.dll"); if (ScriptFile != null || ScriptFile != string.Empty) { // TODO 1020 // ReSharper disable once AssignNullToNotNullAttribute script = File.ReadAllText(ScriptFile); session.ExecuteFile(script); } else { session.Execute(Script); } return(null); } catch (Exception) { // ignored return(null); } }
public async Task <IActionResult> Edit(int id, [Bind("ActionTriggerID,RoomID,Command,Sensor,GreaterThan,Value")] ActionTrigger actionTrigger) { if (id != actionTrigger.ActionTriggerID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(actionTrigger); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ActionTriggerExists(actionTrigger.ActionTriggerID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["RoomID"] = new SelectList(_context.Room, "RoomID", "RoomID", actionTrigger.RoomID); return(View(actionTrigger)); }
public byte[] Execute(ActionTrigger actionTrigger, ActionContext context) { try { Context = context; ActionTrigger = actionTrigger; var rfid = new RFID(); // Declare an RFID object // initialize our Phidgets RFID reader and hook the event handlers rfid.Attach += RfidAttach; rfid.Detach += RfidDetach; rfid.Error += RfidError; rfid.Tag += RfidTag; rfid.TagLost += RfidTagLost; rfid.open(); // Wait for a Phidget RFID to be attached before doing anything with // the object rfid.waitForAttachment(); // turn on the antenna and the led to show everything is working rfid.Antenna = true; rfid.LED = true; Thread.Sleep(Timeout.Infinite); return(null); } catch (Exception) { // ignored return(null); } }
internal bool CommitEdit(DataGridCellInfo cellInfo, ActionTrigger trigger, object parameter) { var context = new EditContext(cellInfo, trigger, parameter); this.CommandService.ExecuteCommand(CommandId.CommitEdit, context); return(context.IsSuccessful); }
public RuleActionWithDependencies(LambdaExpression expression, Action <IContext, Tuple, IDependencyResolver, IResolutionContext> compiledExpression, IArgumentMap argumentMap, ActionTrigger actionTrigger) { _expression = expression; Trigger = actionTrigger; _compiledExpression = compiledExpression; _argumentMap = argumentMap; }
public RuleAction(LambdaExpression expression, Action <IContext, Tuple> compiledExpression, IArgumentMap argumentMap, ActionTrigger actionTrigger) { _expression = expression; Trigger = actionTrigger; _compiledExpression = compiledExpression; _argumentMap = argumentMap; }
internal bool CancelEdit(ActionTrigger trigger, object parameter) { var context = new EditContext(new DataGridCellInfo(this.CurrentItem, null), trigger, parameter); this.CommandService.ExecuteCommand(CommandId.CancelEdit, context); return(context.IsSuccessful); }
public byte[] Execute(ActionTrigger actionTrigger, ActionContext context) { trigger = this; InternalContext = context; InternalActionTrigger = actionTrigger; InternalDataContext = DataContext; StartHooking(); return(null); }
public RuleAction(LambdaExpression expression, FastDelegate <Action <IContext, object[]> > compiledExpression, IndexMap tupleFactMap, IndexMap dependencyFactMap, ActionTrigger actionTrigger) { _expression = expression; _tupleFactMap = tupleFactMap; _dependencyFactMap = dependencyFactMap; _actionTrigger = actionTrigger; _compiledExpression = compiledExpression; }
public ComplexEventAction(string key, int processId, IList <IProcessExpectedEvent> events, Type expectedMessageType, IProcessAction action, IProcessStateInfo processInfo, ActionTrigger actionTrigger = ActionTrigger.All)//Todo:get rid of optional parameters { ProcessId = processId; Events = events; ExpectedMessageType = expectedMessageType; ProcessInfo = processInfo; ActionTrigger = actionTrigger; Key = key; Action = action; }
private static void DoWork(object obj) { ActionTrigger actionTrigger = (ActionTrigger)obj; if (actionTrigger == null) { return; } actionTrigger(); }
public static void TaskRun(ActionTrigger action) { ManualResetEvent resetEvent = new ManualResetEvent(false); ThreadPool.QueueUserWorkItem((WaitCallback)(arg => { EasyTimer.DoWork((object)action); resetEvent.Set(); })); resetEvent.WaitOne(); }
public override void triggerEffect(ActionTrigger trigger, PlayerProjectile projectile) { Debug.Log("ExplosionEffect"); if (trigger.m_ActionType == "HitTrigger") { Debug.Log("ExplosionEffect"); //projectile.m_ProjectileFeatures.m_Damage += m_ExplosionDamage; //UiManager.Instance.spawnFloatingText (projectile.transform.position, "+", m_ExplosionDamage); } }
public override void triggerEffect(ActionTrigger trigger, PlayerProjectile projectile) { Debug.Log("AdditiveDamageEffect"); if (trigger.m_ActionType == "Bounce") { Debug.Log("AdditiveDamageEffect"); projectile.m_ProjectileFeatures.m_Damage += m_BonusDamage; UiManager.Instance.spawnFloatingText(projectile.transform.position, "+", m_BonusDamage); } }
private void HandleActionTrigger(ActionTrigger trigger) { var spriteRenderer = this.GetComponent <SpriteRenderer>(); switch (trigger) { case ActionTrigger.Damaged: this.interruptPattern = DamagedPattern(); break; } }
public byte[] Execute(ActionTrigger actionTrigger, ActionContext context) { try { var namespaceManager = NamespaceManager.CreateFromConnectionString(ConnectionString); if (!namespaceManager.TopicExists(TopicPath)) { namespaceManager.CreateTopic(TopicPath); } var sqlFilter = new SqlFilter(MessagesFilter); if (!namespaceManager.SubscriptionExists(TopicPath, SubscriptionName)) { namespaceManager.CreateSubscription(TopicPath, SubscriptionName, sqlFilter); } var subscriptionClientHigh = SubscriptionClient.CreateFromConnectionString( ConnectionString, TopicPath, SubscriptionName); // Configure the callback options var options = new OnMessageOptions { AutoComplete = false, AutoRenewTimeout = TimeSpan.FromMinutes(1) }; // Callback to handle received messages subscriptionClientHigh.OnMessage( message => { try { // Remove message from queue message.Complete(); DataContext = message.GetBody <byte[]>(); actionTrigger(this, context); } catch (Exception) { // Indicates a problem, unlock message in queue message.Abandon(); } }, options); return(null); } catch (Exception) { // ignored return(null); } }
public ConversationAction[] actionsForTriggerType(ActionTrigger.TriggerType type) { ActionTrigger trigger = (ActionTrigger)triggers[type]; if (trigger == null) { return(null); } return(trigger.actions); }
private void SendPacket(Packet packet, ActionTrigger fn) { if (fn == null) { fn = (ActionTrigger)(() => { }); } this.Emit(Socket.EVENT_PACKET_CREATE, (object)packet); this.WriteBuffer = this.WriteBuffer.Add(packet); this.CallbackBuffer = this.CallbackBuffer.Add(fn); this.Flush(); }
public LockSlimEhQueue( int capLimit, int timeLimit, ActionTrigger actionTrigger, ActionContext actionContext, EtwTrigger eTwTrigger) { Init(capLimit, timeLimit); EtwTrigger = eTwTrigger; ActionTrigger = actionTrigger; ActionContext = actionContext; }
internal bool BeginEdit(object item, ActionTrigger trigger, object parameter) { // TODO: optimize this if needed. var info = this.Model.FindItemInfo(item); if (info != null) { return(this.BeginEdit(info.Value, trigger, parameter)); } return(false); }
internal bool BeginEdit(DataGridCellInfo cellInfo, ActionTrigger trigger, object parameter) { if ((this.editService.IsEditing && !this.CommitEdit()) || !this.CurrencyService.ChangeCurrentItem(cellInfo.RowItemInfo.Item, false, true)) { return(false); } var context = new EditContext(cellInfo, trigger, parameter); this.CommandService.ExecuteCommand(CommandId.BeginEdit, context); return(context.IsSuccessful); }
public void Update(Guid actionIdentifier, Guid deviceIdentifier, int actionTypeIdentifier, int actionArgumentIdentifier, ActionTrigger actionTrigger) { var action = _actionRepository.GetByIdentifier(actionIdentifier); if (action == null) throw new InvalidOperationException($"Cannot update, action not found by identifier '{actionIdentifier}'"); action.DeviceIdentifier = deviceIdentifier; action.ActionTypeIdentifier = actionTypeIdentifier; action.ActionArgumentIdentifier = actionArgumentIdentifier; action.ActionTrigger = actionTrigger; }
public IEnumerable<ActionToExecute> GetToExecute(ActionTrigger location) { return (from action in DataContext.Actions from device in DataContext.Devices from actionType in DataContext.ActionTypes from argument in actionType.ActionArguments where action.ActionTrigger == location && device.Identifier == action.DeviceIdentifier && actionType.Identifer == action.ActionTypeIdentifier && argument.Identifer == action.ActionArgumentIdentifier select new ActionToExecute { DeviceIdentifier = device.Identifier, DeviceName = device.Name, ActionTypeName = actionType.Name, ActionArgumentValue = argument.Value, ActionTriggerValue = action.ActionTrigger.ToString() }); }