Exemplo n.º 1
0
        /// <summary>
        /// Called by a client to remove all listeners that the client has added.
        /// </summary>
        ///
        /// <outside_see conditional="false">
        /// This API does not work inside the secure execution environment.
        /// <exception cref="System.Security.Permissions.SecurityPermission"/>
        /// </outside_see>
        public static void RemoveAllEventHandlers()
        {
            //CASRemoval:AutomationPermission.Demand( AutomationPermissionFlag.Read );

            // Remove the client-side listener for for this event
            ClientEventManager.RemoveAllListeners();
        }
Exemplo n.º 2
0
 public CharacterEditorController()
 {
     CharacterController.OnPlayerSelectCharacter += CharacterController_OnPlayerSelectCharacter;
     ClientEventManager.RegisterClientEvent("CharacterEditorSetGender", ClientSideSetGender);
     ClientEventManager.RegisterClientEvent("CharacterEditorSaveCharacter", ClientSideSaveCharacter);
     ClientEventManager.RegisterClientEvent("CharacterEditorLeave", ClientSideLeaveEditor);
 }
Exemplo n.º 3
0
        /// <summary>
        /// Called by a client to add a listener for property changed events.
        /// </summary>
        /// <param name="element">Element on which to listen for property changed events.</param>
        /// <param name="scope">Specifies whether to listen to property changes events on the specified element, and/or its ancestors and children.</param>
        /// <param name="eventHandler">Callback object to call when a specified property change occurs.</param>
        /// <param name="properties">Params array of properties to listen for changes in.</param>
        ///
        /// <outside_see conditional="false">
        /// This API does not work inside the secure execution environment.
        /// <exception cref="System.Security.Permissions.SecurityPermission"/>
        /// </outside_see>
        public static void AddAutomationPropertyChangedEventHandler(
            AutomationElement element,                          // reference element for listening to the event
            TreeScope scope,                                    // scope to listen to
            AutomationPropertyChangedEventHandler eventHandler, // callback object
            params AutomationProperty [] properties             // listen for changes to these properties
            )
        {
            Misc.ValidateArgumentNonNull(element, "element");
            Misc.ValidateArgumentNonNull(eventHandler, "eventHandler");
            Misc.ValidateArgumentNonNull(properties, "properties");
            if (properties.Length == 0)
            {
                throw new ArgumentException(SR.Get(SRID.AtLeastOnePropertyMustBeSpecified));
            }

            // Check that no properties are interpreted properties
            // If more interpreted properties are identified add a mapping of
            // on interpreted properties to the real property that raises events.
            foreach (AutomationProperty property in properties)
            {
                Misc.ValidateArgumentNonNull(property, "properties");
            }

            // Add a client-side listener for for this event request
            EventListener l = new EventListener(AutomationElement.AutomationPropertyChangedEvent, scope, properties, CacheRequest.CurrentUiaCacheRequest);

            ClientEventManager.AddListener(element, eventHandler, l);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Called by a client to remove a listener for structure change events.
        /// </summary>
        /// <param name="element">Element to remove listener for</param>
        /// <param name="eventHandler">The handler object that was passed to AddStructureChangedListener</param>
        ///
        /// <outside_see conditional="false">
        /// This API does not work inside the secure execution environment.
        /// <exception cref="System.Security.Permissions.SecurityPermission"/>
        /// </outside_see>
        public static void RemoveStructureChangedEventHandler(AutomationElement element, StructureChangedEventHandler eventHandler)
        {
            Misc.ValidateArgumentNonNull(element, "element");
            Misc.ValidateArgumentNonNull(eventHandler, "eventHandler");

            // Remove the client-side listener for for this event
            ClientEventManager.RemoveListener(AutomationElement.StructureChangedEvent, element, eventHandler);
        }
Exemplo n.º 5
0
        public MainWindow(User user)
        {
            MainViewModel mainViewModel = new MainViewModel(user, this, new RailwayServiceConnector(), ClientLogger.GetOrCreate(), new PrimaryEntityCommandManager());

            DataContext = mainViewModel;
            ClientEventManager.GetOrCreate().RegisterEventObserver(mainViewModel);
            InitializeComponent();
        }
 public BankController()
 {
     InteractionController.InteractionObjects.AddRange(AtmModels);
     InteractionController.OnPlayerInteractWithObject += InteractionController_OnPlayerInteractWithObject;
     ClientEventManager.RegisterClientEvent("CloseAtmMenu", CloseAtmMenu);
     ClientEventManager.RegisterClientEvent("WITHDRAW", WithdrawAtm);
     ClientEventManager.RegisterClientEvent("DEPOSIT", DepositAtm);
 }
        public RadioController()
        {
            ClientEventManager.RegisterClientEvent("RADIO_PTT", OnRadioSpeakingKey);
            ClientEventManager.RegisterClientEvent("RADIO_TOGGLE_SPEAK", OnRadioToggleSpeaking);
            ClientEventManager.RegisterClientEvent("RADIO_MUTE", OnRadioMute);
            ClientEventManager.RegisterClientEvent("RADIO_NEXT", OnRadioNextChannel);

            API.onPlayerDisconnected += API_onPlayerDisconnected;
        }
 public InteractionController()
 {
     ClientEventManager.RegisterClientEvent("INTERACTION_ONFOOT", OnFootInteraction);
     ClientEventManager.RegisterClientEvent("INTERACTION_IN_VEHICLE", InVehicleInteraction);
     ClientEventManager.RegisterClientEvent("INTERACTION_WITH_OBJECT", ObjectInteraction);
     ClientEventManager.RegisterClientEvent("INTERACTION_WITH_VEHICLE", VehicleInteraction);
     ClientEventManager.RegisterClientEvent("INTERACTION_WITH_UNKNOWN_OBJECT", UnknownObjectInteraction);
     ClientEventManager.RegisterClientEvent("INTERACTION_ONFOOT_INVENTORY", OnFootInventoryInteraction);
 }
Exemplo n.º 9
0
        /// <summary>
        /// Called by a client to remove a listener for focus changed events.
        /// </summary>
        /// <param name="eventHandler">The handler object that was passed to AddAutomationFocusChangedListener</param>
        ///
        /// <outside_see conditional="false">
        /// This API does not work inside the secure execution environment.
        /// <exception cref="System.Security.Permissions.SecurityPermission"/>
        /// </outside_see>
        public static void RemoveAutomationFocusChangedEventHandler(
            AutomationFocusChangedEventHandler eventHandler
            )
        {
            Misc.ValidateArgumentNonNull(eventHandler, "eventHandler");

            // Remove the client-side listener for for this event
            ClientEventManager.RemoveFocusListener(eventHandler);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Called by a client to add a listener for structure change events.
        /// </summary>
        /// <param name="element">Element on which to listen for structure change events.</param>
        /// <param name="scope">Specifies whether to listen to property changes events on the specified element, and/or its ancestors and children.</param>
        /// <param name="eventHandler">Delegate to call when a structure change event occurs.</param>
        ///
        /// <outside_see conditional="false">
        /// This API does not work inside the secure execution environment.
        /// <exception cref="System.Security.Permissions.SecurityPermission"/>
        /// </outside_see>
        public static void AddStructureChangedEventHandler(AutomationElement element, TreeScope scope, StructureChangedEventHandler eventHandler)
        {
            Misc.ValidateArgumentNonNull(element, "element");
            Misc.ValidateArgumentNonNull(eventHandler, "eventHandler");

            // Add a client-side listener for for this event request
            EventListener l = new EventListener(AutomationElement.StructureChangedEvent, scope, null, CacheRequest.CurrentUiaCacheRequest);

            ClientEventManager.AddListener(element, eventHandler, l);
        }
Exemplo n.º 11
0
 public GarageController()
 {
     GameMode.OnWorldStartup      += GameMode_OnWorldStartup;
     GameMode.OnWorldReloadConfig += GameMode_OnWorldReloadConfig;
     ClientEventManager.RegisterClientEvent("GARAGE_PARK_IN", ParkInGarageEvent);
     ClientEventManager.RegisterClientEvent("GARAGE_PARK_OUT", ParkOutGarageEvent);
     ClientEventManager.RegisterClientEvent("GARAGE_CLOSE", CloseParkMenu);
     ClientEventManager.RegisterClientEvent("GARAGE_PARK_OUT_VEHICLE", ParkOutVehicleEvent);
     InteractionController.OnPlayerInteractOnFoot += InteractionController_OnPlayerInteractOnFoot;
 }
Exemplo n.º 12
0
        /// <summary>
        /// Called by a client to remove a listener for property changed events.
        /// </summary>
        /// <param name="element">Element to remove listener for</param>
        /// <param name="eventHandler">The handler object that was passed to AutomationPropertyChangedEventHandler</param>
        ///
        /// <outside_see conditional="false">
        /// This API does not work inside the secure execution environment.
        /// <exception cref="System.Security.Permissions.SecurityPermission"/>
        /// </outside_see>
        public static void RemoveAutomationPropertyChangedEventHandler(
            AutomationElement element,                         // reference element being listened to
            AutomationPropertyChangedEventHandler eventHandler // callback object (used as cookie here)
            )
        {
            Misc.ValidateArgumentNonNull(element, "element");
            Misc.ValidateArgumentNonNull(eventHandler, "eventHandler");

            // Remove the client-side listener for for this event
            ClientEventManager.RemoveListener(AutomationElement.AutomationPropertyChangedEvent, element, eventHandler);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Called by a client to add a listener for focus changed events.
        /// </summary>
        /// <param name="eventHandler">Delegate to call when a focus change event occurs.</param>
        ///
        /// <outside_see conditional="false">
        /// This API does not work inside the secure execution environment.
        /// <exception cref="System.Security.Permissions.SecurityPermission"/>
        /// </outside_see>
        public static void AddAutomationFocusChangedEventHandler(
            AutomationFocusChangedEventHandler eventHandler
            )
        {
            Misc.ValidateArgumentNonNull(eventHandler, "eventHandler");

            // Add a client-side listener for for this event request
            EventListener l = new EventListener(AutomationElement.AutomationFocusChangedEvent,
                                                TreeScope.Subtree | TreeScope.Ancestors,
                                                null,
                                                CacheRequest.CurrentUiaCacheRequest);

            ClientEventManager.AddFocusListener(eventHandler, l);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Called by a client to remove a listener for pattern or custom events.
        /// </summary>
        /// <param name="eventId">a UIAccess or custom event identifier.</param>
        /// <param name="element">Element to remove listener for</param>
        /// <param name="eventHandler">The handler object that was passed to AddEventListener</param>
        ///
        /// <outside_see conditional="false">
        /// This API does not work inside the secure execution environment.
        /// <exception cref="System.Security.Permissions.SecurityPermission"/>
        /// </outside_see>
        public static void RemoveAutomationEventHandler(
            AutomationEvent eventId,
            AutomationElement element,
            AutomationEventHandler eventHandler
            )
        {
            Misc.ValidateArgumentNonNull(element, "element");
            Misc.ValidateArgumentNonNull(eventHandler, "eventHandler");
            Misc.ValidateArgument(eventId != AutomationElement.AutomationFocusChangedEvent, SRID.EventIdMustNotBeAutomationFocusChanged);
            Misc.ValidateArgument(eventId != AutomationElement.StructureChangedEvent, SRID.EventIdMustNotBeStructureChanged);
            Misc.ValidateArgument(eventId != AutomationElement.AutomationPropertyChangedEvent, SRID.EventIdMustNotBeAutomationPropertyChanged);

            // Remove the client-side listener for for this event
            ClientEventManager.RemoveListener(eventId, element, eventHandler);
        }
Exemplo n.º 15
0
        /// <summary>
        /// Creates new Messaging Queue Server
        /// </summary>
        public HorseMq(HorseMqOptions options)
        {
            Options = options ?? new HorseMqOptions();

            _routers = new SafeList <IRouter>(256);
            _queues  = new SafeList <HorseQueue>(256);
            _clients = new SafeList <MqClient>(2048);

            NodeManager = new NodeManager(this);

            NodeManager.Initialize();

            OnClientConnected    = new ClientEventManager(EventNames.ClientConnected, this);
            OnClientDisconnected = new ClientEventManager(EventNames.ClientDisconnected, this);
            OnQueueCreated       = new QueueEventManager(this, EventNames.QueueCreated);
            OnQueueUpdated       = new QueueEventManager(this, EventNames.QueueUpdated);
            OnQueueRemoved       = new QueueEventManager(this, EventNames.QueueRemoved);
        }
Exemplo n.º 16
0
    private void Awake()
    {
        GameObject bottomLeftObj = ObjectCommon.GetChild(gameObject, "bottom/left");

        labelLevel         = ObjectCommon.GetChildComponent <Text>(bottomLeftObj, "level_value");
        labelAttack        = ObjectCommon.GetChildComponent <Text>(bottomLeftObj, "attack_value");
        labelHp            = ObjectCommon.GetChildComponent <Text>(bottomLeftObj, "hp_value");
        labelPhysicDefence = ObjectCommon.GetChildComponent <Text>(bottomLeftObj, "phy_defence_value");
        labelMagicDefence  = ObjectCommon.GetChildComponent <Text>(bottomLeftObj, "mag_defence (1)");
        GameObject topObj = ObjectCommon.GetChild(gameObject, "equip_list");

        eventTrigger = ObjectCommon.GetChildComponent <EventTrigger>(topObj, "equip_head");

        btn = ObjectCommon.GetChildComponent <Button>(topObj, "equip_head");
        btn.onClick.AddListener(OnEquipHeadClicked);

        ClientEventManager.GetInstance().AddProcessFunction(GameEventID.GEDynamicHudPos_Add, OnEquipWeared);
    }
Exemplo n.º 17
0
 /// <summary>
 /// Called by a client to remove all listeners that the client has added.
 /// </summary>
 ///
 /// <outside_see conditional="false">
 /// This API does not work inside the secure execution environment.
 /// <exception cref="System.Security.Permissions.SecurityPermission"/>
 /// </outside_see>
 public static void RemoveAllEventHandlers()
 {
     // Remove the client-side listener for for this event
     ClientEventManager.RemoveAllListeners();
 }
Exemplo n.º 18
0
 public AccountController()
 {
     ClientEventManager.RegisterClientEvent("LOGIN_ACCOUNT", ClientTriggeredLogin);       // [Args] 0: <string> Password
     ClientEventManager.RegisterClientEvent("REGISTER_ACCOUNT", ClientTriggeredRegister); // [Args] 0: <string> Password; 1: <string> rePassword
 }
Exemplo n.º 19
0
        /// <summary>
        /// Called by a client to add a listener for pattern or custom events.
        /// </summary>
        /// <param name="eventId">A control pattern or custom event identifier.</param>
        /// <param name="element">Element on which to listen for control pattern or custom events.</param>
        /// <param name="scope">Specifies whether to listen to property changes events on the specified element, and/or its ancestors and children.</param>
        /// <param name="eventHandler">Delegate to call when the specified event occurs.</param>
        ///
        /// <outside_see conditional="false">
        /// This API does not work inside the secure execution environment.
        /// <exception cref="System.Security.Permissions.SecurityPermission"/>
        /// </outside_see>
        public static void AddAutomationEventHandler(
            AutomationEvent eventId,
            AutomationElement element,
            TreeScope scope,
            AutomationEventHandler eventHandler
            )
        {
            Misc.ValidateArgumentNonNull(element, "element");
            Misc.ValidateArgumentNonNull(eventHandler, "eventHandler");
            Misc.ValidateArgument(eventId != AutomationElement.AutomationFocusChangedEvent, SRID.EventIdMustNotBeAutomationFocusChanged);
            Misc.ValidateArgument(eventId != AutomationElement.StructureChangedEvent, SRID.EventIdMustNotBeStructureChanged);
            Misc.ValidateArgument(eventId != AutomationElement.AutomationPropertyChangedEvent, SRID.EventIdMustNotBeAutomationPropertyChanged);

            if (eventId == WindowPattern.WindowClosedEvent)
            {
                // Once a window closes and the hwnd is destroyed we won't be able to determine where it was in the
                // Automation tree; therefore only support WindowClosed events for all windows (eg. src==root and scope
                // is descendants) or a specific WindowPattern element (src==root of a Window and scope is the element).
                // Also handle odd combinations (eg. src==specific element and scope is subtree|ancestors).

                bool paramsValidated = false;

                if (Misc.Compare(element, AutomationElement.RootElement))
                {
                    // For root element need to have Descendants scope set (Note: Subtree includes Descendants)
                    if ((scope & TreeScope.Descendants) == TreeScope.Descendants)
                    {
                        paramsValidated = true;
                    }
                }
                else
                {
                    // otherwise non-root elements must have the entire tree (Anscestors, Element and Descendants)...
                    if ((scope & (TreeScope.Ancestors | TreeScope.Element | TreeScope.Descendants)) == (TreeScope.Ancestors | TreeScope.Element | TreeScope.Descendants))
                    {
                        paramsValidated = true;
                    }
                    else if ((scope & TreeScope.Element) == TreeScope.Element)
                    {
                        // ...OR Element where the element implements WindowPattern
                        // PRESHARP will flag this as warning 56506/6506:Parameter 'element' to this public method must be validated: A null-dereference can occur here.
                        // False positive, element is checked, see above
#pragma warning suppress 6506
                        object val = element.GetCurrentPropertyValue(AutomationElement.NativeWindowHandleProperty);
                        if (val != null && val is int && (int)val != 0)
                        {
                            if (HwndProxyElementProvider.IsWindowPatternWindow(NativeMethods.HWND.Cast(new IntPtr((int)val))))
                            {
                                paramsValidated = true;
                            }
                        }
                    }
                }

                if (!paramsValidated)
                {
                    throw new ArgumentException(SR.Get(SRID.ParamsNotApplicableToWindowClosedEvent));
                }
            }

            // Add a client-side Handler for for this event request
            EventListener l = new EventListener(eventId, scope, null, CacheRequest.CurrentUiaCacheRequest);
            ClientEventManager.AddListener(element, eventHandler, l);
        }
Exemplo n.º 20
0
 public MenuController()
 {
     ClientEventManager.RegisterClientEvent("MENU_SELECT_EVENT", MenuSelectEvent);
     ClientEventManager.RegisterClientEvent("MENU_INDEX_CHANGE_EVENT", MenuIndexChangeEvent);
     ClientEventManager.RegisterClientEvent("MENU_CLOSE_EVENT", MenuCloseEvent);
 }
Exemplo n.º 21
0
 public override void OnRemove()
 {
     ClientEventManager.GetInstance().RemoveProcessFunction(GameEventID.GEDynamicHudPos_Add, OnEquipWeared);
 }