示例#1
0
 private void OnEscapePressed(EventTypeEnum type, object obj)
 {
     if (CanCloseScreen())
     {
         CloseCurrentScreen();
     }
 }
示例#2
0
        public async Task <int?> NewGameHost(int venueID, DateTime when, EventTypeEnum eventType, int limitOnNumberOfPlayers, List <int> invitees, string comments)
        {
            string url = WebApiUrl + "GameHosts/NewGameHost2";

            try
            {
                NewGameHostWebModel2 model = new NewGameHostWebModel2()
                {
                    VenueID = venueID,
                    When    = when.ToUniversalTime(),
                    When_InLocalTimeZone   = when,
                    EventType              = eventType,
                    LimitOnNumberOfPlayers = limitOnNumberOfPlayers,
                    Invitees = invitees,
                    Comments = comments,
                };
                string json = await this.sendPostRequestAndReceiveResponse(url, model, true);

                int modelResponse = JsonConvert.DeserializeObject <int>(json);
                return(modelResponse);
            }
            catch (Exception exc)
            {
                LastExceptionUrl = url;
                LastException    = exc;
                return(null);
            }
        }
        public EventCommandDetailsControl(EventCommand command)
        {
            this.command   = command;
            this.EventType = this.command.EventCommandType;

            InitializeComponent();
        }
示例#4
0
        public async Task PerformEvent(EventTypeEnum type, CommandParametersModel parameters)
        {
            if (this.CanPerformEvent(type, parameters))
            {
                UserViewModel user = parameters.User;
                if (user == null)
                {
                    user = ChannelSession.GetCurrentUser();
                }

                if (this.userEventTracking.ContainsKey(type))
                {
                    lock (this.userEventTracking)
                    {
                        this.userEventTracking[type].Add(user.ID);
                    }
                }

                await ChannelSession.Services.User.AddOrUpdateActiveUser(user);

                user.UpdateLastActivity();

                EventCommandModel command = this.GetEventCommand(type);
                if (command != null)
                {
                    Logger.Log(LogLevel.Debug, $"Performing event trigger: {type}");

                    await ChannelSession.Services.Command.Queue(command, parameters);
                }
            }
        }
示例#5
0
 private void checkWillListen(EventTypeEnum eventType)
 {
     if ((ListenableEvents & eventType) == 0)
     {
         throw new UnlistenableEventException();
     }
 }
#pragma warning disable CS0612 // Type or member is obsolete
        internal EventCommandModel(MixItUp.Base.Commands.EventCommand command)
            : base(command)
        {
            this.Name      = command.EventCommandType.ToString();
            this.Type      = CommandTypeEnum.Event;
            this.EventType = command.EventCommandType;
        }
示例#7
0
 public void Listen(ICollectionValue <T> list, EventTypeEnum listenTo)
 {
     this.listenTo = listenTo;
     if ((listenTo & EventTypeEnum.Changed) != 0)
     {
         list.CollectionChanged += new CollectionChangedHandler <T>(changed);
     }
     if ((listenTo & EventTypeEnum.Cleared) != 0)
     {
         list.CollectionCleared += new CollectionClearedHandler <T>(cleared);
     }
     if ((listenTo & EventTypeEnum.Removed) != 0)
     {
         list.ItemsRemoved += new ItemsRemovedHandler <T>(removed);
     }
     if ((listenTo & EventTypeEnum.Added) != 0)
     {
         list.ItemsAdded += new ItemsAddedHandler <T>(added);
     }
     if ((listenTo & EventTypeEnum.Inserted) != 0)
     {
         list.ItemInserted += new ItemInsertedHandler <T>(inserted);
     }
     if ((listenTo & EventTypeEnum.RemovedAt) != 0)
     {
         list.ItemRemovedAt += new ItemRemovedAtHandler <T>(removedAt);
     }
 }
 public KomodoOuting(EventTypeEnum eventType, decimal numberOfAttendees, DateTime dateOfEvent, decimal costPerPerson)
 {
     EventType = eventType;
     NumberOfAttendees = numberOfAttendees;
     DateOfEvent = dateOfEvent;
     CostPerPerson = costPerPerson;
 }
