Пример #1
0
        public MeritCriterion(MeritGoalType goal, ulong bound, EventType?eventType = null, MeritValueType?type = null)
        {
            if (!(bound > 0))
            {
                throw new Exception("The upper bound of a merit cannot be equal to or less than 0.");
            }

            Goal = goal;

            switch (Goal)
            {
            // MeritGoalType.Collect
            case MeritGoalType.Own:
                if (!type.HasValue)
                {
                    throw new Exception("MeritGoalType.Own requires that MeritValueType be used for its criterion.");
                }
                Type = type;
                break;

            case MeritGoalType.Event:
                if (!eventType.HasValue)
                {
                    throw new Exception("MeritGoalType.Event requires that EventType be used for its criterion.");
                }
                Event = eventType;
                break;
            } // add default?

            Bound = bound;
        }
Пример #2
0
        ///<summary>
        /// Retrieves the EventType field</summary>
        /// <returns>Returns nullable EventType enum representing the EventType field</returns>
        public EventType?GetEventType()
        {
            object    obj   = GetFieldValue(1, 0, Fit.SubfieldIndexMainField);
            EventType?value = obj == null ? (EventType?)null : (EventType)obj;

            return(value);
        }
Пример #3
0
 public HotkeyAttribute(KeyCode handledKey, EventModifiers newModifiers)
 {
     hotKey     = handledKey;
     eModifiers = newModifiers;
     eType      = null;
     priority   = 50;
 }
Пример #4
0
 public EventHandlerData(EventHandlerAttribute attri, Delegate delegateInfo)
 {
     eType     = attri.eType;
     priority  = attri.priority;
     eSpace    = attri.eSpace;
     actionDel = delegateInfo;
 }
Пример #5
0
        private StackLayout CreateStackWithEvent(EventType?eventType, int type)
        {
            StackLayout stack = new StackLayout
            {
                Orientation = StackOrientation.Vertical
            };

            if (type == 1)
            {
                foreach (Event ev in manager.activeEvents)
                {
                    stack.Children.Add(FormForEvent(ev));
                }
            }
            else if (eventType == null)
            {
                stack.Children.Add(CreateTiteForPage("Для данной категории нет событий", 20));
            }
            else
            {
                foreach (Event ev in manager.activeEvents)
                {
                    if (ev.Type == eventType)
                    {
                        stack.Children.Add(FormForEvent(ev));
                    }
                }
                if (stack.Children.Count == 0)
                {
                    stack.Children.Add(CreateTiteForPage("Для данной категории нет событий", 20));
                }
            }
            return(stack);
        }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of the UsageEvent class.
 /// </summary>
 public UsageEvent(string itemId = default(string), DateTime?timestamp = default(DateTime?), EventType?eventType = default(EventType?), double?weight = default(double?))
 {
     ItemId    = itemId;
     Timestamp = timestamp;
     EventType = eventType;
     Weight    = weight;
 }
Пример #7
0
 public HotkeyAttribute(KeyCode handledKey)
 {
     hotKey     = handledKey;
     eModifiers = null;
     eType      = null;
     priority   = 50;
 }
Пример #8
0
 public HotkeyAttribute(KeyCode handledKey, EventType LimitEventType)
 {
     hotKey     = handledKey;
     eModifiers = null;
     eType      = LimitEventType;
     priority   = 50;
 }
