These values are for events defined by Photon Loadbalancing.
They start at 255 and go DOWN. Your own in-game events can start at 0.
Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pGroup">Timeline group info</param>
        /// <param name="pCallback">Client callback</param>
        /// <param name="pEventSink">Event sync to call on file complete</param>
        /// <param name="ec">Event code to send on file completion</param>
        public AVCallback(
            MediaGroup pGroup,
            IDESCombineCB pCallback,
            IMediaEventSink pEventSink,
            EventCode ec
            )
        {
            m_pCallback  = pCallback;
            m_Group      = pGroup;
            m_pEventSink = pEventSink;
            m_ec         = ec;

            m_iCurFrame = 0;
            m_iCurFile  = 0;
            MediaFile mf = m_Group.File(m_iCurFile);

            if (mf != null)
            {
                m_CurFileName = mf.FileName;
                m_iMaxFrame   = mf.LengthInFrames;
            }
            else
            {
                m_CurFileName = null;
                m_iMaxFrame   = int.MaxValue;
            }
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pDESGroup">Timeline DESGroup info</param>
        /// <param name="pCallback">Client callback</param>
        /// <param name="pEventSink">Event sync to call on file complete</param>
        /// <param name="ec">Event code to send on file completion</param>
        public DESCallback(
            DESGroup pDESGroup,
            IDESCombineCB pCallback,
            IMediaEventSink pEventSink,
            EventCode ec,
            List <Layer> myDS
            )
        {
            m_pCallback  = pCallback;
            m_DESGroup   = pDESGroup;
            m_pEventSink = pEventSink;
            m_ec         = ec;
            MarqueeDS    = myDS;
            m_iCurFrame  = 0;
            m_iCurFile   = 0;
            MediaFile mf = m_DESGroup.File(m_iCurFile);

            if (mf != null)
            {
                m_CurFileName = mf.FileName;
                m_iMaxFrame   = mf.LengthInFrames;
            }
            else
            {
                m_CurFileName = null;
                m_iMaxFrame   = int.MaxValue;
            }
            OffsetArrX = new float[MarqueeDS.Count];
            OffsetArrY = new float[MarqueeDS.Count];
        }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pGroup">Timeline group info</param>
        /// <param name="pCallback">Client callback</param>
        /// <param name="pEventSink">Event sync to call on file complete</param>
        /// <param name="ec">Event code to send on file completion</param>
        public CallbackHandler(
            IGroup pGroup,
            IDESCombineCB pCallback,
            IMediaEventSink pEventSink,
            EventCode ec
            )
        {
            m_pCallback  = pCallback;
            m_Group      = pGroup;
            m_pEventSink = pEventSink;
            m_ec         = ec;

            m_iCurFrame = 0;
            m_iCurFile  = 0;
            // TODO: fix this or chuck it
            MediaFile mf = null; // m_Group.File(m_iCurFile);

            if (mf != null)
            {
                m_CurFileName = mf.FileName;
                m_iMaxFrame   = mf.LengthInFrames;
            }
            else
            {
                m_CurFileName = null;
                m_iMaxFrame   = int.MaxValue;
            }
        }
Example #4
0
        public void ExcuteEventMode(EventCode code)
        {
            var gameEvent = eventTable[code];

            gameEvent.ExcuteGameEvent();
            return;
        }
 internal void EnterState(VirtualStackFrame newFrame)
 {
     this.eventCode = EventCode.Enter;
     this.enterStackParameter = newFrame;
     this.eventSend.Set();
     this.eventDone.WaitOne();
 }
Example #6
0
        public void Subscribe(EventCallback callback)
        {
            NativeImports.TIO_DATA start = new NativeImports.TIO_DATA();// = NativeImports.TioDataConverter.FromObject(null);

            NativeImports.tio_container_subscribe(
                _nativeContainerHandle,
                ref start,
                delegate(int result,
                         IntPtr cookie,
                         IntPtr handle,
                         uint eventCode,
                         ref NativeImports.TIO_DATA key,
                         ref NativeImports.TIO_DATA value,
                         ref NativeImports.TIO_DATA metadata)
            {
                EventCode convertedEventCode = (EventCode)eventCode;

                callback(
                    convertedEventCode,
                    NativeImports.TioDataConverter.ToObject(key),
                    NativeImports.TioDataConverter.ToObject(value),
                    NativeImports.TioDataConverter.ToObject(metadata));
            },
                IntPtr.Zero);
        }
 //四个参数 发送消息
 public void SendMsg <T, X, Y, Z>(EventCode eventCode, T arg0, X arg1, Y arg2, Z arg3)
 {
     if (eventList.TryGetValue(eventCode, out Delegate d))
     {
         (d as Action <T, X, Y, Z>)?.Invoke(arg0, arg1, arg2, arg3);
     }
 }
        private void ControllerOnChannelColorChanged(bool fromView, EventCode code, Color color)
        {
            var btn = _channelSettings.Find(it => it.Code == code).ButtonColor;

            btn.BackColor = color;
            btn.Text      = color.ToHexString();
        }
Example #9
0
    /// <summary>
    /// 
    /// </summary>
    /// <param name="pGroup">Timeline group info</param>
    /// <param name="pCallback">Client callback</param>
    /// <param name="pEventSink">Event sync to call on file complete</param>
    /// <param name="ec">Event code to send on file completion</param>
    public AVCallback(
        MediaGroup pGroup,
        IDESCombineCB pCallback,
        IMediaEventSink pEventSink,
        EventCode ec
        )
    {
      m_pCallback = pCallback;
      m_Group = pGroup;
      m_pEventSink = pEventSink;
      m_ec = ec;

      m_iCurFrame = 0;
      m_iCurFile = 0;
      MediaFile mf = m_Group.File(m_iCurFile);
      if (mf != null)
      {
        m_CurFileName = mf.FileName;
        m_iMaxFrame = mf.LengthInFrames;
      }
      else
      {
        m_CurFileName = null;
        m_iMaxFrame = int.MaxValue;
      }
    }
Example #10
0
        /// <summary>
        /// Adds an audit record to [EventCodesAudit] table.
        /// </summary>
        /// <param name="itemToAudit"><see cref="EventCode"/> instance to add to audit table.</param>
        public void Audit(EventCode itemToAudit)
        {
            // Get out if nothing to audit.
            if (itemToAudit == null)
            {
                return;
            }

            EventCodesAudit audit = new EventCodesAudit();

            audit.CustomerID       = itemToAudit.CustomerID;
            audit.EventSource      = itemToAudit.EventSource;
            audit.EventCode        = itemToAudit.EventCode1;
            audit.AlarmTier        = itemToAudit.AlarmTier;
            audit.EventDescAbbrev  = itemToAudit.EventDescAbbrev;
            audit.EventDescVerbose = itemToAudit.EventDescVerbose;
            audit.SLAMinutes       = itemToAudit.SLAMinutes;
            audit.IsAlarm          = itemToAudit.IsAlarm;
            audit.EventType        = itemToAudit.EventType;
            audit.ApplySLA         = itemToAudit.ApplySLA;
            audit.EventCategory    = itemToAudit.EventCategory;

            audit.UserId          = WebSecurity.CurrentUserId;
            audit.UpdatedDateTime = DateTime.Now;

            PemsEntities.EventCodesAudits.Add(audit);
            PemsEntities.SaveChanges();
        }
Example #11
0
    //服务器端向客户端直接发起的请求、通知   (事件分发器)
    public void OnEvent(EventData eventData)
    {
        EventCode code      = (EventCode)eventData.Code;
        BaseEvent baseEvent = DictTool.GetValue <EventCode, BaseEvent>(EventDict, code);

        baseEvent.OnEvent(eventData);
    }
Example #12
0
        /// <summary>
        /// Waits for the specified event.
        /// </summary>
        /// <param name="eventCode">event code to wait for</param>
        /// <param name="msTimeout">timeout</param>
        /// <returns>True if the event was received. False if timed out, or different event received</returns>
        public bool WaitForEvent(EventCode eventCode, int msTimeout)
        {
            EventCode waste1;
            int       waste2;

            return(WaitForEvent(eventCode, msTimeout, out waste1, out waste2));
        }
Example #13
0
 public bool RaiseEvent(EventCode eventCode, object eventContent)
 {
     return(PhotonNetwork.RaiseEvent((byte)eventCode, eventContent, true, new RaiseEventOptions()
     {
         CachingOption = EventCaching.AddToRoomCache, Receivers = ReceiverGroup.All
     }));
 }
        public void GetNothingActionIfNoEventIsScheduled()
        {
            // arrange
            instrument     = Helper.GetInstrumentForTest(DeviceType.VPRO, DeviceSubType.VentisPro4);
            dockingStation = Helper.GetDockingStationForTest(DeviceType.MX4);
            InstrumentAlarmEventsClearOperation operation = new InstrumentAlarmEventsClearOperation();

            List <EventJournal> eventJournals = new List <EventJournal>();

            eventJournals.Add(new EventJournal(EventCode.GetCachedCode(EventCode.InstrumentDiagnostics), instrument.SerialNumber, DateTime.Now.AddMonths(-1), DateTime.Now.AddMonths(-1), true, instrument.SoftwareVersion));

            _eventJournalDataAccess.Setup(x => x.FindBySerialNumbers(It.IsAny <string[]>(), It.IsAny <IDataAccessTransaction>())).Returns(eventJournals);
            _eventJournalDataAccess.Setup(x => x.FindLastEventByInstrumentSerialNumber(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <IDataAccessTransaction>())).Returns(eventJournals);

            Initialize();

            // act
            schema.Setup(x => x.Activated).Returns(true);
            dsEvent = new InstrumentAlarmEventsClearEvent(operation);
            CreateMasterForTest();
            nextAction = scheduler.GetNextAction(dsEvent);

            // assert
            Xunit.Assert.True(nextAction is NothingAction);
        }
Example #15
0
 static void OnReaderEvent(EventCode code)
 {
     if (null != ReaderEvent)
     {
         ReaderEvent(code);
     }
 }
        public void GetScheduledInstrumentAlarmEventDownloadAction()
        {
            // arrange
            instrument     = Helper.GetInstrumentForTest(DeviceType.VPRO, DeviceSubType.VentisPro4);
            dockingStation = Helper.GetDockingStationForTest(DeviceType.MX4);
            InstrumentAlarmEventsDownloadOperation operation = new InstrumentAlarmEventsDownloadOperation();

            List <EventJournal> eventJournals = new List <EventJournal>();

            eventJournals.Add(new EventJournal(EventCode.GetCachedCode(EventCode.InstrumentDiagnostics), instrument.SerialNumber, DateTime.Now.AddMonths(-1), DateTime.Now.AddMonths(-1), true, instrument.SoftwareVersion));
            eventJournals.Add(new EventJournal(EventCode.GetCachedCode(EventCode.DownloadAlarmEvents), instrument.SerialNumber, DateTime.Now.AddMonths(-1), DateTime.Now.AddMonths(-1), true, instrument.SoftwareVersion));

            _eventJournalDataAccess.Setup(x => x.FindBySerialNumbers(It.IsAny <string[]>(), It.IsAny <IDataAccessTransaction>())).Returns(eventJournals);
            _eventJournalDataAccess.Setup(x => x.FindLastEventByInstrumentSerialNumber(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <IDataAccessTransaction>())).Returns(eventJournals);

            _scheduleDailyAccess.Setup(x => x.FindGlobalSchedules(It.IsAny <IDataAccessTransaction>())).Returns(new List <Schedule>()
            {
                new ScheduledDaily(DomainModelConstant.NullId, DomainModelConstant.NullId, string.Empty, EventCode.GetCachedCode(EventCode.DownloadAlarmEvents), EquipmentTypeCode.Instrument, string.Empty, true, true, 1, DateTime.Now.AddYears(-1), new TimeSpan(9, 0, 0))
            });

            Initialize();

            // act
            schema.Setup(x => x.Activated).Returns(true);
            dsEvent = new InstrumentAlarmEventsDownloadEvent(operation);
            CreateMasterForTest();
            nextAction = scheduler.GetNextAction(dsEvent);

            // assert
            Xunit.Assert.True(nextAction is InstrumentAlarmEventsDownloadAction);
        }
        public void GetCalibrationActionForSensorRemoved()
        {
            // arrange
            InstrumentCalibrationAction action = new InstrumentCalibrationAction();

            instrument = Helper.GetInstrumentForTest(DeviceType.VPRO, DeviceSubType.VentisPro4);
            List <InstalledComponent> installedComponents = Helper.GetSensorsForTest(new List <string>()
            {
                GasCode.CO, GasCode.H2S, GasCode.O2, GasCode.CombustibleLEL
            });

            dockingStation = Helper.GetDockingStationForTest(DeviceType.MX4);

            List <EventJournal> eventJournals = new List <EventJournal>();

            eventJournals.Add(new EventJournal(EventCode.GetCachedCode(EventCode.InstrumentDiagnostics), instrument.SerialNumber, DateTime.Now.AddMonths(-1), DateTime.Now.AddMonths(-1), true, instrument.SoftwareVersion));
            installedComponents.ForEach(comp => eventJournals.Add(new EventJournal(EventCode.Calibration, comp.Component.Uid, instrument.SerialNumber, DateTime.Now.AddMonths(-1), DateTime.Now.AddMonths(-1), true, comp.Position, instrument.SoftwareVersion)));
            installedComponents.Remove(installedComponents.Last());
            instrument.InstalledComponents.AddRange(installedComponents);
            _eventJournalDataAccess.Setup(x => x.FindBySerialNumbers(It.IsAny <string[]>(), It.IsAny <IDataAccessTransaction>())).Returns(eventJournals);
            _eventJournalDataAccess.Setup(x => x.FindLastEventByInstrumentSerialNumber(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <IDataAccessTransaction>())).Returns(eventJournals);

            Initialize();

            // act
            CreateMasterForTest();
            schema.Setup(x => x.Activated).Returns(true);
            InstrumentCalibrationOperation operation = new InstrumentCalibrationOperation(action);

            dsEvent    = new InstrumentCalibrationEvent(operation);
            nextAction = scheduler.GetNextAction(dsEvent);

            // assert
            Xunit.Assert.True(nextAction is InstrumentCalibrationAction);
        }
Example #18
0
    private void RPCEventReceived(EventCode messageCode, int senderId, params object[] additionalParams)
    {
        string message = GetMessage(messageCode, senderId, additionalParams);

        messageQueue.Enqueue(message);
        incomingNewMessage = true;
    }
 //如果消息ID没有对应的委托,就直接移除消息ID
 private void RemoveMsgKey(EventCode eventCode)
 {
     if (null == eventList[eventCode])
     {
         eventList.Remove(eventCode);
     }
 }
Example #20
0
        /// <summary>
        /// Waits for the specified event.
        /// </summary>
        /// <param name="desiredEventCode">event code to wait for</param>
        /// <param name="msTimeout">timeout</param>
        /// <param name="actuallyReceivedEventCode">The event actually received, or "0" if no event was received</param>
        /// <param name="param">1st parameter associated with event</param>
        /// <returns>True if the desired event was received. False if timed out, or different event received</returns>
        public bool WaitForEvent(EventCode desiredEventCode, int msTimeout, out EventCode actuallyReceivedEventCode, out int param)
        {
            bool restartTimer = false;

            if (_mediaSeekTimer.Enabled)
            {
                _mediaSeekTimer.Stop();
                restartTimer = true;
            }

            int    hr = 0;
            IntPtr lparam1, lparam2;

            hr = _mediaEvent.GetEvent(out actuallyReceivedEventCode, out lparam1, out lparam2, msTimeout);
            if (DsError.Succeeded(hr))
            {
                Debug.WriteLine("WaitForEvent got " + actuallyReceivedEventCode.ToString() + " 0x" + lparam1.ToString("X") + " 0x" + lparam2.ToString("X"));
                param = lparam1.ToInt32();
                _mediaEvent.FreeEventParams(actuallyReceivedEventCode, lparam1, lparam2);
            }
            else
            {
                actuallyReceivedEventCode = 0;
                param = 0;
            }

            if (restartTimer)
            {
                _mediaSeekTimer.Start();
            }

            return(DsError.Succeeded(hr) && (actuallyReceivedEventCode == desiredEventCode));
        }
Example #21
0
        public void OnEvent(EventData eventData)
        {
            EventCode code         = (EventCode)eventData.Code;
            EventBase eventHnadler = DictTool.GetValue <EventCode, EventBase>(dic_Event, code);

            eventHnadler.OnEvent(eventData);

            //switch (eventData.Code)
            //{
            //    case 1:
            //        Dictionary<byte, object> data = eventData.Parameters;
            //        object intValue;
            //        data.TryGetValue(5, out intValue);
            //        object stringValue;
            //        data.TryGetValue(6, out stringValue);
            //        Debug.Log(string.Format("[Peer]<5,{0}>,<6,{1}>", intValue, stringValue));
            //        break;

            //    case 2:
            //        break;

            //    default:
            //        break;
            //}
        }
Example #22
0
 public EventAttribute(EventCode code)
 {
     Code         = code;
     EventMode    = EventMode.None;
     EntityType   = EntityType.None;
     IncludeFails = false;
 }
Example #23
0
 internal void EnterState(VirtualStackFrame newFrame)
 {
     this.eventCode           = EventCode.Enter;
     this.enterStackParameter = newFrame;
     this.eventSend.Set();
     this.eventDone.WaitOne();
 }
        public static void RemoveListener(EventCode code, Act act)
        {
            if (table.ContainsKey(code))
            {
                Delegate dgt = table[code];

                if (dgt == null)
                {
                    Debug.LogErrorFormat("Event Type {0}에 대한 Listener를 제거하려고 시도했지만 현재 Listener가 null입니다.", code);
                }
                else if (dgt.GetType( ) != act.GetType( ))
                {
                    Debug.LogErrorFormat("Event Type {0}에 대한 서명이 일치하지 않는 Listener를 제거하려 했습니다. 현재 Listener Type은 {1}이고 제거하려는 Listener Type은 {2}입니다.", code, dgt.GetType( ).Name, act.GetType( ).Name);
                }
                else
                {
                    table[code] = (Act)table[code] - act;
                    if (dgt == null)
                    {
                        table.Remove(code);
                    }
                }
            }
            else
            {
                Debug.LogErrorFormat("{0} Type에 대한 Listener를 제거하려 시도했지만 Messenger가 Event Type에 대해 알지 못합니다.", code);
            }
        }
Example #25
0
 private void ReceiveEvent(EventCode eventCode, Func <EventData, bool> checkAction)
 {
     try
     {
         lock (this.dummyPeer.EventList)
         {
             while (this.dummyPeer.EventList.Count > 0)
             {
                 EventData ev = this.dummyPeer.EventList[0];
                 this.dummyPeer.EventList.RemoveAt(0);
                 if (ev.Code == (short)eventCode && checkAction(ev))
                 {
                     this.receivedEvent = ev;
                     this.OnEventReceived();
                     this.resetEvent.Set();
                     return;
                 }
             }
         }
         if (this.stopWatch.ElapsedMilliseconds > Settings.WaitTimeMultiOp)
         {
             Interlocked.Increment(ref exceptions);
             log.ErrorFormat("client {0} did not receive event {2} in time. {1}ms waited", this.Username, this.stopWatch.ElapsedMilliseconds, eventCode);
         }
         else
         {
             this.peer.RequestFiber.Schedule(() => this.ReceiveEvent(eventCode, checkAction), 10);
         }
     }
     catch (Exception e)
     {
         this.HandleException(e);
     }
 }
Example #26
0
    public override void OnEvent(EventData eventData)
    {
        base.OnEvent(eventData);

        EventCode evCode = (EventCode)eventData.Code;

        //Debug.Log("OnEvent " + evCode);
        switch (evCode)
        {
        case EventCode.SendChat:
            string chatMsg  = (string)eventData[(byte)ParameterCode.Message];
            int    idSender = (int)eventData[(byte)ParameterCode.UserId];

            GameManager.ReciveChat(chatMsg, eventData);
            _manager.OnReciveChat(idSender, chatMsg);
            this.HandleNotification(eventData);
            break;

        case EventCode.Battle:
            this.HandleBattle(eventData, GameStatus.PVA);
            break;

        case EventCode.PvPSearch:
            this.HandlePvPSearch(eventData);
            break;
        }
    }
 public ChannelSettingsMapper(EventCode code, CheckBox cbFilter, Button btnColor, CheckBox cbLabel)
 {
     Code           = code;
     CheckBoxFilter = cbFilter;
     ButtonColor    = btnColor;
     CheckBoxLabel  = cbLabel;
 }
 //无参数 发送消息
 public void SendMsg(EventCode eventCode)
 {
     if (eventList.TryGetValue(eventCode, out Delegate d))
     {
         (d as Action)?.Invoke();
     }
 }
        internal void Break()
        {
            this.eventCode = EventCode.Break;

            this.eventSend.Set();
            this.eventDone.WaitOne();
        }
 //两个参数 发送消息
 public void SendMsg <T, X>(EventCode eventCode, T arg0, X arg1)
 {
     if (eventList.TryGetValue(eventCode, out Delegate d))
     {
         (d as Action <T, X>)?.Invoke(arg0, arg1);
     }
 }
Example #31
0
    /// <summary>
    /// 向服务器发送 事件消息  广播模式
    /// </summary>

    public static void SendEvent <T>(T _My_Data, EventCode _EventCode)
    {
        Hashtable chatContent = new Hashtable();

        chatContent.Add((byte)_EventCode, My_Common.Serialize <T>(_My_Data));
        peer.OpRaiseEvent((byte)_EventCode, chatContent, true);
    }
Example #32
0
        public void WriteMainEventLog(DateTime dtEvent, EventCode e1, EventSubCode e2, string Text, string Value, string LoginUserId)
        {
            if (ConnectionString == null)
            {
                ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["SelfiConnectionString"];
            }
            SqlConnection connection = new SqlConnection(ConnectionString);

            try
            {
                string     queryString = "INSERT Selfi.dbo.MainEventLog ([CreateDate],[Program],[LoginUser],[eventType],[eventSubType],[Text],[Value]) VALUES (@CreateDate,@Program,@LoginUser,@eventType,@eventSubType,@Text,@Value)";
                SqlCommand command     = new SqlCommand(queryString, connection);
                command.Connection.Open();
                command.Parameters.AddWithValue("@CreateDate", dtEvent);
                AddParams(command.Parameters, "@LoginUser", LoginUserId, 50);
                AddParams(command.Parameters, "@Program", ApplicationName, 50);
                command.Parameters.AddWithValue("@eventType", e1);
                command.Parameters.AddWithValue("@eventSubType", e2);
                AddParams(command.Parameters, "@Text", Text, 4000);
                AddParams(command.Parameters, "@Value", Value, 100);
                command.ExecuteNonQuery();
            }
            catch (Exception Ex)
            {
                // Co proboha udelat pokud selze log
            }
            finally
            {
                connection.Close();
            }
        }
Example #33
0
        protected AbstractLogEvent(string source, EventCode eventCode, TraceEventType eventType, string format)
        {
            Contract.Requires(!string.IsNullOrEmpty(source));

            Source = source;
            Format = format;
            EventCode = eventCode;
            EventType = eventType;
            id = (int) eventCode;

            ts = new TraceSource(Source);
        }
 public static CommandCompleteEvent Parse(EventCode code, Queue<byte> data)
 {
     if (data.Count < 4)
         return null;
     return new CommandCompleteEvent
         {
             Code = code,
             NumberOfCommandsAllowedToSend = data.Dequeue(),
             CommandOpcode = (ushort)(data.Dequeue() + (data.Dequeue() << 8)),
             CommandParameterDataLength = data.Dequeue(),
             ResultData = data.DequeueAll()
         };
 }
Example #35
0
 internal static LeMetaEvent Parse(EventCode code, Queue<byte> data)
 {
     var subEvent = (LeMetaSubEvent)data.Dequeue();
     LeAdvertisingEvent[] events = null;
     switch (subEvent)
     {
         case LeMetaSubEvent.ConnectionComplete:
             // Not implemented
             break;
         case LeMetaSubEvent.AdvertisingReport:
             events = ParseAdvertisingReport(data);
             break;
     }
     return new LeMetaEvent
         {
             Code = code,
             SubEvent = subEvent,
             AdvertisingEvents = events
         };
 }
Example #36
0
 /// <summary>
 /// The end receive event.
 /// </summary>
 /// <param name="client">
 /// The client.
 /// </param>
 /// <param name="eventCode">
 /// The event EventCode.
 /// </param>
 /// <returns>
 /// the received event
 /// </returns>
 private static EventData EndReceiveEvent(Client client, EventCode eventCode)
 {
     EventData data;
     Assert.IsTrue(client.EndReceiveEvent(Settings.WaitTime, out data), "Event not received");
     Assert.AreEqual(eventCode, (EventCode)data.Code);
     return data;
 }
Example #37
0
 /// <summary>
 /// The begin receive event.
 /// </summary>
 /// <param name="client">
 /// The client.
 /// </param>
 /// <param name="eventCode">
 /// The event code.
 /// </param>
 private static void BeginReceiveEvent(Client client, EventCode eventCode)
 {
     client.BeginReceiveEvent(eventCode, d => true);
 }
Example #38
0
 /// <summary>
 /// Used to construct an instace of the class.
 /// </summary>
 /// <param name="ec"></param>
 internal CompletedArgs(EventCode ec)
 {
   Result = ec;
 }
        //
        // Summary:
        // Logs the event for the appropriate infocard error code. This code should 
        // match the entries in messages,mc
        // Parameters:
        // code         - the event code to log
        // Notes: 
        // This code may need to be extended to support an array of string parameters. We will do this if our event
        // log messages require it.
        // 
        private static void LogEvent(EventCode code, string message, EventLogEntryType type)
        {




            using (SafeEventLogHandle handle = SafeEventLogHandle.Construct())
            {
                string parameter = message;
                if (null != handle)
                {
                    if (String.IsNullOrEmpty(parameter))
                    {
                        parameter = SR.GetString(SR.GeneralExceptionMessage);
                    }


                    //
                    // Report event expects a LPCTSTR* lpStrings. Use GCHandle, instead 
                    // of writing code with unsafe because InfoCard client uses this 
                    // and our client cannot contain any unsafe code.
                    //

                    //
                    // This is the array of LPCTSTRs 
                    //
                    IntPtr[] stringRoots = new IntPtr[1];

                    //
                    // This is to pin the parameter string itself. Use an array here if you want more than 1 string
                    //
                    GCHandle stringParamHandle = new GCHandle();

                    //
                    // This is to pin the pointer to the array of LPCTSTRs
                    //
                    GCHandle stringsRootHandle = new GCHandle();

                    try
                    {
                        //
                        // Pin the IntPtrs (ie array of LPCTSTRs)
                        //
                        stringsRootHandle = GCHandle.Alloc(stringRoots, GCHandleType.Pinned);

                        //
                        // Pin the parameter string itself
                        //
                        stringParamHandle = GCHandle.Alloc(parameter, GCHandleType.Pinned);

                        //
                        // Give the intptr address of the pinned string
                        //
                        stringRoots[0] = stringParamHandle.AddrOfPinnedObject();

                        //
                        // From msdn: The interop marshaler passes only the handle [2nd arg to constructor in our case] 
                        // to unmanaged code, and guarantees that the wrapper (passed as the first parameter
                        // to the constructor of the HandleRef) remains alive for the duration of the [PInvoke] call.
                        //
                        HandleRef data = new HandleRef(handle, stringsRootHandle.AddrOfPinnedObject());


                        SecurityIdentifier sid = WindowsIdentity.GetCurrent().User;
                        byte[] sidBA = new byte[sid.BinaryLength];
                        sid.GetBinaryForm(sidBA, 0);

                        if (!ReportEvent(
                                 handle,
                                 (short)type,
                                 (ushort)InfoCardEventCategory.General,
                                 (uint)code,
                                 sidBA,
                                 1,
                                 0,
                                 data,
                                 null))
                        {
                            //
                            // Errors in the eventlog API should be ignored by applications
                            //
                            int error = Marshal.GetLastWin32Error();
                            TraceDebug("Failed to report the event with error {0}", error);
                        }
                    }
                    finally
                    {
                        if (stringsRootHandle.IsAllocated)
                        {
                            stringsRootHandle.Free();
                        }

                        if (stringParamHandle.IsAllocated)
                        {
                            stringParamHandle.Free();
                        }
                    }
                }
            }

        }
 //
 // Summary:
 // Writes an audit message to the application's event log
 //
 public static void Audit(EventCode code)
 {
     LogEvent(code, null, EventLogEntryType.Information);
 }
Example #41
0
 /// <summary>
 /// Explicit constructor.
 /// </summary>
 /// <param name="eventCode">The code of the event which failed.</param>
 public FailureEvent(EventCode eventCode)
     : base(EventCode.Failure, (int)eventCode)
 {
     failedEventCode = (byte)eventCode;
 }
Example #42
0
 /// <summary>
 ///   The check default event params.
 /// </summary>
 /// <param name = "eventArgs">
 ///   The event args.
 /// </param>
 /// <param name = "eventEventCode">
 ///   The event code.
 /// </param>
 /// <param name = "actorNumber">
 ///   The actor number.
 /// </param>
 protected static void CheckDefaultEventParameters(EventData eventArgs, EventCode eventEventCode, int actorNumber)
 {
     CheckEventParam(eventArgs, ParameterKey.ActorNr, actorNumber);
 }
        internal void EnterState(VirtualStackFrame newFrame)
        {
            this.eventCode = EventCode.Enter;
            this.enterStackParameter = newFrame;

            this.eventSend.Set();

            // Block until Island executes Nop, 
            // giving BPs a chance to be hit.
            // Must block here if the island is stopped at a breakpoint.
            this.eventDone.WaitOne();
        }
        internal void LeaveState()
        {
            this.eventCode = EventCode.Leave;

            this.eventSend.Set();

            // Block until call has exited.
            this.eventDone.WaitOne();
        }
        internal void Break()
        {
            this.eventCode = EventCode.Break;

            this.eventSend.Set();
            this.eventDone.WaitOne();
        }
Example #46
0
 // NotifyEvent: Send an e vent to the EVR through its IMediaEventSink interface.
 protected void NotifyEvent(EventCode ec, IntPtr Param1, IntPtr Param2)
 {
     if (m_pMediaEventSink != null)
     {
         m_pMediaEventSink.Notify(ec, Param1, Param2);
     }
 }
Example #47
0
 protected override void HandleGraphEvent(EventCode code, int p1, int p2)
 {
     Logger.LogHeavyTrace("GraphEvent: {0} : {1} : {2}", code, p1, p2);
 }
Example #48
0
        protected override void HandleGraphEvent(EventCode code, int p1, int p2)
        {
            

            switch (code)
            {
                case EventCode.DvdCurrentHmsfTime:
                    byte[] ati = BitConverter.GetBytes(p1);
                    _currentPosition = new TimeSpan(ati[0], ati[1], ati[2]);
                    break;

                case EventCode.DvdDomChange:
                    DvdDomain dom = (DvdDomain)p1;
                    Logger.LogHeavyTrace("Currently in domain: {0}", dom);

                    if (dom == DvdDomain.Title)
                    {
                        object comobj = null;
                        dvdGraphBuilder.GetDvdInterface(typeof(IDvdInfo2).GUID, out comobj);

                        dvdInfo = comobj as IDvdInfo2;

                        DvdHMSFTimeCode timeCode;
                        DvdTimeCodeFlags flags;
                        dvdInfo.GetTotalTitleTime(out timeCode, out flags);
                        _totalTime = new TimeSpan(timeCode.bHours, timeCode.bMinutes, timeCode.bSeconds);
                    }
                    break;

                case EventCode.DvdChaptStart:
                case EventCode.DvdTitleChange:
                case EventCode.DvdCmdStart:
                case EventCode.DvdCmdEnd:
                    break;

                case EventCode.DvdStillOn:
                    if (p1 == 0)
                        menuMode = MenuMode.Buttons;
                    else
                        menuMode = MenuMode.Still;
                    break;

                case EventCode.DvdStillOff:
                    if (menuMode == MenuMode.Still)
                        menuMode = MenuMode.No;
                    break;

                case EventCode.DvdButtonChange:
                    if (p1 <= 0)
                        menuMode = MenuMode.No;
                    else
                        menuMode = MenuMode.Buttons;
                    break;

                case EventCode.DvdNoFpPgc:
                    if (dvdControl2 != null)
                    {
                        int hr = dvdControl2.PlayTitle(1, DvdCmdFlags.None, _lastCmd);
                        DsError.ThrowExceptionForHR(hr);
                    }
                    break;
                }
            }
Example #49
0
 /// <summary>
 /// Used to construct an instace of the class.
 /// </summary>
 /// <param name="ec"></param>
 public DESCompletedArgs(EventCode ec)
 {
   Result = ec;
 }
Example #50
0
        /// <summary>
        /// Is called when a new media event code occurs on the graph
        /// </summary>
        /// <param name="code">The event code that occured</param>
        /// <param name="lparam1">The first parameter sent by the graph</param>
        /// <param name="lparam2">The second parameter sent by the graph</param>
        protected override void OnMediaEvent(EventCode code, IntPtr lparam1, IntPtr lparam2)
        {
            switch (code)
            {
                case EventCode.DvdCurrentHmsfTime:
                    /* This is time in hours, minutes, seconds, frames format.
                     * The the time is one, 4 byte integer, each byte representing
                     * an hour, minute, second or frame */
                    byte[] times = BitConverter.GetBytes(lparam1.ToInt32());
                    m_currentDvdTime = new TimeSpan(times[0], times[1], times[2]);

                    /* Report the time to anyone that cares to listen */
                    InvokeOnDvdTime(new DvdTimeEventArgs(m_currentDvdTime));
                    break;
                case EventCode.DvdDomainChange:
                    break;
                case EventCode.DvdTitleChange:
                    SetTitleDuration();
                    break;
                case EventCode.DvdChapterStart:
                    SetTitleDuration();
                    break;
                case EventCode.DvdAudioStreamChange:
                    break;
                case EventCode.DvdSubPicictureStreamChange:
                    break;
                case EventCode.DvdAngleChange:
                    /* For p**n? */
                    break;
                case EventCode.DvdButtonChange:
                    /* Keep track of button counts */
                    SetDvdButtonCount(lparam1.ToInt32());
                    break;
                case EventCode.DvdValidUopsChange:
                    break;
                case EventCode.DvdStillOn:
                    break;
                case EventCode.DvdStillOff:
                    break;
                case EventCode.DvdCurrentTime:
                    break;
                case EventCode.DvdError:
                    /* Notify any listener of any Dvd specific
                     * errors we may get when loading or playing Dvds */
                    InvokeDvdError((DvdError)lparam1.ToInt32());
                    break;
                case EventCode.DvdWarning:
                    break;
                case EventCode.DvdChapterAutoStop:
                    break;
                case EventCode.DvdNoFpPgc:
                    break;
                case EventCode.DvdPlaybackRateChange:
                    break;
                case EventCode.DvdParentalLevelChange:
                    break;
                case EventCode.DvdPlaybackStopped:
                    break;
                case EventCode.DvdAnglesAvailable:
                    break;
                case EventCode.DvdPlayPeriodAutoStop:
                    break;
                case EventCode.DvdButtonAutoActivated:
                    break;
                case EventCode.DvdCmdStart:
                    break;
                case EventCode.DvdCmdEnd:
                    break;
                case EventCode.DvdDiscEjected:
                    InvokeOnDvdEjected();
                    break;
                case EventCode.DvdDiscInserted:
                    /* For some reason we only get this
                     * event when a Dvd graph has successfully
                     * been started.  Otherwise it does not work */
                    InvokeOnDvdInserted();
                    break;
                case EventCode.DvdKaraokeMode:
                    /* For drunks */
                    break;
                default:
                    break;
            }

            base.OnMediaEvent(code, lparam1, lparam2);
        }
Example #51
0
        /// <summary>
        /// Determines if user has opted out of a selected email
        /// </summary>
        /// <param name="preference"></param>
        /// <param name="role"></param>
        /// <param name="currentStatus"></param>
        /// <param name="eventCode"></param>
        /// <returns>True if should receive email, False if should not receive email</returns>
        private bool IsMailRequested(EmailPreferences preference, OrderStatusCode role, OrderStatusCode currentStatus, EventCode eventCode, OrderType orderType = null)
        {
            // no preference, automatically gets emails
            if (preference == null) return true;

            // what is the role of the user we are inspecting
            switch (role.Id)
            {
                case OrderStatusCode.Codes.Requester:

                    // what event is happening
                    switch (eventCode)
                    {
                        case EventCode.Approval:

                            // evaluate the level that is being handled
                            switch (currentStatus.Id)
                            {
                                case OrderStatusCode.Codes.Approver: return preference.RequesterApproverApproved;

                                case OrderStatusCode.Codes.ConditionalApprover: return preference.RequesterApproverApproved;

                                case OrderStatusCode.Codes.AccountManager: return preference.RequesterAccountManagerApproved;

                                // this technically doesn't exist, gets completed at purchaser level
                                //case OrderStatusCode.Codes.Purchaser: return preference.RequesterPurchaserAction;

                                //case OrderStatusCode.Codes.Complete: return preference.RequesterKualiApproved;  //Done: OrderStatusCode.Codes.Complete (Kuali Approved)

                                default: return true;
                            }

                        case EventCode.Update:

                            switch (currentStatus.Id)
                            {
                                case OrderStatusCode.Codes.Approver: return preference.RequesterApproverChanged;

                                case OrderStatusCode.Codes.ConditionalApprover: return preference.RequesterApproverChanged;

                                case OrderStatusCode.Codes.AccountManager: return preference.RequesterAccountManagerChanged;

                                case OrderStatusCode.Codes.Purchaser: return preference.RequesterPurchaserChanged;

                                default: return true;
                            }

                        case EventCode.Cancelled:

                            // there is no option, user always receives this event
                            return true;

                        case EventCode.Complete:

                            return preference.RequesterPurchaserAction;

                            //case EventCode.KualiUpdate:

                            //    //TODO: add in kuali stuff

                            //    break;

                        case EventCode.Received:
                            return preference.RequesterReceived;
                        case EventCode.Paid:
                            return preference.RequesterPaid;
                    }

                    break;
                case OrderStatusCode.Codes.Approver:

                    // evaluate the event
                    switch (eventCode)
                    {
                        case EventCode.Approval:

                            switch (currentStatus.Id)
                            {
                                case OrderStatusCode.Codes.AccountManager: return preference.ApproverAccountManagerApproved;
                                case OrderStatusCode.Codes.Purchaser: return preference.ApproverPurchaserProcessed;
                                //case OrderStatusCode.Codes.Complete: return preference.ApproverKualiApproved; //Done: OrderStatusCode.Codes.Complete (Kuali Approved) or Request Completed (Look at Email Preferences Page) ?
                                case OrderStatusCode.Codes.Complete: return preference.ApproverPurchaserProcessed;

                                default: return false;
                            }

                        case EventCode.Update:

                            // this email is turned off, no email exists
                            return false;

                        case EventCode.Cancelled:

                            // this email is turned off, no email exists
                            return false;

                        // this technically doesn't exist, since a "complete" order is an approval at purchaser level, see switch statement in approval event.
                        case EventCode.Complete:

                            return preference.ApproverPurchaserProcessed;

                        //case EventCode.KualiUpdate:

                        //    //TODO: add in kuali stuff

                        //    break;

                        case EventCode.Arrival:

                            return preference.ApproverOrderArrive;

                        // no received status for approver
                        case EventCode.Received:
                            return false;
                        case EventCode.Paid:
                            return false;

                        default: return false;
                    }

                case OrderStatusCode.Codes.ConditionalApprover:
                    //Copied code from Approver above... Otherwise this was always returning true...
                    // evaluate the event
                    switch (eventCode)
                    {
                        case EventCode.Approval:

                            switch (currentStatus.Id)
                            {
                                case OrderStatusCode.Codes.AccountManager: return preference.ApproverAccountManagerApproved;
                                case OrderStatusCode.Codes.Purchaser: return preference.ApproverPurchaserProcessed;
                                //case OrderStatusCode.Codes.Complete: return preference.ApproverKualiApproved; //Done: OrderStatusCode.Codes.Complete (Kuali Approved) or Request Completed (Look at Email Preferences Page) ?
                                case OrderStatusCode.Codes.Complete: return preference.ApproverPurchaserProcessed;

                                default: return false;
                            }

                        case EventCode.Update:

                            // this email is turned off, no email exists
                            return false;

                        case EventCode.Cancelled:

                            // this email is turned off, no email exists
                            return false;

                        // this technically doesn't exist, since a "complete" order is an approval at purchaser level, see switch statement in approval event.
                        case EventCode.Complete:

                            return preference.ApproverPurchaserProcessed;

                        //case EventCode.KualiUpdate:

                        //    //TODO: add in kuali stuff

                        //    break;

                        case EventCode.Arrival:

                            return preference.ApproverOrderArrive;

                        // no received status for approver
                        case EventCode.Received:
                            return false;
                        case EventCode.Paid:
                            return false;

                        default: return false;
                    }

                    break;
                case OrderStatusCode.Codes.AccountManager:

                    switch (eventCode)
                    {
                        case EventCode.Approval:

                            switch (currentStatus.Id)
                            {
                                case OrderStatusCode.Codes.Purchaser: return preference.AccountManagerPurchaserProcessed;
                                case OrderStatusCode.Codes.Complete: return preference.AccountManagerPurchaserProcessed; //Done: OrderStatusCode.Codes.Complete (Kuali Approved) or Request Completed (Look at Email Preferences Page) ?
                                default: return true;
                            }

                        case EventCode.Update:

                            // no email exists
                            return false;

                        case EventCode.Cancelled:

                            // no email exists
                            return false;

                        case EventCode.Complete:

                            return preference.AccountManagerPurchaserProcessed;

                        //case EventCode.KualiUpdate:

                        //    //TODO: Add in kuali stuff

                        //    break;

                        case EventCode.Arrival:

                            return preference.AccountManagerOrderArrive;

                        // account manager doesn't have any emails fror received.
                        case EventCode.Received:
                            return false;
                        case EventCode.Paid:
                            return false;

                        default: return false;
                    }

                case OrderStatusCode.Codes.Purchaser:

                    switch (eventCode)
                    {
                        case EventCode.Approval:
                            switch (currentStatus.Id)
                            {
                                case OrderStatusCode.Codes.Complete: return preference.PurchaserKualiApproved;  //Done: OrderStatusCode.Codes.Complete (Kuali Approved) or Request Completed (Look at Email Preferences Page) ?
                            }

                            // no email exists
                            return false;

                        case EventCode.Update:

                            // no email exists
                            return false;

                        case EventCode.Cancelled:

                            // no email exists
                            return false;

                        //case EventCode.KualiUpdate:
                        //    //TODO: Add in Kuali Stuff
                        //    break;

                        case EventCode.Arrival:

                            return preference.PurchaserOrderArrive;

                        case EventCode.Received:

                            switch (orderType.Id)
                            {
                                case "KFS": return preference.PurchaserKfsItemReceived;
                                case "PC": return preference.PurchaserPCardItemReceived;
                                case "CS": return preference.PurchaserCampusServicesItemReceived;
                                default: return false;
                            }
                        case EventCode.Paid:

                            switch (orderType.Id)
                            {
                                case "KFS": return preference.PurchaserKfsItemPaid;
                                case "PC": return preference.PurchaserPCardItemPaid;
                                case "CS": return preference.PurchaserCampusServicesItemPaid;
                                default: return false;
                            }

                        default: return false;
                    }
            }

            // default receive email
            return true;
        }
Example #52
0
 /// <summary>
 /// Creates an event object with event code.
 /// </summary>
 protected Event(EventCode code)
 {
     Code = code;
 }
Example #53
0
 /// <summary>
 /// Is called when a new media event code occurs on the graph
 /// </summary>
 /// <param name="code">The event code that occured</param>
 /// <param name="param1">The first parameter sent by the graph</param>
 /// <param name="param2">The second parameter sent by the graph</param>
 protected virtual void OnMediaEvent(EventCode code, IntPtr param1, IntPtr param2)
 {
     switch (code)
     {
         case EventCode.Complete:
             InvokeMediaEnded(null);
             break;
         case EventCode.Paused:
             break;
         default:
             break;
     }
 }
Example #54
0
 protected abstract void HandleGraphEvent(EventCode code, int p1, int p2);
 public static void Audit(EventCode code, string message)
 {
     LogEvent(code, message, EventLogEntryType.Information);
 }
Example #56
0
 /// <summary>
 /// The begin receive event.
 /// </summary>
 /// <param name="client">
 /// The client.
 /// </param>
 /// <param name="eventCode">
 /// The event code.
 /// </param>
 /// <param name="checkAction">
 /// The check action.
 /// </param>
 private static void BeginReceiveEvent(Client client, EventCode eventCode, Func<EventData, bool> checkAction)
 {
     client.BeginReceiveEvent(eventCode, checkAction);
 }
Example #57
0
		public CCPhysicsContact()
			: base(PHYSICSCONTACT_EVENT_NAME)
		{
			_world = null;
			_shapeA = null;
			_shapeB = null;
			_eventCode = EventCode.NONE;
			_info = null;
			_notificationEnable = true;
			_result = true;
			_data = null;
			_contactInfo = null;
			_contactData = null;
			_preContactData = null;
		}
Example #58
0
 /// <summary>
 /// Overload.
 /// </summary>
 public DataSendingNaoEvent(EventCode eventCode, params int[] data)
     : this((byte)eventCode, data)
 {
 }
Example #59
0
        public int Notify(EventCode evCode, IntPtr EventParam1, IntPtr EventParam2)
        {
            if (m_pUnknown == IntPtr.Zero) return E_NOINTERFACE;

            NotifyProc _NotifyProc = GetProcDelegate<NotifyProc>(3);

            if (_NotifyProc == null) return E_UNEXPECTED;

            return (HRESULT)_NotifyProc(m_pUnknown, evCode, EventParam1, EventParam2);
        }
 /// <summary>
 /// Is ran everytime a new media event occurs on the graph
 /// </summary>
 /// <param name="code">The Event code that occured</param>
 /// <param name="lparam1">The first event parameter sent by the graph</param>
 /// <param name="lparam2">The second event parameter sent by the graph</param>
 protected override void OnMediaEvent(EventCode code, IntPtr lparam1, IntPtr lparam2)
 {
     if(Loop)
     {
         switch(code)
         {
             case EventCode.Complete:
                 MediaPosition = 0;
                 break;
         }
     }
     else
         /* Only run the base when we don't loop
          * otherwise the default behavior is to
          * fire a media ended event */
         base.OnMediaEvent(code, lparam1, lparam2);
 }