示例#1
0
        /// <summary>
        /// Disposes the interface reference.
        /// </summary>
        public void Dispose()
        {
            if (_interfaceRef != null)
            {
                _interfaceRef.Dispose();
                _interfaceRef = null;
            }

            _createCallback = null;
        }
示例#2
0
        /// <summary>
        /// Find all interface pointers
        /// </summary>
        public static void Init()
        {
            ClientInterface      = GetCreateInterfaceFunction("client.dll");
            EngineInterface      = GetCreateInterfaceFunction("engine.dll");
            VGUI2Interface       = GetCreateInterfaceFunction("vgui2.dll");
            VGUISurfaceInterface = GetCreateInterfaceFunction("vguimatsurface.dll");
            MaterialInterface    = GetCreateInterfaceFunction("materialsystem.dll");
            PhysicsInterface     = GetCreateInterfaceFunction("vphysics.dll");
            StdInterface         = GetCreateInterfaceFunction("vstdlib.dll");

            Client = new Client(GetInterfacePtr("VClient", ClientInterface));
            Engine = new Engine(GetInterfacePtr("VEngineClient", EngineInterface));
            Panel  = new Panel(GetInterfacePtr("VGUI_Panel", VGUI2Interface));
        }
示例#3
0
        public ViewRightLBViewModel(IEventAggregator aggregator)
        {
            //intilaises the events aggregator service
            _aggregator = aggregator;

            //Intialises the mouse over command delegate that points to a method
            mousenterCommand2 = new DelegateCommand <MouseEventArgs>(MouseEnterAction);

            //intialises the interface
            //IViewColours = new ChangeViewColours();
            IViewColours = CreateInterface.ReturnTheChangeViewColoursProperty();

            //Intialises the event listner for the event
            _aggregator.GetEvent <UpdateColourEvent>().Subscribe(SetNewBackgroundColourNew);
        }
        public ViewStatusBarViewModel(IEventAggregator aggregator)
        {
            //loads the data and starts the events listener from the prism engine
            _eventaggregator = aggregator;

            //Initialises the interface
            //ViewColours = new ChangeViewColours();
            ViewColours = CreateInterface.ReturnTheChangeViewColoursProperty();

            //subscribes to the event
            _eventaggregator.GetEvent <UpdateTagEvent>().Subscribe(UpdateTagSensed);

            //Changes the colour of the background by listening for the event
            _eventaggregator.GetEvent <UpdateColourEvent>().Subscribe(SetNewBackgroundColour);
        }
        public ViewButtonsRibbonViewModel(IEventAggregator agg)
        {
            //initialises the prism events listener interface
            _aggregator = agg;

            //Intialises the Interfaces
            //ViewColours = new ChangeViewColours();
            //ILinearGB = new ChangeGradient();
            ViewColours = CreateInterface.ReturnTheChangeViewColoursProperty();
            ILinearGB   = CreateInterface.ReturnTheChangeGradientProperty();

            //Intilaises the event listner
            _aggregator.GetEvent <UpdateColourEvent>().Subscribe(SetNewBackgroundColourNew);

            //assigns the mouse enter events to the prism delegate command obj
            mousenterCommand1 = new DelegateCommand <MouseEventArgs>(MouseEnterAction);

            //initialises the buttons
            Lineargb = ILinearGB.CreateLinearGradientFill(GradstopColour1, GradstopColour2);
        }
        public ViewUtilityButtonsViewModel(IEventAggregator agg)
        {
            //intilaises the events aggregator service
            _aggregator = agg;

            //Intialises the mouse over command delegate that points to a method
            mousenterCommand2 = new DelegateCommand <MouseEventArgs>(MouseEnterAction);

            //intialises the interfaces
            //ViewColours = new ChangeViewColours();
            //ILinearGB = new ChangeGradient();
            ViewColours = CreateInterface.ReturnTheChangeViewColoursProperty();
            ILinearGB   = CreateInterface.ReturnTheChangeGradientProperty();

            //Intialises the event listner for the event
            _aggregator.GetEvent <UpdateColourEvent>().Subscribe(SetNewBackgroundColour);

            //initialises the buttons
            Lineargb = ILinearGB.CreateLinearGradientFill(GradstopColour1, GradstopColour2);
        }