Пример #9
0
 public HotkeyAttribute(KeyCode handledKey, EventType LimitEventType, int priorityValue, EventModifiers newModifiers)
 {
     hotKey     = handledKey;
     eModifiers = newModifiers;
     eType      = LimitEventType;
     priority   = priorityValue;
 }
        /// <summary>
        ///    Handles a power state change.
        /// </summary>
        /// <param name = "batteryService">The battery service.</param>
        public void HandlePowerStateChange(IBatteryService batteryService)
        {
            // State change, make sure we're in a valid state
            if (batteryService.IsValidState)
            {
                if (_lastPowerEvent == null
                    // FSIGAP - just keep track of ac state changes.. battery level changes were causing battery/AC code to run
                    || _lastPowerEvent == EventType.SwitchToAc && batteryService.OnBattery || // changed from ac to on battery
                    _lastPowerEvent == EventType.SwitchToBattery && batteryService.OnAcPower     // changes from battery to on ac
                    )
                {
                    EventType eventType;
                    if (batteryService.OnAcPower)
                    {
                        eventType = EventType.SwitchToAc;
                    }
                    else
                    {
                        eventType = EventType.SwitchToBattery;
                    }

                    // Check the event state
                    //ProcessStateChange(eventType);
                    _lastPowerEvent = eventType;
                    // Execute all of the actions for this event if they are within the threshold
                    var batteryLifePercent = batteryService.GetSystemPowerStatus().BatteryLifePercent;
                    _profile.GetActionsForEvent(eventType)
                    .TakeWhile(a => batteryLifePercent >= (a.BatteryPercentMin) && batteryLifePercent <= (a.BatteryPercentMax))
                    .Each(a => a.Execute());
                }
            }
        }
Пример #11
0
        public IQueryable <Event> Get(EventType?type, bool includeAll = true)
        {
            switch (type)
            {
            case EventType.Concert:
            {
                return(ConcertRepository.Get(null, includeProperties: includeAll?_concertsIncludes: string.Empty));
            }

            case EventType.Exhibition:
            {
                return(ExhibitionRepository.Get(null, includeProperties: includeAll?_exhibitionsIncludes: string.Empty));
            }

            case EventType.Movie:
            {
                return(MovieRepository.Get(null, includeProperties: includeAll?_moviesIncludes: string.Empty));
            }

            case EventType.Performance:
            {
                return(PerformanceRepository.Get(null, includeProperties: includeAll?_performancesIncludes: string.Empty));
            }

            case EventType.Sport:
            {
                return(SportRepository.Get(null, includeProperties: includeAll?_sportIncludes: string.Empty));
            }

            default: return(GetAll(includeAll));
            }
        }
Пример #12
0
    private int GiveRandomAction(Effect item, EventType?eventType, int itemEffectBudget, bool isPositive = true, bool isAffectingGoodEntity = true)
    {
        EventType eventTypeSafe = eventType ?? (EventType)random.Next(1, Enum.GetValues(typeof(EventType)).Length);
        Action    action        = null;

        if (eventTypeSafe == EventType.ON_TICK)
        {
            int cooldown = random.Next(1, 1000);
            itemEffectBudget += itemEffectBudget * (cooldown - 500) / 500;
            action            = new CooldownAction(item, GenerateRandomAction(item, 0, ref itemEffectBudget, isPositive, isAffectingGoodEntity), item, cooldown);
        }

        else if (eventTypeSafe == EventType.ON_ACTIVATION)
        {
            action = new CooldownAction(item, GenerateRandomAction(item, 0, ref itemEffectBudget, isPositive, isAffectingGoodEntity), item);
        }
        else
        {
            action = GenerateRandomAction(item, 0, ref itemEffectBudget, isPositive, isAffectingGoodEntity);
        }
        if (item.actions.ContainsKey(eventTypeSafe))
        {
            item.actions[eventTypeSafe] = new MultiAction(item, action, item.actions[eventTypeSafe]);
        }
        else
        {
            item.actions.Add(eventTypeSafe, action);
        }


        return(itemEffectBudget);
    }
 private static void CallHotkeys(NodeEditorInputInfo inputInfo, KeyCode keyCode, EventModifiers mods)
 {
     object[] args = new object[1]
     {
         inputInfo
     };
     foreach (KeyValuePair <HotkeyAttribute, Delegate> hotkeyHandler in hotkeyHandlers)
     {
         if (hotkeyHandler.Key.handledHotKey == keyCode && (!hotkeyHandler.Key.modifiers.HasValue || hotkeyHandler.Key.modifiers == mods))
         {
             if (hotkeyHandler.Key.limitingEventType.HasValue)
             {
                 EventType?limitingEventType = hotkeyHandler.Key.limitingEventType;
                 if (limitingEventType.GetValueOrDefault() != inputInfo.inputEvent.type || !limitingEventType.HasValue)
                 {
                     continue;
                 }
             }
             hotkeyHandler.Value.DynamicInvoke(args);
             if (inputInfo.inputEvent.type == EventType.Used)
             {
                 break;
             }
         }
     }
 }