示例#9
0
        public static async Task ProcessDonationEvent(EventTypeEnum type, UserDonationModel donation, Dictionary <string, string> additionalSpecialIdentifiers = null)
        {
            EventTrigger trigger = new EventTrigger(type, donation.User);

            trigger.User.Data.TotalAmountDonated += donation.Amount;

            ChannelSession.Settings.LatestSpecialIdentifiersData[SpecialIdentifierStringBuilder.LatestDonationUserData]   = trigger.User.ID;
            ChannelSession.Settings.LatestSpecialIdentifiersData[SpecialIdentifierStringBuilder.LatestDonationAmountData] = donation.AmountText;

            trigger.SpecialIdentifiers = donation.GetSpecialIdentifiers();
            if (additionalSpecialIdentifiers != null)
            {
                foreach (var kvp in additionalSpecialIdentifiers)
                {
                    trigger.SpecialIdentifiers[kvp.Key] = kvp.Value;
                }
            }

            await ChannelSession.Services.Events.PerformEvent(trigger);

            foreach (StreamPassModel streamPass in ChannelSession.Settings.StreamPass.Values)
            {
                streamPass.AddAmount(donation.User.Data, (int)Math.Ceiling(streamPass.DonationBonus * donation.Amount));
            }

            try
            {
                GlobalEvents.DonationOccurred(donation);
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }
        }
示例#10
0
        public void GetTimeSummary_EventIsMissing_LogCritical(EventTypeEnum eventType)
        {
            #region Arrange
            // Create automocker container
            var mocker = new AutoMocker();

            // Set start point
            var startDateTime = SampleData.EventsStartDate;
            // Set time block for the calculation
            var timeBlock = new TimeBlock(startDateTime, startDateTime.AddDays(2));
            // Generate sample events. It is important to keep this method constant.
            var events = SampleData.Events;
            // Find event to be modified
            var eventToBeModified = events.First(x => x.CreatedAt.Date == startDateTime.Date && x.EventType == eventType);
            // Change specified event to be unknown
            eventToBeModified.EventType = EventTypeEnum.Unknown;

            #endregion

            #region Act
            var interactor = mocker.CreateInstance <TimeSummaryInteractor>();
            var summary    = interactor.GetTimeSummary(events, timeBlock);
            #endregion
            // verify that critical message was logged
            mocker.GetMock <ILogger <TimeSummaryInteractor> >()
            .Verify(x => x.Log(
                        LogLevel.Critical,
                        It.IsAny <EventId>(),
                        It.IsAny <It.IsAnyType>(),
                        It.IsAny <Exception>(),
                        (Func <It.IsAnyType, Exception, string>)It.IsAny <object>()), Times.AtLeastOnce);
        }
示例#11
0
        //Creates a new ViewModel using the selected Type
        public AdminEventEditViewModel CreateAdminEventEditViewModel(EventTypeEnum type)
        {
            AdminEventEditViewModel vm = new AdminEventEditViewModel
            {
                EventType = type
            };
            var events = eventRepository.GetAllEvents();

            switch (type)
            {
            case EventTypeEnum.Bands:
                vm.ObjectList = bandRepository.GetAllBands().ToList <object>();
                vm.AdminBand  = new AdminBand();
                break;

            case EventTypeEnum.Concerts:
                vm.ObjectList   = concertRepository.GetAllConcerts().ToList <object>();
                vm.AdminConcert = CreateAdminConcert();
                break;

            case EventTypeEnum.Restaurants:
                vm.ObjectList      = CreateAdminRestaurantList();
                vm.AdminRestaurant = CreateAdminRestaurant();
                break;

            case EventTypeEnum.Locations:
                vm.Location   = new Location();
                vm.ObjectList = locationRepository.GetAllLocations().ToList <object>();
                break;
            }

            return(vm);
        }
示例#12
0
        private static double GetDiference(this Transact transact, EventTypeEnum first, EventTypeEnum second)
        {
            var journal = transact.GetJournal();

            return(journal.Find(l => l.Event == second).Time.Time
                   - journal.Find(l => l.Event == first).Time.Time);
        }
示例#13
0
 /// <summary>
 /// Logs message to log.
 /// </summary>
 /// <param name="message">Message to log</param>
 /// <param name="ex">Possible exception to get message from</param>
 /// <param name="eventType">Type of the event</param>
 public void LogError(string message, Exception ex = null, EventTypeEnum eventType = EventTypeEnum.Error)
 {
     WriteToLog(DateTime.Now.ToString("[yyyy-MM-dd HH:mm:ss] ") + message);
     if (ex != null)
     {
         WriteToLog(LogHelper.GetExceptionLogMessage(ex));
     }
 }
示例#14
0
 private void AddEvent(int eventID, EventTypeEnum eventTypeEnum)
 {
     Events.Add(new MyEventLogEntry(MySession.Static.GameDateTime)
     {
         EventType   = eventTypeEnum,
         EventTypeID = eventID,
     });
 }
示例#15
0
 public TransactLog(ModelTime time, EventTypeEnum type)
 {
     Time = new ModelTime()
     {
         Time = time.Time
     };
     Event = type;
 }
