public void InvokeOnComplete() { State = EventState.Completed; EventManager.State = GameState.Normal; if (OnComplete != null) OnComplete.Invoke(); }
public void InvokeEvent() { State = EventState.Running; EventManager.State = GameState.InEvent; if (OnStart != null) OnStart.Invoke(); }
public SearchMaterialWindow() { eventState = EventState.LayoutChangeEvent; InitializeComponent(); FillComboBoxes(); UpdateInformation(); eventState = EventState.UserEvent; }
public void NoteEvent(string name, bool handled = true) { IEventSummary summary = EventStats.ContainsKey(name) ? EventStats[name] : null; if (summary.IsNull()) { summary = new EventState { Name = name, Processed = handled }; EventStats[name] = summary; } summary.Occurrences += 1; }
public Element(ObjectId objectIdentifier, EventType eventType, EventState eventState, byte priority, Option<uint> notificationClass) { this.ObjectIdentifier = objectIdentifier; this.EventType = eventType; this.EventState = eventState; this.Priority = priority; this.NotificationClass = notificationClass; }
public AcknowledgeAlarmRequest(uint acknowledgingProcessIdentifier, ObjectId eventObjectIdentifier, EventState eventStateAcknowledged, TimeStamp timeStamp, string acknowledgmentSource, TimeStamp timeOfAcknowledgment) { this.AcknowledgingProcessIdentifier = acknowledgingProcessIdentifier; this.EventObjectIdentifier = eventObjectIdentifier; this.EventStateAcknowledged = eventStateAcknowledged; this.TimeStamp = timeStamp; this.AcknowledgmentSource = acknowledgmentSource; this.TimeOfAcknowledgment = timeOfAcknowledgment; }
public ListOfEventSummariesType(ObjectId objectIdentifier, EventState eventState, EventTransitionBits acknowledgedTransitions, ReadOnlyArray<TimeStamp> eventTimeStamps, NotifyType notifyType, EventTransitionBits eventEnable, ReadOnlyArray<uint> eventPriorities) { this.ObjectIdentifier = objectIdentifier; this.EventState = eventState; this.AcknowledgedTransitions = acknowledgedTransitions; this.EventTimeStamps = eventTimeStamps; this.NotifyType = notifyType; this.EventEnable = eventEnable; this.EventPriorities = eventPriorities; }
public void SetState(long id, EventState state) { _executor.Execute( "[dbo].[Event_SetState]", new { id, state }); }
private void AssertAndSetState(EventState expected, EventState @new) { lock (_eventStateLock) { if (_eventState != expected) { throw new InvalidEventStateException($"Cannot transition event from state {expected} into {@new}"); } _eventState = @new; } }
public bool ShouldProcessResource(IResourceFacade resource) { if (HasStreamListener(resource.Id)) { _logger.DebugFormat("Listener already exists for {0}", resource); IListener listener = _listeners[resource.Id]; var shouldAdapterProcessResource = false; if (listener.IsFixtureDeleted) { _logger.DebugFormat("{0} was deleted and republished. Listener wil be removed", resource); RemoveStreamListener(resource.Id); } else if (listener.IsIgnored) { _logger.DebugFormat("{0} is marked as ignored. Listener wil be removed", resource); RemoveStreamListener(resource.Id); } //Disconnected from the stream - this fixture should be reconnected ASAP else if (listener.IsDisconnected && (resource.MatchStatus == MatchStatus.Prematch || resource.MatchStatus == MatchStatus.InRunning)) { _logger.WarnFormat("{0} was disconnected from stream {1}", resource, resource.MatchStatus); RemoveStreamListener(resource.Id); shouldAdapterProcessResource = true; } else { if (!RemoveStreamListenerIfFinishedProcessing(resource)) { _listeners[resource.Id].UpdateResourceState(resource); } } MarkResourceAsProcessable(resource); return(shouldAdapterProcessResource); } else { // Check fixture is not yet over, ignore if over var fixtureState = EventState.GetFixtureState(resource.Id); if (resource.IsMatchOver && (fixtureState == null || fixtureState.MatchStatus == resource.MatchStatus)) { _logger.InfoFormat("{0} is over. Adapter will not process the resource", resource); MarkResourceAsProcessable(resource); return(false); } //the resource will be processed return(true); } }
private IEnumerator StartWave(float cooldown) { abouttostartwave = true; yield return(new WaitForSeconds(cooldown)); abouttostartwave = false; if (State == EventState.Wait) { State = EventState.Idle; } }
IEnumerator CheckTime() { while (!TimerEnd) { yield return(new WaitForSeconds(0.5f)); //0.5초마다 끝났는지 체크 if (PerStageTime <= 0) { eventState = EventState.Ending; } } }
public float getStateTime(EventState state) { for (int i = 0; i < states.Length; i++) { if (states[i].state == state) { return(states[i].time); } } return(-1); }
public void EndEvent() { _eventState = EventState.Complete; CancelInvoke(); ActiveBarriers(false); DisableAllSpawners(); if (_gameManager) { _gameManager.SetSpawn(playerSpawnEnd); _gameManager.ReleaseCamera(); } }
public void StartEvent() { _eventState = EventState.Active; ActiveBarriers(true); if (_gameManager) { _gameManager.SetSpawn(playerSpawnStart); } AdjustCamera(); InvokeRepeating(nameof(SpawnEnemy), 2f, Mathf.Max(1f, spawnFrequency)); }
private void InitNewGame() { GameData.EraseGame(); // initialize events here for the moment.. EventState.Clear(); EventState.PushEvent(new TutorialEventChain.IntroductionEvent(), 0, 0); WifeEventChain.Init(); InvestmentEventChain.Init(); FestivalEventChain.Init(); PoisonDemandChangeEventChain.Init(); GameData.singleton.money = DebugOverrides.StartingMoney; GameData.singleton.initialBalance = GameData.singleton.money; // Set final balance for the previous quarter so that next Q can use it as initial balance GameData.singleton.finalBalance = GameData.singleton.money; GameData.singleton.rent = 300; // Starting unlocks GameData.singleton.potionsUnlocked[(int)PotionType.PT_LOVE_POTION] = true; GameData.singleton.potionsUnlocked[(int)PotionType.PT_FIRE_POTION] = true; // Queue timed unlocks of other potion types // The game starts in quarter 0 EventState.PushEvent(new UnlockPotionEvent(PotionType.PT_POISON_POTION), 1); EventState.PushEvent(new UnlockPotionEvent(PotionType.PT_INVIS_POTION), 2); EventState.PushEvent(new UnlockPotionEvent(PotionType.PT_LUCK_POTION), 3); // Starting feathers owned GameData.singleton.feathersOwned[(int)FeatherType.FT_GREEN_FEATHER] = 0; GameData.singleton.feathersOwned[(int)FeatherType.FT_PINK_FEATHER] = 0; GameData.singleton.feathersOwned[(int)FeatherType.FT_ORANGE_FEATHER] = 5; GameData.singleton.feathersOwned[(int)FeatherType.FT_BLUE_FEATHER] = 5; for (int i = 0; i < (int)FeatherType.FT_MAX; i++) { GameData.singleton.feathersUnlocked[i] = GameData.singleton.feathersOwned[i] > 0; } // Starting potions owned and prices for (int i = 0; i < GameData.singleton.potionsOwned.Length; ++i) { GameData.singleton.potionsOwned[i] = GameData.singleton.potionsUnlocked[i] ? 10 : 0; int numFeathersInRecipe = 0; foreach (FeatherAndCount feathAndCount in ((PotionType)i).GetIngredients()) { numFeathersInRecipe += feathAndCount.count; } GameData.singleton.potionPrices[i] = 25 * numFeathersInRecipe; GameData.singleton.quarterlyReportSalePrices[i] = 25 * numFeathersInRecipe; } InitWorldParams(); }
public void ShouldLoadPreviuosState() { var storeProvider = new Mock <IStoreProvider>(); storeProvider.Setup(sp => sp.Read(It.IsAny <string>())).Returns("{\"12345\": { \"Id\" : \"12345\", \"Sequence\": 6}}"); var eventState = EventState.Create(storeProvider.Object, new Settings()); var currentSeq = eventState.GetCurrentSequence("Tennis", "12345"); currentSeq.Should().Be(6); }
public bool Create(uint idMap) { if (!ServerKernel.Maps.TryGetValue(idMap, out m_pMap)) { ServerKernel.Log.SaveLog(string.Format("Could not load mapid:{0} to event", idMap), true, LogType.WARNING); return(false); } m_dwMapIdentity = idMap; m_bIsComplete = true; m_pState = EventState.IDLE; return(true); }
private bool onKeyboardShown(KeyboardEvents.KeyboardShown evt) { if (evt.Height > 0 && currentEventState == EventState.Pending) { currentEventState = EventState.Invalid; } else if (evt.Height > 0 && currentEventState == EventState.None) { CoroutineRunner.Start(handleKeyboardShown(), this, ""); } return(false); }
void OnTriggerExit2D(Collider2D collision) { if (collision.gameObject.layer == LayerMask.NameToLayer("Event") && !eventEnCours) { state = EventState.OUT_EVENT_ZONE; } if (collision.gameObject.layer == LayerMask.NameToLayer("House") || collision.gameObject.layer == LayerMask.NameToLayer("Hospital") || collision.gameObject.layer == LayerMask.NameToLayer("PoliceStation")) { isInSafeZone = false; } }
private void SaveEventState() { try { lock (_sync) EventState.WriteToFile(); } catch (Exception ex) { _logger.ErrorFormat("Event state errored on attempt to save it: {0}", ex); } }
public bool Create() { if (!ServerKernel.Maps.TryGetValue(_MAP_ID_U, out m_pMap)) { ServerKernel.Log.GmLog(_ERROR_FILE, "Could not load map on startup"); m_pState = EventState.ENDED; return(false); } if (!ParseMap()) { return(false); } var allRank = m_pRepo.FetchByType(_RANK_TYPE_U); if (allRank != null) { foreach (var rank in allRank.Where(x => x.PlayerIdentity == 0)) { m_pRanking.Add(rank.ObjectIdentity, rank); } foreach (var rank in allRank.Where(x => x.PlayerIdentity > 0)) { m_pUserRank.Add(rank.PlayerIdentity, rank); } } int weekday = (int)(DateTime.Now.DayOfWeek) % 7 == 0 ? 7 : (int)(DateTime.Now.DayOfWeek); int now = int.Parse(DateTime.Now.ToString("hhmmss")) + weekday * 1000000; //if (m_pState == EventState.IDLE && now >= _STARTUP_TIME && now < _END_TIME) //{ // m_bHasStarted = true; //} //else //{ // foreach (var rank in m_pRanking.Values) // { // rank.Value1 = 0; // rank.Value3 = 0; // Repository.SaveOrUpdate(rank); // } // foreach (var rank in m_pUserRank.Values) // { // rank.Value1 = 0; // rank.Value3 = 0; // Repository.SaveOrUpdate(rank); // } //} return(true); }
public void Enqueue(InternalSocialEvent internalEvent, XboxLiveUser user) { if (internalEvent == null) { throw new ArgumentNullException("internalEvent"); } if (internalEvent.Type == InternalSocialEventType.Unknown) { throw new ArgumentException("Unable to handle Unknown event type.", "internalEvent"); } SocialEventType eventType; switch (internalEvent.Type) { case InternalSocialEventType.UsersAdded: eventType = SocialEventType.UsersAddedToSocialGraph; break; case InternalSocialEventType.UsersRemoved: eventType = SocialEventType.UsersRemovedFromSocialGraph; break; case InternalSocialEventType.PresenceChanged: case InternalSocialEventType.DevicePresenceChanged: case InternalSocialEventType.TitlePresenceChanged: eventType = SocialEventType.PresenceChanged; break; case InternalSocialEventType.ProfilesChanged: eventType = SocialEventType.ProfilesChanged; break; case InternalSocialEventType.SocialRelationshipsChanged: eventType = SocialEventType.SocialRelationshipsChanged; break; case InternalSocialEventType.Unknown: case InternalSocialEventType.UsersChanged: // These events are not converted into public events. return; default: throw new ArgumentOutOfRangeException("internalEvent", internalEvent.Type, null); } SocialEvent evt = new SocialEvent(eventType, user, internalEvent.UserIdsAffected); this.events.Enqueue(evt); this.State = EventState.ReadyToRead; }
private async Task <int> UpdateEventStatus(Guid eventId, EventState status) { var sqlConnection = new MySqlConnection(_connectionString); await sqlConnection.OpenAsync(); using var connection = sqlConnection; return(await connection.ExecuteAsync( "UPDATE IntegrationEventLogEntry SET EventStateId = @stateId, " + "TimesSent = CASE WHEN EventStateId = @inProgress THEN TimesSent + 1 ELSE TimesSent END " + "WHERE Id = @id;", new { stateId = (int)status, inProgress = (int)EventState.InProgress, id = eventId })); }
private void CleanUpFixtureData(string fixtureId) { var fixtureState = EventState.GetFixtureState(fixtureId); FixtureOverview tempObj = null; _fixtures.TryRemove(fixtureId, out tempObj); if (fixtureState != null && fixtureState.MatchStatus == MatchStatus.MatchOver) { SaveState(); } }
/****** * * ******/ public void MakeEventChoice(Choice choice) { if (stateMachine_.currentState is EventState) { EventState state = (EventState)stateMachine_.currentState; choice.PerformChallengeSetResult(); // TODO deduct costs for the choice, update the inventory gameOver_ = ExecuteResult(choice.LastResult); state.MakeEventChoice(choice, gameOver_); DeductCosts(choice); } }
private void loadDefault() { defaultResource = new ResourceHandle("default", this); IEvent evt = new BasicEvent(); defaultResource.Load(evt); EventState state = evt.Wait(); if (state == EventState.Failed) { throw new NotSupportedException("Default Resource was not loaded properly"); } }
public static bool IsEventClose(int id) { EventState es = GetEventState(id); if (es == null) { return(false); } else { return(es.isClose); } }
public void Add(int partitionId, long?userId, EventType type, EventState state, byte[] data) { _executor.Execute( "[dbo].[Event_Add]", new { EventTypeId = type, data, StateId = state, partitionId, userId }); }
public Event(string name, DateTime time, TimeSpan _duration, ulong _hostID, string _iconUrl, string description, TimeSpan _repeatTime) { this.name = name; this.time = time; duration = _duration; hostID = _hostID; iconUrl = _iconUrl; repeatTime = _repeatTime; this.description = description; eventState = EventState.Awaiting; }
public void Add(int partitionId, long? userId, EventType type, EventState state, byte[] data) { _executor.Execute( "[dbo].[Event_Add]", new { EventTypeId = type, data, StateId = state, partitionId, userId }); }
public ActionResult EventRequestApprove(string eventId) { var EventIdApprove = Int32.Parse(eventId); EventState approvedState = db.EventStates.First(d => d.Name == "aceites"); Event update = db.Events.Include(v => v.EventState).First(d => d.Id == EventIdApprove); update.EventState = approvedState; db.SaveChanges(); //FALTA COLOCAR AQUI UMA MENSAGEM DE AVISO QUE O PEDIDO DE EVENTO FOI APROVADO return(Redirect("ShowRequestsList")); }
/// <summary> /// Obtain the arguments for an event. /// </summary> /// <param name="theEvent">The event.</param> /// <returns>The arguments.</returns> private int[] ObtainArgs(BayesianEvent theEvent) { var result = new int[theEvent.Parents.Count]; int index = 0; foreach (BayesianEvent parentEvent in theEvent.Parents) { EventState state = GetEventState(parentEvent); result[index++] = state.Value; } return(result); }
protected override EventResult OnStage(EventStage currentStage) { switch (currentStage) { case EventStage.START: EventState.currentEventText = "Your son runs up to you while you're at the counter."; EventState.currentEventOptions = EventState.CONTINUE_OPTION; mCurrentOptionOutcomes = new EventStage[] { EventStage.S1 }; break; case EventStage.S1: EventState.currentEventImage = "faceSonHappy"; EventState.currentEventText = "\"Daddy! What are you doing?\""; EventState.currentEventOptions = new string[] { "\"Making magical potions, dear.\"", "\"Adult stuff. Why don't you go play with mom?\"" }; mCurrentOptionOutcomes = new EventStage[] { EventStage.S2, EventStage.REFUSE }; break; case EventStage.S2: EventState.currentEventImage = "faceSonSurprise"; EventState.currentEventText = "Magical! Can you make one that makes me fly?!"; EventState.currentEventOptions = new string[] { "\"Why not try yourself?\"", "\"Maybe later. I'm busy right now.\"" }; mCurrentOptionOutcomes = new EventStage[] { EventStage.ACCEPT, EventStage.REFUSE }; break; case EventStage.ACCEPT: EventState.currentEventImage = ""; EventState.currentEventText = "Excited, he grabs some empty bottles and runs over to the cauldron."; EventState.currentEventOptions = EventState.OK_OPTION; GameData.singleton.sonRelationship += 10; EventState.PushEvent(new SonDropBottlesEvent(), GameData.singleton.quarter); return(EventResult.DONE); case EventStage.REFUSE: EventState.currentEventImage = "faceSonSad"; EventState.currentEventText = "\"Okayy.\" He walks upstairs, looking dejected."; EventState.currentEventOptions = EventState.OK_OPTION; GameData.singleton.sonRelationship -= 10; EventState.PushEvent(new SonEventTwo(), GameData.singleton.quarter + 2); return(EventResult.DONE); } return(EventResult.CONTINUE); }
protected virtual void OnQueueFull(EventWaitHandle waitHandle) { if (QueueFull != null && _size > 0) { T[] array = new T[_size]; int i = 0, j = 0, num = ((_tail < _head) ? _array.Length : _tail + 1) - _head; while (num-- > 0) { j = _head + i; array[i++] = _array[j]; _array[j] = null; } // If the head is above the tail we need to get the // elements that exists between the top of the queue and // the the tail. if (_tail < _head) { // when this method is called the tail points // to the last used slot and not to the next free slot. // So we need to include clean that node too. for (j = 0; j <= _tail; j++) { array[i++] = _array[j]; _array[j] = null; } } _tail = 0; _head = 0; _size = 0; // the event delegate will be executed in another thread EventState state = new EventState(QueueFull, array, waitHandle); ThreadPool.QueueUserWorkItem(delegate(object o) { EventState e = (EventState)o; e.handler(e.array); if (e.waithandle != null) { e.waithandle.Set(); } }, state); } else { waitHandle.Set(); } }
/// <summary> /// Default Constructor /// </summary> public MetaEventViewModel(MetaEvent metaEventData, EventsUserData userData) { this.metaEventData = metaEventData; this.UserData = userData; this.IsVisible = true; this.state = EventState.Unknown; var currentTime = DateTime.UtcNow.TimeOfDay; this.InitializeStagesAndTimers(currentTime); this.prevUpdateTimeUtc = currentTime; this.UserData.HiddenMetaEvents.CollectionChanged += (o, e) => this.RefreshVisibility(); }
private void SetState() { var state = EventState.Active; var listLabel = ""; var eventLabel = ""; var currentStageLabel = ""; var nextStageLabel = ""; var hoverLabel = Properties.Resources.ActiveFor; if (this.metaEventData is SingleMapMetaEvent) { eventLabel = this.metaEventData.MapName; currentStageLabel = this.CurrentStage.Name; nextStageLabel = this.NextStage.Name; } if (this.metaEventData is MultiMapMetaEvent) { eventLabel = this.metaEventData.Name; currentStageLabel = this.CurrentStage.MapName; nextStageLabel = this.NextStage.MapName; } if (this.CurrentStage.ID == MetaEventStageID.Inactive) { state = EventState.Inactive; currentStageLabel = ""; hoverLabel = Properties.Resources.InactiveFor; } if (!string.IsNullOrWhiteSpace(eventLabel)) { listLabel = eventLabel; if (!string.IsNullOrWhiteSpace(currentStageLabel)) { listLabel = string.Format(Properties.Resources.MetaEventLabel, eventLabel, currentStageLabel); } } if (this.NextStage.ID == MetaEventStageID.Inactive) { nextStageLabel = "ends"; } this.State = state; this.ListLabel = listLabel; this.EventLabel = eventLabel; this.CurrentStageLabel = currentStageLabel; this.NextStageLabel = nextStageLabel; this.HoverLabel = hoverLabel; }
/// <summary> /// Handles events from an event engine. This implementation propagates events through the /// component hierarchy to components that implement <see cref="IEventfulComponent"/>. /// </summary> /// <param name="context">The current game context.</param> /// <param name="eventEngine">The event engine from which the event was fired.</param> /// <param name="event">The event that is to be handled.</param> /// <returns>Whether or not the event was consumed.</returns> public virtual bool Handle(IGameContext context, IEventEngine <IGameContext> eventEngine, Event @event) { if (EnabledInterfaces.Contains(typeof(IEventfulComponent))) { var state = new EventState { Consumed = false }; _handleEvent.Invoke(context, eventEngine, @event, state); return(state.Consumed); } return(false); }
/// <summary> /// イベントの取得 /// ギミックから呼び出し /// </summary> /// <param name="arg_nextEvent">ギミックから呼び出したいイベントをセット</param> public void SetEvent(IEvent arg_nextEvent, GameObject arg_gimmick) { m_gimmick = arg_gimmick; m_currentEvent = arg_nextEvent; m_eventState = EventState.START; //初期化関数に置きたいです if (m_player == null) { m_player = GameObject.FindObjectOfType <Player>(); } }
public UnconfirmedEventNotificationRequest(uint processIdentifier, ObjectId initiatingDeviceIdentifier, ObjectId eventObjectIdentifier, TimeStamp timeStamp, uint notificationClass, byte priority, EventType eventType, Option<string> messageText, NotifyType notifyType, Option<bool> ackRequired, Option<EventState> fromState, EventState toState, Option<NotificationParameters> eventValues) { this.ProcessIdentifier = processIdentifier; this.InitiatingDeviceIdentifier = initiatingDeviceIdentifier; this.EventObjectIdentifier = eventObjectIdentifier; this.TimeStamp = timeStamp; this.NotificationClass = notificationClass; this.Priority = priority; this.EventType = eventType; this.MessageText = messageText; this.NotifyType = notifyType; this.AckRequired = ackRequired; this.FromState = fromState; this.ToState = toState; this.EventValues = eventValues; }
public IeSingleProtectionEvent(EventState eventState, bool elapsedTimeInvalid, bool blocked, bool substituted, bool notTopical, bool eventInvalid) { value = 0; switch (eventState) { case EventState.Off: value |= 0x01; break; case EventState.On: value |= 0x02; break; } if (elapsedTimeInvalid) { value |= 0x08; } if (blocked) { value |= 0x10; } if (substituted) { value |= 0x20; } if (notTopical) { value |= 0x40; } if (eventInvalid) { value |= 0x80; } }
public MouseEvent(EventState eventState, MouseInfo mouseInfo) : this(eventState, mouseInfo, new TPoint(0, 0)) { }
/// <summary> /// Set all events to random values, based on their probabilities. /// </summary> /// <param name="eventState">The event state.</param> private void RandomizeEvents(EventState eventState) { // first, has this event already been randomized if (!eventState.IsCalculated) { // next, see if we can randomize the event passed int[] args = ObtainArgs(eventState.Event); if (args != null) { eventState.Randomize(args); } } // randomize children foreach (BayesianEvent childEvent in eventState.Event.Children) { RandomizeEvents(GetEventState(childEvent)); } }
void Start() { _publicPhone = gameObject.GetComponentInChildren<EventState>(); _publicPhone._entry = TextPublicPhone; }
public StateWrapper(EventState item) { this.Item = item; }
public static PropertyStates NewState(EventState state) { return new StateWrapper(state); }
public MouseEvent(EventState eventState, MouseInfo mouseInfo, TPoint previousPosition) { m_curInfo = mouseInfo; m_state = eventState; m_previousPosition = previousPosition; }
public static extern EventState GameControllerEventState(EventState state);
public static extern EventState JoystickEventState(EventState enabled);
void Start() { state = gameObject.GetComponentInChildren<EventState>(); // state._entry = ; }
public String Start() { currentDialog = 0; currentElement = 0; validChoices.Clear(); validDialogs.Clear(); validElements.Clear(); if (orderedElements.Count == 0) state = EventState.END; state = EventState.DIALOG; return text; }
public KeyboardEvent(EventState state, TKey key, LockKey lockKey) { m_state = state; m_key = key; m_lockKey = lockKey; }
void Start() { _tutorial = gameObject.GetComponentInChildren<EventState>(); }
public List<Choice> GetChoices() { state = EventState.END; return validChoices; }
private void UpdateDisplay(Data.user user, Data.participant part, Data.fitevent evt, Data.sponsor sponsor, Data.sponsor[] sponsors, bool isParticipant, EventState eventState) { litEventName.Text = evt.name; litBegins.Text = string.Format("{0:MM/dd/yy}", evt.begins); litEnds.Text = string.Format("{0:MM/dd/yy}", evt.ends); decimal percent = 0; phSponsors.Visible = isParticipant; btnSettleEvent.Enabled = !evt.settled; phPledge.Visible = (!isParticipant && !evt.settled); phDonation.Visible = (!isParticipant && evt.settled); if(!isParticipant) { if(!evt.settled) { litPledgeAmount.Text = string.Format("{0:c}", sponsor.pledgeAmount); litPledgeUnit.Text = sponsor.pledgePerSteps.ToString(); litDonationMax.Text = string.Format("{0:c}", sponsor.donationMax); litPayMethodType.Text = sponsor.payMethodType; } else { var donation = sponsor.donations.SingleOrDefault(); if(donation != null) { litDonationAmount.Text = string.Format("{0:c}", donation.amount); } else { //TODO: Display something to indicate that transaction failed } } } switch(eventState) { case EventState.Before: phBeforeTop.Visible = true; litEstSteps.Text = evt.estimatedSteps.ToString(); phStepsToMax.Visible = isParticipant; litStepsToMax.Text = CalcStepsToMaxDonation(evt, sponsors); litEstDonations.Text = CalcEstDonations(evt, sponsors); phMaxDonations.Visible = isParticipant; litMaxDonations.Text = CalcMaxDonations(evt, sponsors); if(isParticipant) { PopulateSponsorPledgeList(phSponsors, sponsors); } else { } break; case EventState.During: phDuringTop.Visible = true; litRaisedDuring.Text = CalcRaised(part, evt, sponsors); litEstDonationsDuring.Text = CalcEstDonations(evt, sponsors); litStepsDuring.Text = part.stepsTaken.ToString(); litEstStepsDuring.Text = evt.estimatedSteps.ToString(); percent = CalcPercentToGoal(part, evt); pnlProgressBarDuringTop.Style["width"] = percent.ToString() + "%"; litPercentToGoalDuring.Text = percent.ToString(); litTimeRemaining.Text = CalcTimeRemaining(evt); if(isParticipant) { PopulateSponsorPledgeList(phSponsors, sponsors); } else { } break; case EventState.After: phAfterTop.Visible = true; litRaisedAfter.Text = CalcRaised(part, evt, sponsors); litStepsAfter.Text = part.stepsTaken.ToString(); litSuccessMessage.Text = GetSuccessMessage(isParticipant, part, evt, sponsors); litSettlementStatus.Text = GetSettlementStatus(evt, sponsors); percent = CalcPercentToGoal(part, evt); pnlProgressBarAfterTop.Style["width"] = percent.ToString() + "%"; litPercentToGoalAfter.Text = percent.ToString(); if(isParticipant) { if(evt.settled) PopulateSponsorDonationList(phSponsors, sponsors); else PopulateSponsorPledgeList(phSponsors, sponsors); } else { } break; } }
public Task EnqueueAsync(string id, EventState state, JObject data, JObject metadata) { AssertValidState(); var item = new WriteState { Data = data, State = state, Metadata = metadata, Id = id }; itemsToWrite.Enqueue(item); hasItems.Set(); return item.TaskCompletionSource.Task; }
public Dialog NextDialog() { if (currentDialog < validDialogs.Count) { return validDialogs[currentDialog++]; } else { state = EventState.CHOICES; return null; } }
/// <summary> /// Calculate the probability for a state. /// </summary> /// <param name="state">The state to calculate.</param> /// <returns>The probability.</returns> private double CalculateProbability(EventState state) { int[] args = ObtainArgs(state.Event); foreach (TableLine line in state.Event.Table.Lines) { if (line.CompareArgs(args)) { if (Math.Abs(line.Result - state.Value) < EncogFramework.DefaultDoubleEqual) { return line.Probability; } } } throw new BayesianError("Could not determine the probability for " + state); }
public ScriptElement NextElement() { if (currentElement < validElements.Count) { return validElements[currentElement++]; } else { state = EventState.CHOICES; return null; } }
private void SetComboBoxInitialValue() { eventState = EventState.LayoutChangeEvent; cboLanguage.SelectedIndex = 0; cboEditorial.SelectedIndex = 0; cboGenre.SelectedIndex = 0; cboAuthor.SelectedIndex = 0; cboLevel.SelectedIndex = 0; eventState = EventState.UserEvent; }