コード例 #1
0
        public async void SearchDevices()
        {
            Btc.State = ConnectionState.Enumerating;
            await Btc.LookForBluetoothDevices();

            Btc.State = ConnectionState.Enumerated;
        }
コード例 #2
0
        public async void ConnectToBluetooth(DeviceInformation device)
        {
            Debugger.ReportToDebugger(this, "Connecting to Device ...", Debugger.Device.Pc);
            await Btc.ConnectToDevice(device);

            Btc.SendCommand(Command.ArduinoCommand(CommandName.Connected));
        }
コード例 #3
0
 public void SetAllTiles(Color color)
 {
     Table.SetAllTiles(color);
     Btc.SendCommand(Command.ArduinoCommand(CommandName.SetAllPixel, new List <string>()
     {
         color.R.ToString(), color.G.ToString(), color.B.ToString()
     }));
 }
コード例 #4
0
        public void GameUserInput(Game.GameUserInput direction)
        {
            byte directionCommand = 0;

            switch (direction)
            {
            case Game.GameUserInput.Right:
                directionCommand = 0;
                if (CurrentGame.Name == "Snake" && CurrentGameUserInput == Game.GameUserInput.Left)
                {
                    return;
                }
                CurrentGameUserInput = Game.GameUserInput.Right;
                break;

            case Game.GameUserInput.Up:
                directionCommand = 1;
                if (CurrentGame.Name == "Snake" && CurrentGameUserInput == Game.GameUserInput.Down)
                {
                    return;
                }
                CurrentGameUserInput = Game.GameUserInput.Up;
                break;

            case Game.GameUserInput.Left:
                directionCommand = 2;
                if (CurrentGame.Name == "Snake" && CurrentGameUserInput == Game.GameUserInput.Right)
                {
                    return;
                }
                CurrentGameUserInput = Game.GameUserInput.Left;
                break;

            case Game.GameUserInput.Down:
                directionCommand = 3;
                if (CurrentGame.Name == "Snake" && CurrentGameUserInput == Game.GameUserInput.Up)
                {
                    return;
                }
                CurrentGameUserInput = Game.GameUserInput.Down;
                break;

            case Game.GameUserInput.Action:
                directionCommand = 4;
                if (CurrentGame.Name == "Snake")
                {
                    return;
                }
                CurrentGameUserInput = Game.GameUserInput.Action;
                break;
            }
            Btc.SendCommand(Command.ArduinoCommand(CommandName.MoveDirection, new List <string>()
            {
                directionCommand.ToString()
            }));
        }
コード例 #5
0
        /*private static void OnFinishedFileTask(object sender, PortableLibrary1.TestModule.FileTaskEventArgs e)
         * {
         *
         * }*/

        public void StartGame(Game g)
        {
            if (g != null)
            {
                ModiIsPlaying        = true;
                CurrentGameUserInput = Game.GameUserInput.Right;
                CurrentGame          = g;
                Btc.SendCommand(Command.ArduinoCommand(g.CommandName));
            }
        }
コード例 #6
0
 public void PlayMusic(Track track)
 {
     if (track != null)
     {
         MusicIsPlaying = true;
         Btc.SendCommand(Command.ArduinoCommand(CommandName.PlayMusic, new List <string>()
         {
             track.StorageName
         }));
     }
 }
コード例 #7
0
 public void Disconnect()
 {
     if (ModiIsPlaying)
     {
         StopModi();
     }
     if (MusicIsPlaying)
     {
         StopMusic();
     }
     Btc.SendCommand(Command.ArduinoCommand(CommandName.Disconnect));
     Btc.Disconnect();
 }
コード例 #8
0
        public void StartModi(Model.Modi modi)
        {
            /*var fileManager = new PortableLibrary1.TestModule.FileTask();
             * fileManager.TaskCompletedEvent += new EventHandler<PortableLibrary1.TestModule.FileTaskEventArgs>(OnFinishedFileTask);*/
            /*******************************************************************/

            /*if(modi.CommandName == "9")
             * {
             *  Controller.Modi.RandomHsvModi rndHsv = new Controller.Modi.RandomHsvModi(this);
             *  rndHsv.Start();
             *  return;
             * }*/

            if (modi != null)
            {
                ModiIsPlaying = true;
                Btc.SendCommand(Command.ArduinoCommand(modi.CommandName));
            }
        }
コード例 #9
0
        public void SetTile(int column, int row, Color color)
        {
            Table.SetTile(column, row, color);
            int startPixel;

            if (row % 2 != 0)
            {
                startPixel = row * Columns + column;
            }
            else
            {
                startPixel = row * Columns + Columns - 1 - (column);
            }
            startPixel = startPixel * 3;
            Btc.SendCommand(Command.ArduinoCommand(CommandName.SetTile, new List <string>()
            {
                startPixel.ToString(), color.R.ToString(), color.G.ToString(), color.B.ToString()
            }));
        }
コード例 #10
0
ファイル: EFBackBtcRepository.cs プロジェクト: ScalpeI/SyncDB
 public void Create(Btc btc)
 {
     context.Btcs.Add(btc);
     context.SaveChanges();
 }
コード例 #11
0
ファイル: DtoFunds.cs プロジェクト: EriksonGM/ViolinBTCE
 public override int GetHashCode()
 {
     return(17 + 31 * Btc.GetHashCode() + 31 * Ltc.GetHashCode() + 31 * Nmc.GetHashCode() +
            31 * Nvc.GetHashCode() + 31 * Trc.GetHashCode() + 31 * Ppc.GetHashCode() +
            31 * Ftc.GetHashCode() + 31 * Usd.GetHashCode() + 31 * Eur.GetHashCode());
 }
コード例 #12
0
 public void ReportFreeRam()
 {
     Btc.SendCommand(Command.ArduinoCommand(CommandName.FreeRam));
 }
コード例 #13
0
 public void StopMusic()
 {
     MusicIsPlaying = false;
     Btc.SendCommand(Command.ArduinoCommand(CommandName.StopMusic));
 }
コード例 #14
0
 public void StopModi()
 {
     Btc.SendCommand(Command.ArduinoCommand(CommandName.StopModi));
     ModiIsPlaying = false;
 }