Пример #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LogEvent"/> class.
 /// </summary>
 /// <param name="type">event type</param>
 /// <param name="name">Name.</param>
 /// <param name="action">Action.</param>
 /// <param name="position">Position.</param>
 public LogEvent(EventType type, string name, string action, Vector3?position)
 {
     this.type     = type;
     this.name     = name;
     this.action   = action;
     this.position = position;
 }
 private static void CallEventHandlers(NodeEditorInputInfo inputInfo, bool late)
 {
     object[] args = new object[1]
     {
         inputInfo
     };
     foreach (KeyValuePair <EventHandlerAttribute, Delegate> eventHandler in eventHandlers)
     {
         if (eventHandler.Key.handledEvent.HasValue)
         {
             EventType?handledEvent = eventHandler.Key.handledEvent;
             if (handledEvent.GetValueOrDefault() != inputInfo.inputEvent.type || !handledEvent.HasValue)
             {
                 continue;
             }
         }
         if ((!late) ? (eventHandler.Key.priority < 100) : (eventHandler.Key.priority >= 100))
         {
             eventHandler.Value.DynamicInvoke(args);
             if (inputInfo.inputEvent.type == EventType.Used)
             {
                 break;
             }
         }
     }
 }
Пример #16
0
 public EventHandlerData(Delegate delegateInfo)
 {
     eType     = null;
     priority  = 50;
     eSpace    = EventSpace.Everything;
     actionDel = delegateInfo;
 }
 /// <summary>
 /// Constructor for ImportEventStatus
 /// </summary>
 /// <param name="importerId">
 ///<summary>
 /// TBD
 ///</summary>
 /// </param>
 /// <param name="eventType">
 ///<summary>
 /// TBD
 ///</summary>
 /// </param>
 /// <param name="status">
 ///<summary>
 /// TBD
 ///</summary>
 /// </param>
 /// <param name="recordCount">
 ///<summary>
 /// TBD
 ///</summary>
 /// </param>
 public ImportEventStatus(string importerId, EventType?eventType, Status?status, long?recordCount)
 {
     this.ImporterId  = importerId;
     this.EventType   = eventType;
     this.Status      = status;
     this.RecordCount = recordCount;
 }
Пример #18
0
        void SendMetadataUpdateUpdateV2(int Change, string Project, string UserName, EventType?Event, string Comment)
        {
            UpdateMetadataRequestV2 Update = new UpdateMetadataRequestV2();

            Update.Stream   = MetadataStream;
            Update.Project  = MetadataProject;
            Update.Change   = Change;
            Update.UserName = UserName;

            if (Event != null)
            {
                switch (Event)
                {
                case EventType.Syncing:
                    Update.Synced = true;
                    break;

                case EventType.Compiles:
                    Update.Vote = nameof(UgsUserVote.CompileSuccess);
                    break;

                case EventType.DoesNotCompile:
                    Update.Vote = nameof(UgsUserVote.CompileFailure);
                    break;

                case EventType.Good:
                    Update.Vote = nameof(UgsUserVote.Good);
                    break;

                case EventType.Bad:
                    Update.Vote = nameof(UgsUserVote.Bad);
                    break;

                case EventType.Unknown:
                    Update.Vote = nameof(UgsUserVote.None);
                    break;

                case EventType.Starred:
                    Update.Starred = true;
                    break;

                case EventType.Unstarred:
                    Update.Starred = false;
                    break;

                case EventType.Investigating:
                    Update.Investigating = true;
                    break;

                case EventType.Resolved:
                    Update.Investigating = false;
                    break;
                }
            }
            Update.Comment = Comment;

            RESTApi.POST(ApiUrl, "metadata", new JavaScriptSerializer().Serialize(Update));
        }