示例#16
0
        public BasicEventCommandEditorControl(CommandWindow window, EventTypeEnum otherEventType, BasicCommandTypeEnum commandType)
        {
            this.window      = window;
            this.eventType   = otherEventType;
            this.commandType = commandType;

            InitializeComponent();
        }
示例#17
0
 public Event(string name, EventTypeEnum eventType,
              DateTime startTime, DateTime endTime)
 {
     Name      = name;
     EventType = eventType;
     StartTime = startTime;
     EndTime   = endTime;
 }
示例#18
0
 public static string Get(EventTypeEnum eventType)
 {
     switch (eventType)
     {
     case EventTypeEnum.SubscriptionValidationEvent: return(SubscriptionValidationEvent);
     }
     return(null);
 }
示例#19
0
 /// <summary>
 /// Logs message to log.
 /// </summary>
 /// <param name="message">Message to log</param>
 /// <param name="ex">Possible exception to get message from</param>
 /// <param name="eventType">Type of the event</param>
 public void LogError(string message, Exception ex = null, EventTypeEnum eventType = EventTypeEnum.Error)
 {
     if (ex != null)
     {
         message += Environment.NewLine + LogHelper.GetExceptionLogMessage(ex);
     }
     LogEvent(message, eventType);
 }
示例#20
0
 public bool Equals(EventTypeEnum obj)
 {
     if ((object)obj == null)
     {
         return(false);
     }
     return(StringComparer.OrdinalIgnoreCase.Equals(this.Value, obj.Value));
 }
示例#21
0
 public static MyGuiEventHelper GetEventHelper(EventTypeEnum eventType)
 {
     MyGuiEventHelper ret;
     if(m_eventHelpers.TryGetValue(eventType, out ret))
         return ret;
     else
         return null;
 }
示例#22
0
        public async Task <List <CrmEvent> > FilterEvents(EventTypeEnum eventType, int minutes)
        {
            var query = _repository.Query();

            query = query.Where(x => (x.EventType == eventType) && (x.IsSent == false) && ((DateTime.Now.Minute - x.Timestamp.Minute) < minutes));

            return(await Task.Run(() => query.ToList()));
        }
示例#23
0
    //public event EventHandler<EventArgsGeneric<Object>> Changed;

    private void OnChanged(EventTypeEnum eventType, object someObject)
    {
        //var handler = Changed;
        // if(handler != null)
        // {
        //     var args = new EventArgsGeneric<Object>(eventType, someObject);
        //     handler(this, args);
        //}
    }
示例#24
0
        public BasicEventCommandEditorControl(CommandWindow window, EventCommand command)
            : this(window, command.EventCommandType, BasicCommandTypeEnum.None)
        {
            this.window    = window;
            this.command   = command;
            this.eventType = this.command.EventCommandType;

            InitializeComponent();
        }
示例#25
0
 public void UnRegisterListener(EventTypeEnum eventType, EventListener listener)
 {
     if (eventListeners == null || eventListeners.ContainsKey(eventType) == false || eventListeners [eventType] == null)
     {
         //There are no listeners for this event
         return;
     }
     eventListeners [eventType].Remove(listener);
 }
示例#26
0
 public void AlertRiskOfficer(string assetPairId, string message, EventTypeEnum eventType)
 {
     var(slackChannelType, traceLevel) = _alertSeverityLevelService.GetLevel(eventType);
     Trace.Write(traceLevel, assetPairId, $"{nameof(AlertRiskOfficer)}: {message}", new {});
     if (!string.IsNullOrWhiteSpace(slackChannelType))
     {
         _slack.SendAsync(slackChannelType, "MT OrderbookAggregator", message);
     }
 }
示例#27
0
        public void OnLoadCompleteEvent(EventTypeEnum type, object obj)
        {
            EventController.GetInstance().UnregisterForEvent(
                EventTypeEnum.AssetsLoadMultipleComplete, OnLoadCompleteEvent);

            ScreenQueueManager.GetInstance().ClearQueueAndDestroyAllScreens();

            DialogController.GetInstance().StartConversation();
        }
示例#28
0
        public CommandEditorWindow(EventTypeEnum eventType)
            : this()
        {
            this.editorDetailsControl = new EventCommandEditorDetailsControl();
            this.DataContext          = this.ViewModel = this.viewModel = new EventCommandEditorWindowViewModel(eventType);

            this.ViewModel.StartLoadingOperationOccurred += (sender, eventArgs) => { this.StartLoadingOperation(); };
            this.ViewModel.EndLoadingOperationOccurred   += (sender, eventArgs) => { this.EndLoadingOperation(); };
        }