示例#7
0
        /// <summary>
        /// Find interface pointer
        /// </summary>
        /// <param name="interfaceName"></param>
        /// <param name="cInterface"></param>
        /// <returns></returns>
        private static IntPtr GetInterfacePtr(string interfaceName, CreateInterface cInterface)
        {
            string tempInterface    = "";
            string interfaceVersion = "0";

            for (int i = 0; i <= 99; i++)
            {
                tempInterface = interfaceName + interfaceVersion + i;
                var funcPtr = cInterface(tempInterface, 0);
                if (funcPtr != IntPtr.Zero)
                {
                    return(funcPtr);
                }
                if (i >= 99 && interfaceVersion == "0")
                {
                    interfaceVersion = "00";
                    i = 0;
                }
            }
            return(IntPtr.Zero);
        }
示例#8
0
        public ViewMenuBarViewModel(IEventAggregator eventaggregator)
        {
            //Assigns the event aggregator pool for recieving Pub/Sub events
            _eventaggregator = eventaggregator;

            //intialises the interfaces
            //ViewColours = new ChangeViewColours();
            //ILinearGB = new ChangeGradient();
            ViewColours = CreateInterface.ReturnTheChangeViewColoursProperty();
            ILinearGB   = CreateInterface.ReturnTheChangeGradientProperty();

            //Proccesses the bound interaction event trigger events to the method using a delegatecommand
            mousenterCommand = new DelegateCommand <MouseEventArgs>(MouseEnterAction);

            //Button for exit command on menuitems
            exitCommand = new DelegateCommand <string>(ExitApplication);

            //Command to change all the skin colours originates from the menu
            changecolourCommand = new DelegateCommand <string>(SetNewBackgroundColourNew);

            //Run Date and time updates every second
            RunTimer();
        }
示例#9
0
        public MainWindowViewModel(IRegionManager regionmanager, IEventAggregator aggregator)
        {
            //assigns the region manager object to the field
            _regionmanager = regionmanager;

            //intialises the IEvent aggregator object - enables event listening
            _aggregator = aggregator;

            //Intitialises the interfaces via the factory methods class
            //ViewColours = new ChangeViewColours();
            ViewColours = CreateInterface.ReturnTheChangeViewColoursProperty();

            //Configure the region manager and adds all the regions into the view
            _regionmanager.RegisterViewWithRegion("MenuBar", typeof(ViewMenuBar));
            _regionmanager.RegisterViewWithRegion("SearchTextBox", typeof(ViewSearchTextBox));
            _regionmanager.RegisterViewWithRegion("ButtonRibbons", typeof(ViewButtonsRibbon));
            _regionmanager.RegisterViewWithRegion("ListBoxesLeft", typeof(ViewLeftLB));
            _regionmanager.RegisterViewWithRegion("ListBoxesRight", typeof(ViewRightLB));
            _regionmanager.RegisterViewWithRegion("UtilityButtons", typeof(ViewUtilityButtons));
            _regionmanager.RegisterViewWithRegion("StatusBar", typeof(ViewStatusBar));

            //creates an event listener for the updatecolour event
            _aggregator.GetEvent <UpdateColourEvent>().Subscribe(SetNewBackgroundColourNew);
        }
        public ViewSearchTextBoxViewModel(IEventAggregator aggregator)
        {
            //Assigns the global events aggregator object
            _aggr = aggregator;

            //Assigns the command to the mouse enter event and passes the "MouseEventsArg"
            mousenterCommand3 = new DelegateCommand <MouseEventArgs>(MouseEnterAction);

            //Assigns the searchtextCommand to a delegate type points to a method
            //Observes the textsearch field.
            textsearchCommand = new DelegateCommand(CanExecute, Execute).ObservesProperty(() => textsearchCommand);

            //intialises the interfaces
            //ViewColours = new ChangeViewColours();
            //ILinearGB = new ChangeGradient();
            ViewColours = CreateInterface.ReturnTheChangeViewColoursProperty();
            ILinearGB   = CreateInterface.ReturnTheChangeGradientProperty();

            //Intialises the event listner for the event
            _aggr.GetEvent <UpdateColourEvent>().Subscribe(SetNewBackgroundColourNew);

            //initialises the buttons
            Lineargb = ILinearGB.CreateLinearGradientFill(GradstopColour1, GradstopColour2);
        }
示例#11
0
 private static IntPtr GetInterface(this IntPtr Library, string Function) => CreateInterface(Library)(Function, IntPtr.Zero);
示例#12
0
 // Use this for initialization
 private void Start()
 {
     this.transform.gameObject.AddComponent(typeof(CreateInterface));
     interface_handler = this.transform.gameObject.GetComponent<CreateInterface>();
 }
示例#13
0
 /// <summary>
 /// Constructs a new instance on the provided callback.
 /// </summary>
 /// <param name="createCallback"></param>
 public InterfaceManager(CreateInterface createCallback)
 {
     _createCallback = createCallback;
 }