public bool Load(GrblViewModel model, string cmd) { bool?res = null; CancellationToken cancellationToken = new CancellationToken(); Comms.com.PurgeQueue(); model.Silent = true; new Thread(() => { res = WaitFor.AckResponse <string>( cancellationToken, response => ProcessDetail(response), a => model.OnResponseReceived += a, a => model.OnResponseReceived -= a, 400, () => Comms.com.WriteCommand(cmd)); }).Start(); while (res == null) { EventUtils.DoEvents(); } return(settings.Count > 0); }
public virtual void eventAdded(Context con, EventDefinition ed) { var maskListenersCopy = new Dictionary <String, IDictionary <String, ListSet <ContextEventListener> > >(maskListeners); foreach (var mask in maskListenersCopy.Keys) { if (!ContextUtils.matchesToMask(mask, con.getPath())) { continue; } var cel = getContextMaskListeners(mask); foreach (var ev in cel.Keys) { if (!EventUtils.matchesToMask(ev, ed)) { continue; } var listeners = cel[ev]; lock (listeners) { foreach (var el in listeners) { addListenerToContext(con, ed.getName(), el, true); } } } } }
public ActionResult Login(FormCollection collection) { var room = collection.Get("room"); var type = Int32.Parse(collection.Get("type")); var ticketId = Int32.Parse(collection.Get("ticketId")); var ticketOvner = collection.Get("ticketOvner"); var modelEvent = new Event { RoomName = room, EmployeeName = Session["LoginedUser"].ToString(), ClientName = ticketOvner, Date = DateTime.Now, TicketId = ticketId, Type = Convert.ToBoolean(type) }; var tmp = MappingDtos.ModelEventToEntityEvent(modelEvent); if (EventUtils.InsertEvent(tmp)) { TicketUtils.EventTriggerUpdate(ticketId); // List<Ticket> tickets = new List<Ticket>(); Ticket tick = new Ticket(); tick = MappingDtos.EntityTicketToModelTicket(TicketUtils.GetTicketById(ticketId)); /* tickets.Add(tick); * Client client = new Client(); * client = MappingDtos.EntityClientToModelClient(tmp.Card); */ return(RedirectToAction("SuccessEnter", "Employee", tick)); } else { return(RedirectToAction("EmployeeError", "Employee", new { @errorMsg = "Nem sikeres belepes" })); } }
/// <summary> /// Loads data into the properties controls /// </summary> private void LoadData() { try { // load the selected row if (_eventsListView.SelectedItems.Count == 0) { return; } EventLogRecord el = _eventsListView.SelectedItems[0].Tag as EventLogRecord; if (el != null) { EventAPI.EventLogRecord eventRecord = el.Record; DateTime eventTime = EventUtils.Time_T2DateTime(eventRecord.dwEventDateTime); eventTime = eventTime.ToLocalTime(); // setup fields tbDate.Text = eventTime.ToString("MM/dd/yyyy"); tbTime.Text = eventTime.ToLongTimeString();// ToString("hh:mm:ss"); tbType.Text = eventRecord.pszEventType; tbUser.Text = eventRecord.pszUser; tbComputer.Text = eventRecord.pszComputer; tbSource.Text = eventRecord.pszEventSource; tbCategory.Text = eventRecord.pszEventCategory; tbEventId.Text = eventRecord.dwEventSourceId.ToString(); tbDescription.Text = eventRecord.pszDescription; } } catch (Exception ex) { Logger.Log(ex.ToString(), Logger.LogLevel.Error); } }
public bool WaitForResponse(string command) { bool?res = null; if (Grbl.ResponseLogVerbose) { Grbl.ResponseLog.Add(command); } new Thread(() => { res = WaitFor.AckResponse <string>( cancellationToken, null, a => Grbl.OnResponseReceived += a, a => Grbl.OnResponseReceived -= a, 5000, () => Grbl.ExecuteCommand(command)); }).Start(); while (res == null) { EventUtils.DoEvents(); } return(res == true); }
private void GetDriverStatus(string axis) { bool?res = null; CancellationToken cancellationToken = new CancellationToken(); var model = DataContext as GrblViewModel; DriverStatus = ""; Comms.com.PurgeQueue(); model.Poller.SetState(0); model.SuspendProcessing = true; new Thread(() => { res = WaitFor.AckResponse <string>( cancellationToken, response => ProcessStatus(response), a => model.OnResponseReceived += a, a => model.OnResponseReceived -= a, 800, () => Comms.com.WriteCommand("M122" + axis)); }).Start(); while (res == null) { EventUtils.DoEvents(); } model.SuspendProcessing = false; model.Poller.SetState(AppConfig.Settings.Base.PollInterval); }
public override void OnShow(object param = null) { // UIManager.I.ShowView<ResultView> (true); var allAudio = GetComponents <AudioSource> (); _audioHit = allAudio[0]; _audioHit.Stop(); _audioWin = allAudio[1]; _audioWin.Stop(); _initGameInfo = param as GameInfoData; _curCaTrans = SceneLoadManager.I.GetSceneNodeTrans(SaveData.curCheckPoint, "Camera"); _curBridge = SceneLoadManager.I.GetSceneNodeTrans(SaveData.curCheckPoint, "Bridge"); _curWater1 = SceneLoadManager.I.GetSceneNodeTrans(SaveData.curCheckPoint, "Water1"); _curWater2 = SceneLoadManager.I.GetSceneNodeTrans(SaveData.curCheckPoint, "Water2"); _initWaterPos = _curWater1.localPosition; this.StartCoroutine(_TranslateWater()); _caInitPos = _curCaTrans.localPosition; _rigidbody = transform.GetComponent <Rigidbody> (); _myAnimator = transform.GetComponent <Animator> (); _initPos = new Vector3(_initGameInfo.X, _initGameInfo.Y, _initGameInfo.Z); obFlag = 1; _InitInfo(); EventUtils.AddListener("EnemyIsDie", _EnemyIsDie); EventUtils.AddListener("Start", _CanStart); EventUtils.AddListener("MainRoleBeForce", _MainRoleBeForce); EventUtils.AddListener("InitMainPos", _InitMainPos); #if UNITY_ANDROID if (_shakeActivity == null) { AndroidJavaClass jc = new AndroidJavaClass("com.Uqee.LittleGame.ClickShake"); _shakeActivity = jc.GetStatic <AndroidJavaObject> ("_mClickShake"); } #endif }
void btnCurrPos_Click(object sender, RoutedEventArgs e) { bool?res = null; CancellationToken cancellationToken = new CancellationToken(); awaitCoord = true; parameters.OnRealtimeStatusProcessed += DataReceived; new Thread(() => { res = WaitFor.AckResponse <string>( cancellationToken, null, a => GotPosition += a, a => GotPosition -= a, 1000, () => RequestStatus()); }).Start(); while (res == null) { EventUtils.DoEvents(); } parameters.OnRealtimeStatusProcessed -= DataReceived; }
private bool AttemptReset() { ResetPending = true; Comms.com.PurgeQueue(); bool?res = null; CancellationToken cancellationToken = new CancellationToken(); new Thread(() => { res = WaitFor.SingleEvent <string>( cancellationToken, s => TrapReset(s), a => model.OnGrblReset += a, a => model.OnGrblReset -= a, AppConfig.Settings.Base.ResetDelay, () => Comms.com.WriteByte(GrblConstants.CMD_RESET)); }).Start(); while (res == null) { EventUtils.DoEvents(); } return(!ResetPending); }
//GET : Events public ActionResult ListEvents(int?page, string searchString, string category = "", string usedate = "") { int cid = 0; List <DataAccessLayer.Entities.Event> eventContextList = EventUtils.GetAllEvents(); List <Event> eventList = Mappings.MappingDtos.EntityEventToModelEventList(eventContextList); List <TicketType> type = Mappings.MappingDtos.EntityTicketLIstToModelTicketTypeAsList(TicketTypeUtils.GetAllTicketTypes()); ViewBag.tklist = type; if (!String.IsNullOrEmpty(searchString)) { if (Int32.TryParse(searchString, out cid)) { var c = ClientUtils.GetClientById(cid); eventList = eventList.Where(s => s.ClientName == (c.FirstName + " " + c.LastName)).ToList(); } else { eventList = eventList.Where(s => s.ClientName.ToLower().Contains(searchString.ToLower())).ToList(); } } if (!String.IsNullOrEmpty(category)) { eventList = eventList.Where(s => s.TicketId == Int32.Parse(category)).ToList(); } if (!String.IsNullOrEmpty(usedate)) { eventList = eventList.Where(s => s.Date.ToString("yyyy'-'MM'-'dd").Contains(usedate)).ToList(); } return(View(eventList.ToPagedList(page ?? 1, pageSize: 20))); }
private void addEventListener(String context, String eventString, ContextEventListener listener, Boolean mask) { var con = get(context, listener.getCallerController()); if (con != null) { var events = EventUtils.getEvents(con, eventString, listener.getCallerController()); foreach (var ed in events) { addListenerToContext(con, ed.getName(), listener, mask); } } else { if (!mask) { var eel = getListeners(context, eventString); if (!eel.Contains(listener)) { eel.Add(listener); } } } }
public async Task <bool> Publish <TEvent>(TEvent @event, string topicArn) where TEvent : Event { try { var message = JsonConvert.SerializeObject(@event); var publishResponse = await _client.PublishAsync(new PublishRequest() { Message = message, TopicArn = topicArn }); if (publishResponse.HttpStatusCode != HttpStatusCode.OK) { _logger.Error($"Could not publish to {EventUtils.GetTopicName(@event)}"); } _logger.Info($"Published {typeof(TEvent)} to {EventUtils.GetTopicName(@event)}", message); return(publishResponse.HttpStatusCode == HttpStatusCode.OK); } catch (Exception exception) { _logger.Error($"Could not publish to {EventUtils.GetTopicName(@event)}", exception.ToString()); return(false); } }
public async Task ReadRunnerCsvForEvent( [Summary("Path to CSV")] string filePath, [Summary("Optional: The event name (if not supplied, will use next event for this server")] string eventName = "") { try { var reader = new ReminderReader((DiscordSocketClient)Context.Client); EventEntity evnt; if (eventName == "") { evnt = EventUtils.GetNextEventForGuild(Context.Guild.Id); } evnt = new EventEntity(eventName); var events = reader.ReadRunnerReminderCsvForEvent(filePath, evnt.Id); await ReplyAsync(TextUtils.GetSuccessText("k")); } catch (Exception e) { await ReplyAsync(TextUtils.GetErrorText("Nope: " + e.Message)); } }
public bool WaitForWcoUpdate() { bool?res = null; // Wait for WCO update to get current work offsets if (Grbl.Poller.IsEnabled) { new Thread(() => { res = WaitFor.SingleEvent <string>( cancellationToken, null, a => Grbl.OnWCOUpdated += a, a => Grbl.OnWCOUpdated -= a, AppConfig.Settings.Base.PollInterval * 35); }).Start(); } while (res == null) { EventUtils.DoEvents(); } return(res == true); }
private void _OnclickBtnStart() { _audioButton.gameObject.SetActive(true); _audioButton.Play(); EventUtils.Dispatch("Start"); btn_start.gameObject.SetActive(false); }
private void OnDestroy() { this.StopAllCoroutines(); EventUtils.RemoveListener("Start", _CanStart); EventUtils.RemoveListener("EnemyIsDie", _EnemyIsDie); EventUtils.RemoveListener("MainRoleBeForce", _MainRoleBeForce); EventUtils.RemoveListener("InitMainPos", _InitMainPos); }
private void OnObjectResultChanged(object _, BindingResultChange <TObject> e) { if (TryObserveOnTObject && _mode == BindingMode.Default) { EventUtils.Move(OnObjectPropertyChanged, e.OldResult.GetValueOrDefault(), e.NewResult.GetValueOrDefault()); } MaybeOnResultChanged(); }
public void AddEvents(List <IEventMessage> items) { items.ForEach(eventMessage => _messages.Enqueue(EventUtils.AsTrackedEventMessage(eventMessage, null))); lock (_lock) { _itemAvailable.TrySetResult(this); } }
public async Task <EventDTO> Create(EventDTO entity) { var newEvent = EventUtils.FromEventDTO(entity); this.dbContext.Set <Event>().Add(newEvent); await this.dbContext.SaveChangesAsync(); return(EventUtils.ToEventDTO(newEvent, entity.Language)); }
public static void Delay(Action act) { if (!instance) { instance = (new GameObject("event utils", typeof(EventUtils))).GetComponent <EventUtils>(); instance.hideFlags = HideFlags.HideAndDontSave; } instance.delayed += act; }
public void Start() { ColorDialog cd = new ColorDialog(); if (cd.ShowDialog() == DialogResult.OK) { EventUtils.FireTypedEvent(StartFired, cd.Color); } }
private void _OnClickBtnAgain() { EventUtils.Dispatch("PlayClickBtnMusic"); UIManager.I.HideView("ResultView"); DataCache.mainRoleIsDie = false; DataCache.rounds = 1; SceneLoadManager.I.ReStartSceneGame(); EventUtils.Dispatch("Start"); }
public override void OnShow(object param = null) { if (param != null) { var info = (GameInfoData)param; transform.localPosition = new Vector3(info.X, info.Y, info.Z); rounds = info.Rounds; } EventUtils.AddListener("IsWin", _IsWin); }
public async Task <IReadOnlyCollection <EventDTO> > GetAllByLanguage(string language) { var result = await this.dbContext .Set <Event>() .Include(item => item.Details) .Select(item => EventUtils.ToEventDTO(item, language)) .ToListAsync(); return(new ReadOnlyCollection <EventDTO>(result)); }
public static void Load(GrblViewModel model) { bool?res = null; CancellationToken cancellationToken = new CancellationToken(); data.Clear(); if (mounted == null) { Comms.com.PurgeQueue(); new Thread(() => { mounted = WaitFor.AckResponse <string>( cancellationToken, null, a => model.OnResponseReceived += a, a => model.OnResponseReceived -= a, 500, () => Comms.com.WriteCommand(GrblConstants.CMD_SDCARD_MOUNT)); }).Start(); while (mounted == null) { EventUtils.DoEvents(); } } if (mounted == true) { Comms.com.PurgeQueue(); id = 0; model.Silent = true; new Thread(() => { res = WaitFor.AckResponse <string>( cancellationToken, response => Process(response), a => model.OnResponseReceived += a, a => model.OnResponseReceived -= a, 2000, () => Comms.com.WriteCommand(GrblConstants.CMD_SDCARD_DIR)); }).Start(); while (res == null) { EventUtils.DoEvents(); } model.Silent = false; data.AcceptChanges(); } }
public override void OnShow(object param = null) { txt_opentime.text = param.ToString(); //UIManager.I.ShowView<TestView1>("111222"); btn_start.onClick.AddListener(_OnclickBtnStart); btn_restart.onClick.AddListener(_OnclickBtnRestart); btn_next.onClick.AddListener(_OnclickBtnNext); EventUtils.AddListener("OnClickNextCheckPoint", _OnClickNextCheckPoint); }
public override void OnHide() { base.OnHide(); EventUtils.RemoveListener("OnClickNextCheckPoint", _OnClickNextCheckPoint); EventUtils.RemoveListener("OnClickNextCheckPoint", _GoToNextScene); EventUtils.RemoveListener("BuffCDIcon", _BuffCDIcon); EventUtils.RemoveListener("PlayClickBtnMusic", _PlayClickBtnMusic); EventUtils.RemoveListener("EatCoin", _EatCoin); EventUtils.RemoveListener("ShowCombo", _ShowCombo); EventUtils.RemoveListener("ShakeScreen", _ShakeScreen); EventUtils.RemoveListener("ShowView", _ShowView); }
public void EventInvocationInThirdPartyClassShouldSuccess() { var e = new ClassWithEvents(); var counter = 0; e.OnString += (sender, s) => counter++; e.OnString += (sender, s) => counter++; EventUtils.InvokeAppropriateEvent(e, string.Empty); //Unfortunately FluentAssertions MonitorEvent/ShouldRaise Methods make this test fail counter.Should().Be(2); }
public static List <EventHook> GetEventHooks(EventType eventType, string eventTarget = null) { var eventName = EventUtils.GetEventName(eventType); if (eventTarget != null) { return(GetAllEventHooks().Where(x => x.EventName == eventName && x.EventTarget == eventTarget).ToList()); } else { return(GetAllEventHooks().Where(x => x.EventName == eventName).ToList()); } }
public void DeactivateEventType(UIApplication uiApp, EventType eventType, string eventTarget = null) { try { EventUtils.ToggleHooks <EventHooks>(this, uiApp, eventType, eventTarget: eventTarget, toggle_on: false); } catch (NotSupportedFeatureException) { logger.Debug(string.Format("Hook type {0} not supported under this Revit version. Skipped.", eventType.ToString())); } catch (Exception) { logger.Debug(string.Format("Failed unregistering hook type {0}", eventType.ToString())); } }