Пример #19
0
 public HotKeyHandlerData(HotkeyAttribute attri, Delegate delegateInfo)
 {
     hotKey     = attri.hotKey;
     eModifiers = attri.eModifiers;
     eType      = attri.eType;
     priority   = attri.priority;
     eSpace     = attri.eSpace;
     actionDel  = delegateInfo;
 }
Пример #20
0
 /// <summary>
 /// Stream calendar events.
 /// </summary>
 /// <param name="userId">(Optional) The user to filter by.</param>
 /// <param name="type">(Optional) The event type to filter by.</param>
 /// <param name="startDate">(Optional) The beginning of the date range to search.</param>
 /// <param name="endDate">(Optional) The end of the date range to search.</param>
 /// <param name="undated">(Optional) Allow undated events.</param>
 /// <param name="allEvents">(Optional) Include all events.</param>
 /// <param name="contexts">Event contexts to search.</param>
 /// <returns></returns>
 public async IAsyncEnumerable <CalendarEvent> StreamCalendarEvents(ulong?userId       = null,
                                                                    EventType?type     = null,
                                                                    DateTime?startDate = null,
                                                                    DateTime?endDate   = null,
                                                                    bool?undated       = null,
                                                                    bool?allEvents     = null,
                                                                    IEnumerable <EventContext> contexts = null)
 {
     IEnumerable <(string, string)> a = new[] {
Пример #21
0
        private async Task ReplaceAndUpdateCache(Organization org, EventType?orgEvent = null)
        {
            await _organizationRepository.ReplaceAsync(org);

            if (orgEvent.HasValue)
            {
                await _eventService.LogOrganizationEventAsync(org, orgEvent.Value);
            }
        }
 private void ProcessStateChange(EventType eventType)
 {
     if (_lastEvent != null && eventType != _lastEvent)
     {
         // We have an event change, reset all of the actions (specifically we want to revert
         // the HasExecuted flag so we will reexecute actions for battery percent events
         ResetActions();
     }
     _lastEvent = eventType;
 }
Пример #23
0
 /// <summary>
 /// Initializes a new instance of the EventModel class.
 /// </summary>
 /// <param name="level">Possible values include: 'Silent', 'Info',
 /// 'Warning', 'Highlight', 'Error'</param>
 /// <param name="type">Possible values include: 'Normal',
 /// 'Download'</param>
 public EventModel(int?id = default(int?), System.DateTime?time = default(System.DateTime?), string message = default(string), EventLevel?level = default(EventLevel?), EventType?type = default(EventType?), string context = default(string))
 {
     Id      = id;
     Time    = time;
     Message = message;
     Level   = level;
     Type    = type;
     Context = context;
     CustomInit();
 }
Пример #24
0
 public FitActivity(ActivityMesg msg)
 {
     Event          = msg.GetEvent();
     EventGroup     = msg.GetEventGroup();
     EventType      = msg.GetEventType();
     LocalTimestamp = msg.GetLocalTimestamp();
     NumSessions    = msg.GetNumSessions();
     Timestamp      = FitFile.GetDateTime(msg.GetTimestamp());
     TotalTimerTime = FitFile.GetTimeSpan(msg.GetTotalTimerTime());
     Type           = msg.GetType();
 }
Пример #25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="opal.LogEvent"/> class.
 /// </summary>
 /// <param name="type">Type.</param>
 /// <param name="name">Name.</param>
 /// <param name="nameTwo">Name two.</param>
 /// <param name="action">Action.</param>
 /// <param name="position">Position.</param>
 /// <param name="positionTwo">Position two.</param>
 /// <param name="message">Message.</param>
 public LogEvent(EventType type, string name, string nameTwo, string action,
                 Vector3?position, Vector3?positionTwo, string message)
 {
     this.type        = type;
     this.name        = name;
     this.action      = action;
     this.position    = position;
     this.positionTwo = positionTwo;
     this.nameTwo     = nameTwo;
     this.message     = message;
 }
Пример #26
0
 public virtual EventInfo Clone(RulesEngine engine = null, EventType?type = null, DataDirection?direction = null, Message message = null, ProxyConnection proxyConnection = null, Variables variables = null)
 {
     return(new EventInfo()
     {
         Engine = engine ?? Engine,
         Type = type ?? Type,
         Direction = direction ?? Direction,
         Message = message ?? Message,
         ProxyConnection = proxyConnection ?? ProxyConnection,
         Variables = variables ?? Variables
     });
 }
Пример #27
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="transactionId">Your internal ID for the transaction.
 /// We can use this to locate a specific transaction in our logs, and
 /// it will also show up in email alerts and notifications from us to
 /// you.</param>
 /// <param name="shopId">Your internal ID for the shop, affiliate, or
 /// merchant this order is coming from. Required for minFraud users
 /// who are resellers, payment providers, gateways and affiliate
 /// networks.</param>
 /// <param name="time">The date and time the event occurred. If this
 /// field is not in the request, the current time will be used.</param>
 /// <param name="type">The type of event being scored.</param>
 public Event(
     string?transactionId = null,
     string?shopId        = null,
     DateTimeOffset?time  = null,
     EventType?type       = null
     )
 {
     TransactionId = transactionId;
     ShopId        = shopId;
     Time          = time;
     this.Type     = type;
 }
Пример #28
0
        public List <Event> GetEventFromDate(DateTime?dateStart, DateTime?dateEnd, EventType?eventType)
        {
            var events = db.Events
                         .ToList();

            return(dateStart == null && dateEnd == null && eventType != null
                ? events.FindAll(e => e.EventType == eventType)
                : (dateStart != null && dateEnd == null && eventType != null
                  ? events.FindAll(e => e.EventType == eventType && e.Date > (DateTime)dateStart)
                  : (dateStart != null && dateEnd != null && eventType != null
                    ? events.FindAll(e => e.Date > (DateTime)dateStart && e.Date < (DateTime)dateEnd && e.EventType == eventType)
                    : events.FindAll(e => dateEnd != null && (dateStart != null && (e.Date > (DateTime)dateStart && e.Date < (DateTime)dateEnd))))));
        }
Пример #29
0
 /// <summary>
 /// Generic exception, with meta-data for logging.
 /// </summary>
 /// <param name="Message">Free-text event message.</param>
 /// <param name="Type">Event Type.</param>
 /// <param name="Object">Object related to the event.</param>
 /// <param name="Actor">Actor responsible for the action causing the event.</param>
 /// <param name="EventId">Computer-readable Event ID identifying type of even.</param>
 /// <param name="Level">Event Level.</param>
 /// <param name="Facility">Facility can be either a facility in the network sense or in the system sense.</param>
 /// <param name="Module">Module where the event is reported.</param>
 /// <param name="Tags">Variable set of tags providing event-specific information.</param>
 public GenericException(string Message, EventType?Type = null, string Object = null, string Actor  = null, string EventId = null,
                         EventLevel?Level = null, string Facility             = null, string Module = null, params KeyValuePair <string, object>[] Tags)
     : base(Message)
 {
     this.Type     = Type;
     this.Object   = Object;
     this.Actor    = Actor;
     this.EventId  = EventId;
     this.Level    = Level;
     this.Facility = Facility;
     this.Module   = Module;
     this.Tags     = Tags;
 }
Пример #30
0
 /// <summary>
 /// Initializes a new instance of the DownloadEvent class.
 /// </summary>
 /// <param name="progress">Possible values include: 'Portion',
 /// 'Complete'</param>
 /// <param name="level">Possible values include: 'Silent', 'Info',
 /// 'Warning', 'Highlight', 'Error'</param>
 /// <param name="type">Possible values include: 'Normal',
 /// 'Download'</param>
 public DownloadEvent(string fileName = default(string), string fileContents = default(string), DownloadProgress?progress = default(DownloadProgress?), int?id = default(int?), System.DateTime?time = default(System.DateTime?), string message = default(string), EventLevel?level = default(EventLevel?), EventType?type = default(EventType?), string context = default(string))
 {
     FileName     = fileName;
     FileContents = fileContents;
     Progress     = progress;
     Id           = id;
     Time         = time;
     Message      = message;
     Level        = level;
     Type         = type;
     Context      = context;
     CustomInit();
 }