Exemplo n.º 1
0
        public TrayApplicationContext()
        {
            MenuItem showMenuItem = new MenuItem("Show", new EventHandler(ShowForm));
            MenuItem hideMenuItem = new MenuItem("Hide", new EventHandler(HideForm));
            //MenuItem configMenuItem = new MenuItem("Import GBA Games", new EventHandler(ShowConfig));
            MenuItem exitMenuItem = new MenuItem("Exit", new EventHandler(Exit));

            notifyIcon.Icon = new Icon(SystemIcons.Application, 100, 100);
            //notifyIcon.ContextMenu = new ContextMenu(new MenuItem[] {showMenuItem,hideMenuItem,configMenuItem, exitMenuItem });
            notifyIcon.ContextMenu = new ContextMenu(new MenuItem[] { showMenuItem, hideMenuItem, exitMenuItem });
            notifyIcon.Visible     = true;

            mhf      = new MainHidden(this);
            gpd_form = new GpdLoader(this);
        }
Exemplo n.º 2
0
 public Exports(GpdLoader _parent)
 {
     this.parent = _parent;
     root_path   = Directory.GetCurrentDirectory() + "\\root";
 }
Exemplo n.º 3
0
        public void WorkThreadFunction()
        {
            GpdLoader frm = this.parent;


            bool xPressed = false;
            bool yPressed = false;

            bool firstDown = true;

            try
            {
                while (true)
                {
                    GamePadState state = GamePad.GetState(pi);
                    if (state.IsConnected == false)
                    {
                        GamePadState state1 = GamePad.GetState(PlayerIndex.One);
                        GamePadState state2 = GamePad.GetState(PlayerIndex.Two);
                        GamePadState state3 = GamePad.GetState(PlayerIndex.Three);
                        GamePadState state4 = GamePad.GetState(PlayerIndex.Four);
                        if (!state1.IsConnected && !state2.IsConnected && !state3.IsConnected && !state4.IsConnected)
                        {
                            break;
                        }
                        else
                        {
                            if (state1.IsConnected)
                            {
                                pi = PlayerIndex.One;
                            }
                            if (state2.IsConnected)
                            {
                                pi = PlayerIndex.Two;
                            }
                            if (state3.IsConnected)
                            {
                                pi = PlayerIndex.Three;
                            }
                            if (state4.IsConnected)
                            {
                                pi = PlayerIndex.Four;
                            }
                            continue;
                        }
                    }

                    if (state.DPad.Down == XInputDotNetPure.ButtonState.Pressed)
                    {
                        if (state.Buttons.B == XInputDotNetPure.ButtonState.Pressed)
                        {
                            frm.Invoke(new myDelegate(frm.InvokeScriptMove), new Object[] { 1 });
                        }
                        else
                        {
                            dpadDownDown = true;
                        }
                    }

                    if (state.DPad.Down == XInputDotNetPure.ButtonState.Released)
                    {
                        if (dpadDownDown == true)
                        {
                            dpadDownDown = false;
                            frm.Invoke(new myDelegate(frm.InvokeScriptMove), new Object[] { 1 });
                        }
                    }

                    if (state.DPad.Up == XInputDotNetPure.ButtonState.Pressed)
                    {
                        if (state.Buttons.B == XInputDotNetPure.ButtonState.Pressed)
                        {
                            frm.Invoke(new myDelegate(frm.InvokeScriptMove), new Object[] { -1 });
                        }
                        else
                        {
                            dpadUpDown = true;
                        }
                    }

                    if (state.DPad.Up == XInputDotNetPure.ButtonState.Released)
                    {
                        if (dpadUpDown == true)
                        {
                            dpadUpDown = false;
                            frm.Invoke(new myDelegate(frm.InvokeScriptMove), new Object[] { -1 });
                        }
                    }

                    if (state.Buttons.X == XInputDotNetPure.ButtonState.Pressed)
                    {
                        xPressed = true;
                    }

                    if (state.Buttons.X == XInputDotNetPure.ButtonState.Released)
                    {
                        if (xPressed == true)
                        {
                            xPressed = false;
                            frm.Invoke(new myDelegate(frm.InvokeScriptEnter), new Object[] { -1 });
                        }
                    }

                    if (state.Buttons.Y == XInputDotNetPure.ButtonState.Pressed)
                    {
                        yPressed = true;
                    }

                    if (state.Buttons.Y == XInputDotNetPure.ButtonState.Released)
                    {
                        if (yPressed == true)
                        {
                            yPressed = false;
                            frm.Invoke(new myDelegate(frm.InvokeScriptBack), new Object[] { -1 });
                        }
                    }

                    Thread.Sleep(16);
                }
            }
            catch (ThreadAbortException e)
            {
                ;
            }
            finally
            {
                dpadUpDown   = false;
                dpadDownDown = false;

                xPressed = false;
                yPressed = false;
            }

            return;
        }
Exemplo n.º 4
0
 public ControllerThread(GpdLoader _parent)
 {
     this.parent = _parent;
 }