示例#29
0
 public CodeChallengeEventArgs(EventTypeEnum eventType, int lowerNumber, string lowerNumberText, int upperNumber, string upperNumberText)
 {
     EventType       = eventType.ToString();
     LowerNumber     = lowerNumber;
     LowerNumberText = lowerNumberText;
     UpperNumber     = upperNumber;
     UpperNumberText = upperNumberText;
     CombinedText    = lowerNumberText + " " + upperNumberText;
 }
示例#30
0
        private void SetHook(EventTypeEnum eventMin, EventTypeEnum eventMax = EventTypeEnum.Unknown)
        {
            if (eventMax == EventTypeEnum.Unknown)
            {
                eventMax = eventMin;
            }
            int item = WinApiLocal.SetWinEventHook(eventMin, eventMax, 0, this.DlgWinEventCallback, 0, this._threadId, 0u);

            this._instHookHandles.Add(item);
        }
        private void WriteMessage(string message, EventTypeEnum eventType)
        {
            _log.WriteInfoAsync("CheckConsistency", null, message);
            var slackChannelType = _alertSeverityLevelService.GetSlackChannelType(eventType);

            if (!string.IsNullOrWhiteSpace(slackChannelType))
            {
                _slackNotificationsSender.SendRawAsync(slackChannelType, nameof(ConsistencyMonitor), message);
            }
        }
示例#32
0
 private String CreatScript(EventTypeEnum evetType, String elementScript)
 {
     var script = new StringBuilder();
     if (!String.IsNullOrEmpty(elementScript))
     {
         script.Append(evetType.ToString());
         script.Append(CommonSeparator.EVNETTYPE);
         script.Append(elementScript);
         script.Append(CommonSeparator.SCRIPT);
     }
     return script.ToString();
 }
示例#33
0
 private static String ParseChange(EventTypeEnum eventType, String script, String instanceId, String invokerId, String eventName)
 {
     return "contexts.Invoke(\""
                 + instanceId
                 + "\", \""
                 + eventType.ToString()
                 + "\", \""
                 + invokerId
                 + "\", \""
                 + eventName
                 + "\", \""
                 + script
                 + "\");";
 }
示例#34
0
		private void _Fetch(SafeDataReader dr)
		{
			_ID = dr.GetInt32();
			_Name = dr.GetString();
			_ClassificationID = dr.GetInt32();
			_BeginDate = dr.GetDateTime();
			_EndDate = dr.GetDateTime();
			_EventType = (EventTypeEnum)dr.GetInt16();
			_TeamPlay = dr.GetBoolean();
		}
示例#35
0
 public EventListRequest EventType(EventTypeEnum eventType)
 {
     m_params.AddOpt("event_type", eventType);
     return this;
 }
示例#36
0
		private void Fetch(SafeDataReader dr)
		{
			//todo: load object data from data reader 
			//_TennisEvent = TennisObjects.TennisEvent.GetTennisEvent() 
			_ID = dr.GetInt32();
			_Name = dr.GetString();
			_startDate = dr.GetDateTime();
			_endDate = dr.GetDateTime();
			_eventType = (EventTypeEnum)dr.GetInt16();
			_teamPlay = dr.GetBoolean();
			_classificationID = dr.GetInt32();
			_classification = dr.GetString();
			_firstMatchDate = dr.GetDateTime();
			_lastMatchDate = dr.GetDateTime();
			_Matches.Won = dr.GetInt32();
			_Matches.Lost = dr.GetInt32();
			_Sets.Won = dr.GetInt32();
			_Sets.Lost = dr.GetInt32();
			_Games.Won = dr.GetInt32();
			_Games.Lost = dr.GetInt32();
		}
示例#37
0
 protected void SetEventType(EventTypeEnum type)
 {
     Event = type.ParseToString();
 }
示例#38
0
 /// <summary>
 /// Write an event in the event log.
 /// </summary>
 /// <param name="source">string: Event source.</param>
 /// <param name="eventType">EventTypeEnum: enumeration.</param>
 /// <param name="message">string: Event message.</param>
 internal static void WriteEventLogEntry(string source, EventTypeEnum eventType,
     string message)
 {
     Data.EventLogDsTableAdapters.EventLogTableAdapter tableAdapter =
         new iCampaign.TACS.Data.EventLogDsTableAdapters.EventLogTableAdapter();
     tableAdapter.Connection = new SqlConnection(TacsSession.ConnectionString);
     try
     {
         tableAdapter.Connection.Open();
         tableAdapter.WriteEventLogEntry(System.DateTime.Now, source,
             eventType.ToString(), message);
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         tableAdapter.Connection.Close();
     }
 }