コード例 #1
0
 internal MainWindow(Archive a)
 {
     InitializeComponent();
       archive = a;
       if(!string.IsNullOrWhiteSpace(archive.settings.sound.backgroundSoundLoc)) {
     main = new SoundPlayer();
     main.SoundLocation = archive.settings.sound.backgroundSoundLoc.RelativeTo(Program.ArchivePath(archive));
     main.PlayLooping();
       }
       if(!string.IsNullOrWhiteSpace(archive.settings.sound.correctSoundLoc)) {
     yes = new SoundPlayer();
     yes.SoundLocation = archive.settings.sound.correctSoundLoc.RelativeTo(Program.ArchivePath(archive));
     yes.LoadAsync();
       }
       if(!string.IsNullOrWhiteSpace(archive.settings.sound.wrongSoundLoc)) {
     no = new SoundPlayer();
     no.SoundLocation = archive.settings.sound.wrongSoundLoc.RelativeTo(Program.ArchivePath(archive));
     no.LoadAsync();
       }
       Text = a.name;
       BackColor = archive.settings.backgroundColor;
       if(!string.IsNullOrWhiteSpace(archive.settings.backgroundLoc)) {
     BackgroundImage = archive.settings.background ?? Extensions.LoadImage(Program.ArchivePath(archive), archive.settings.backgroundLoc);
       }
       Current = new ModeSelect();
 }
コード例 #2
0
 /// <summary>
 /// Plays a stream Asychronously using the System.Media.SoundPlayer Object.
 /// </summary>
 /// <param name="S">Any stream, ex: a wav sound resource.</param>
 public void QuickPlay(System.IO.Stream S)
 {
     SoundPlayer wavPlayer = new SoundPlayer();
     wavPlayer.Stream = S;
     wavPlayer.LoadCompleted += new AsyncCompletedEventHandler(wavPlayer_LoadCompleted);
     wavPlayer.LoadAsync();
 }
コード例 #3
0
        // We want to control how depth data gets converted into false-color data
        // for more intuitive visualization, so we keep 32-bit color frame buffer versions of
        // these, to be updated whenever we receive and process a 16-bit frame.
        /*const int RED_IDX = 2;
        const int GREEN_IDX = 1;
        const int BLUE_IDX = 0;
        byte[] depthFrame32 = new byte[320 * 240 * 4];*/
        public ExerciseView(Exercise ex)
        {
            InitializeComponent();

            this.ex = ex;

            statusText.Text = ex.statusMessage;

            passSound = new SoundPlayer("Sounds/ExercisePass.wav");
            passSound.LoadAsync();
            failSound = new SoundPlayer("Sounds/ExerciseFail.wav");
            failSound.LoadAsync();

            #if DEBUG
            lastTime = DateTime.Now;

            fpsLabel = new Label();
            fpsLabel.Content = "FPS:";
            fpsLabel.FontSize = (double)Application.Current.Resources["SmallButtonFont"];
            fpsLabel.HorizontalContentAlignment = HorizontalAlignment.Center;
            fpsLabel.HorizontalAlignment = HorizontalAlignment.Left;
            bottomPanel.Children.Insert(0, fpsLabel);
            #endif

            #if AUDIOUI
            SharedContent.Sr.registerSpeechCommand(SharedContent.Commands.Stop, selectedResponse);
            #endif

            //SharedContent.Nui.DepthFrameReady += new EventHandler<ImageFrameReadyEventArgs>(nuiDepthFrameReady);
            SharedContent.Nui.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(nuiSkeletonFrameReady);
            SharedContent.Nui.VideoFrameReady += new EventHandler<ImageFrameReadyEventArgs>(nuiColorFrameReady);
        }
コード例 #4
0
ファイル: Sound.cs プロジェクト: nlaert/Sampler
	    public Sound(Stream strm)
	    {
           sound = new SoundPlayer(strm);
           sound.LoadAsync();
           sound.LoadCompleted += sound_LoadCompleted;
           playing = false;
	    }
コード例 #5
0
ファイル: AudioControl.cs プロジェクト: IceXPR/spdif-ka
        /// <summary>
        /// Start the audio playback which will keep the SPDIF link alive.
        /// </summary>
        public void start()
        {

            sound = new SoundPlayer(Properties.Resources.silence);
            sound.LoadCompleted += new AsyncCompletedEventHandler(wavPlayer_LoadCompleted);
            sound.LoadAsync();
            isSoundStarted = true;
        }
コード例 #6
0
        public RaceMainController()
        {
            InitializeComponent();
            Scheduler.OnSchedulerEvent += Scheduler_OnSchedulerEvent;
            relayBoard = RelayBoardDriver.Instance;
            _raceQueue = new List <MarconiRaceControllerLogic>();


            _soundPlayer = new SoundPlayer();
            Stream str = Marconi.Properties.Resources.marconi_race_sound1;

            _soundPlayer        = new System.Media.SoundPlayer();
            _soundPlayer.Stream = str;
            _soundPlayer.LoadAsync();


            dateTimePicker1.Format = DateTimePickerFormat.Time;
            dateTimePicker1.Value  = DateTime.Now.AddMinutes(1);
            internalClock          = new Timer();
            internalClock.Interval = 1000;
            internalClock.Tick    += InternalClock_Tick;
            internalClock.Start();

            panelButtons.Visible            = false;
            panelRaces.Visible              = false;
            oblist.UseAlternatingBackColors = true;

            this.Status.ImageGetter = delegate(object rowObject) {
                MarconiRaceControllerLogic s = (MarconiRaceControllerLogic)rowObject;
                if (s.LastEventCode == SailingRace.RaceEventCode.W)
                {
                    return("red");
                }
                else if (
                    s.LastEventCode == SailingRace.RaceEventCode.T1 ||
                    s.LastEventCode == SailingRace.RaceEventCode.T4 ||
                    s.LastEventCode == SailingRace.RaceEventCode.T5
                    )
                {
                    return("yellow");
                }

                else if (s.LastEventCode == SailingRace.RaceEventCode.T0)
                {
                    return("green");
                }

                else
                {
                    return("");
                }
            };

            var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

            lblVersion.Text = "Running version: " + version.ToString();
        }
コード例 #7
0
ファイル: AudioPlayer.cs プロジェクト: TommyAGK/Flex3
 public AudioPlayer(string SoundFileName)
 {
     var filePath = Directory.GetCurrentDirectory() + @"\Sounds" + SoundFileName;
             if (! File.Exists(filePath))
                 {
                     return;
                 }
             audiPlayer = new SoundPlayer {SoundLocation = filePath};
             audiPlayer.LoadAsync(); //async, because it could be a big file, and we dont want to lock up the system.
 }
コード例 #8
0
ファイル: AppTarget.cs プロジェクト: burstas/rmps
        public AppTarget(UserModel userModel)
        {
            _UserModel = userModel;

            _KeyboardSimulator = new KeyboardSimulator();
            _MouseSimulator = new MouseSimulator();
            _InputDeviceState = new WindowsInputDeviceStateAdaptor();
            _MediaPlayer = new SoundPlayer("letter.wav");
            _MediaPlayer.LoadAsync();
        }
コード例 #9
0
ファイル: Sounds.cs プロジェクト: benjy3gg/PoeHud
        public static void PreLoadSound(string fileName)
        {
            SoundPlayer sp;
            if (allSounds.TryGetValue(fileName, out sp)) return;

            try {
                allSounds[fileName] = null;
                sp = new SoundPlayer(fileName);
                sp.LoadCompleted += (s, e) => { if( !e.Cancelled && e.Error == null ) allSounds[fileName] = sp; };
                sp.LoadAsync();
            } catch (Exception ex) {
                MessageBox.Show("Error when loading " + fileName + ": " + ex.Message);
                Environment.Exit(0);
            }
        }
コード例 #10
0
ファイル: Form1.cs プロジェクト: Graveion/AudioSpectrum
        private void button1_Click(object sender, EventArgs e)
        {
            // Hook up the Elapsed event for the timer.
            int milli = (int)((217f / AV.spectralGraph.Length)* 1000);
            dispatcherTimer = new DispatcherTimer();
            dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
            dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, milli);

            wavPlayer = new SoundPlayer();
            wavPlayer.SoundLocation = audiofilename;
            wavPlayer.LoadCompleted += new AsyncCompletedEventHandler(wavPlayer_LoadCompleted);

            dispatcherTimer.Start();
            wavPlayer.LoadAsync();
        }
コード例 #11
0
    System.Media.SoundPlayer sound;                                                                         // for music

    // initialize
    public void Init()
    {
        // load meshes
        teapot   = new Mesh("../../assets/teapot.obj");
        floor    = new Mesh("../../assets/floor.obj");
        city     = new Mesh("../../assets/city.obj");
        scraper  = new Mesh("../../assets/scraper.obj");
        mountain = new Mesh("../../assets/mountain.obj");
        moon     = new Mesh("../../assets/moon.obj");
        // initialize stopwatch
        timer = new Stopwatch();
        timer.Reset();
        timer.Start();
        // create shaders
        shader    = new Shader("../../shaders/vs.glsl", "../../shaders/fs.glsl");
        skyshader = new Shader("../../shaders/vs_skydome.glsl", "../../shaders/fs_skydome.glsl");
        postproc  = new Shader("../../shaders/vs_post.glsl", "../../shaders/fs_post.glsl");
        // load the textures
        wood       = new Texture("../../assets/wood.jpg");
        skytex     = new Texture("../../assets/space.jpg");
        windows    = new Texture("../../assets/city.jpg");
        asphalt    = new Texture("../../assets/asphalt.jpg");
        skyscraper = new Texture("../../assets/skyscraper.jpg");
        mnt        = new Texture("../../assets/grass.jpg");
        planet     = new Texture("../../assets/moon.jpg");
        // create the render target
        target = new RenderTarget(screen.width, screen.height);
        quad   = new ScreenQuad();
        // create scenegraph and main object
        sceneGraph = new SceneGraph();
        teapots    = new List <SceneObject>();
        // initialize matrices
        cameraMatrix = Matrix4.Identity;
        worldMatrix  = Matrix4.CreateFromAxisAngle(new Vector3(0, 1, 0), a);
        rotation     = Matrix4.Identity; //no rotation at the beginning
        // ambient light preparation
        int ambientID = GL.GetUniformLocation(shader.programID, "ambientColor");

        GL.UseProgram(shader.programID);
        GL.Uniform3(ambientID, 0.25f, 0.25f, 0.25f);
        // prepare sound
        sound = new System.Media.SoundPlayer();
        sound.SoundLocation = "../../assets/ori.wav";
        sound.LoadAsync();
        sound.PlayLooping();
        // prepare scene
        CreateScene();
    }
コード例 #12
0
ファイル: CLogic.cs プロジェクト: lantian2012/3DS-GuitarHero
 public CLogic(MOptions option)
 {
     _SoundPlayer = new SoundPlayer();
     _CNote = new CNote(3);
     LeftShadow = new CShadow(250,150);
     RightShadow = new CShadow(450,150);
     _CMusicHit = new CMusicHit(option.MusicHitFilePath);
     _SoundPlayer.SoundLocation = @option.MusicMediaFilePath;
     //_SoundPlayer.SoundLocation = @"D:\Gangnam.wav";
     _SoundPlayer.LoadAsync();
     _CNote.Speed = _CMusicHit.Speed;
     _TotalTime = _CMusicHit.EndTime;
     Score = 0;
     Progress = 0;
     isStart = false;
 }
コード例 #13
0
ファイル: List.cs プロジェクト: LaoArchAngel/WRadar
        /// <summary>
        /// Adds a new wav file to the available sounds for tracking.
        /// </summary>
        /// <param name="soundPath">Full path of the new sound.</param>
        public static void Add(string soundPath)
        {
            var newSound = new FileInfo(soundPath);

            if (!newSound.Exists || !newSound.Extension.Equals(".wav")) return;

            var name = newSound.Name;
            var index = 0;

            while (Sounds.ContainsKey(name))
            {
                name = string.Format("{0}_{1:D3}.wav", name.Remove(-4), index++);
            }

            newSound = newSound.CopyTo(string.Format("{0}\\{1}", SOUND_DIRECTORY, name));
            var sound = new SoundPlayer(newSound.FullName);
            sound.LoadAsync();

            Sounds.Add(name, sound);
        }
コード例 #14
0
ファイル: SoundUtils.cs プロジェクト: Rampant-ai/Senesco
      /// <summary>
      /// Adds or replaces a sound by name and file path.
      /// </summary>
      /// <param name="soundName">The name of the sound to load.</param>
      /// <param name="filePath">The path of the sound file.</param>
      /// <returns>True upon error, false otherwise.</returns>
      public static Status SetSound(SoundEffect soundName, string filePath)
      {
         // If the path is bad, 
         if (String.IsNullOrEmpty(filePath) == true || File.Exists(filePath) == false)
         {
            s_log.ErrorFormat("Bad path provided: {0}", filePath);
            return Status.Failure;
         }

         // Make the SoundPlayer and save the sound name as the Tag.
         SoundPlayer player = new SoundPlayer(filePath);
         player.Tag = soundName;

         // Start loading the file.
         s_log.DebugFormat("Starting load of sound {0}.", player.SoundLocation);
         player.LoadCompleted += SoundLoadComplete;
         player.LoadAsync();

         return Status.Success;
      }
コード例 #15
0
        // constructor
        public mainScreen(int gameId)
        {
            this.gameId = gameId;

            InitializeComponent();
            //territories = new List<Territory>();
            //pictureBox1.Image = Image.FromFile("images/map1.png");

            DrawArea = new Bitmap(Image.FromFile("images/map2.png"));
            //DrawArea = new Bitmap(pictureBox1.Size.Width, pictureBox1.Size.Height);
            pictureBox1.Image = DrawArea;

            yourTurn = false;

            string soundLocation = "sounds/explosion-01.wav";
            player = new SoundPlayer(soundLocation);

            // Load the .wav file.
            player.LoadAsync();
        }
        private void loadAsyncButton_Click(System.Object sender, EventArgs e)
        {
            // Disable playback controls until the .wav is
            // successfully loaded. The LoadCompleted event
            // handler will enable them.
            EnablePlaybackControls(false);

            try
            {
                // Assign the selected file's path to
                // the Sound object.
                sound.SoundLocation = this.filepathTextbox.Text;

                // Load the .wav file.
                sound.LoadAsync();
            }
            catch (Exception ex)
            {
                ReportStatus(ex.Message);
            }
        }
コード例 #17
0
ファイル: List.cs プロジェクト: LaoArchAngel/WRadar
        /// <summary>
        /// Loads each of the sounds available for tracking use to memory.
        /// </summary>
        public static void Load()
        {
            // Only load if not yet loaded.
            if (Sounds != null)
                return;

            Sounds = new Dictionary<string, SoundPlayer>();

            var dir = new DirectoryInfo(SOUND_DIRECTORY);

            foreach (var fileInfo in dir.GetFiles("*.wav"))
            {
                var s = new SoundPlayer(fileInfo.FullName);
                s.LoadAsync();

                Sounds.Add(fileInfo.Name, s);
            }

            if (Sounds.Count > 0)
                Default = Sounds.First().Value;
        }
コード例 #18
0
ファイル: Player.cs プロジェクト: KH8/AmpIdent
        public static void Play(Button sender, string path)
        {
            var button = sender;

            if (!_playing)
            {
                _sp = new SoundPlayer();
                _sp.Stop();
                _sp.SoundLocation = path;
                _sp.LoadAsync();
                _sp.Play();
                _playing = true;
                button.Content = "Stop";
            }
            else
            {
                _sp.Stop();
                _playing = false;
                button.Content = "Play";
            }
        }
コード例 #19
0
ファイル: MediaHelper.cs プロジェクト: GitWPeng/Helper
        /// <summary>
        /// 以异步方式播放wav文件
        /// </summary>
        /// <param name="sp">SoundPlayer对象</param>
        /// <param name="wavFilePath">wav文件的路径</param>
        public static void ASyncPlayWAV(SoundPlayer sp, string wavFilePath)
        {
            try
            {
                //设置wav文件的路径
                sp.SoundLocation = wavFilePath;

                //使用异步方式加载wav文件
                sp.LoadAsync();

                //使用异步方式播放wav文件
                if (sp.IsLoadCompleted)
                {
                    sp.Play();
                }
            }
            catch (Exception ex)
            {
                string errStr = ex.Message;
                throw ex;
            }
        }
コード例 #20
0
ファイル: MediaHelper.cs プロジェクト: GitWPeng/Helper
        /// <summary>
        /// 以异步方式播放wav文件
        /// </summary>
        /// <param name="wavFilePath">wav文件的路径</param>
        public static void ASyncPlayWAV(string wavFilePath)
        {
            try
            {
                //创建一个SoundPlaryer类,并设置wav文件的路径
                SoundPlayer sp = new SoundPlayer(wavFilePath);

                //使用异步方式加载wav文件
                sp.LoadAsync();

                //使用异步方式播放wav文件
                if (sp.IsLoadCompleted)
                {
                    sp.Play();
                }
            }
            catch (Exception ex)
            {
                string errStr = ex.Message;
                throw ex;
            }
        }
コード例 #21
0
ファイル: SoundPlayer.cs プロジェクト: farajfarook/ow-chat
        public static void loadSoundResources()
        {
            try
            {
                appPath = Application.StartupPath;

                buzzPlayer = new SoundPlayer(appPath+ "\\sounds\\beep.wav");
                buzzPlayer.LoadAsync();

                signInPlayer = new SoundPlayer(appPath + "\\sounds\\online.wav");
                signInPlayer.LoadAsync();

                signOutPlayer = new SoundPlayer(appPath + "\\sounds\\offline.wav");
                signOutPlayer.LoadAsync();

                doneLoading = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in loading sounds : " + ex.Message, "ow-chat Sound System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
コード例 #22
0
 public void PlaySound(string s, Action done)
 {
     if (s.ToLower().StartsWith("system:"))
     {
         string sound = s.Split(':')[1].ToLower().Trim();
         if (sound == "asterisk") SystemSounds.Asterisk.Play();
         if (sound == "beep") SystemSounds.Beep.Play();
         if (sound == "exclamation") SystemSounds.Exclamation.Play();
         if (sound == "hand") SystemSounds.Hand.Play();
         if (sound == "question") SystemSounds.Question.Play();
         done();
     }
     else
     {
         SoundPlayer p = new SoundPlayer(s);
         p.LoadCompleted += (a, b) =>
         {
             p.Play();
             done();
         };
         p.LoadAsync();
     }
 }
コード例 #23
0
        public CalibratingView(Exercise ex)
        {
            InitializeComponent();

            this.ex = ex;

            secondPassedSound = new SoundPlayer("Sounds/Countdown.wav");
            secondPassedSound.LoadAsync();
            snapshotSound = new SoundPlayer("Sounds/Camera.wav");
            snapshotSound.LoadAsync();
            
            secondsLeft = SharedContent.CalibrationSeconds * ex.getPosesToBeCalibrated().Count();
            secondsLabel.Content = String.Format("{0}", SharedContent.CalibrationSeconds);
            capturing = false;
            hasCaptured = false;

            timer = new DispatcherTimer();
            timer.Interval = new TimeSpan(0, 0, 1);
            timer.Tick += timerSecondPassed;
            timer.Start();

            currentPoseBeingCalibrated = 0;
            drawPose();
        }
コード例 #24
0
        private async void Init()
        {
            await Task.Run(() =>
            {
                _soundPlayer = new SoundPlayer();

                _audioReader = new AudioFileReader("http://netradio.webfm.dk/Mobil") { Volume = 0.2f };

                _wavePlayer = new WaveOutEvent();
                _wavePlayer.Init(_audioReader);

                _str = Properties.Resources.ding6;
                _soundPlayer.Stream = _str;
                _soundPlayer.LoadAsync();

                Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() =>
                {
                    Volume = 0.5f;
                    Status = "WEBfm ready";
                    Ready = true;
                }));

            });
        }
コード例 #25
0
ファイル: MyPieces.cs プロジェクト: anhtenanhminh/FunnyRacing
 public vicPiece Start(MyBoard board, int index)
 {
     vicPiece vic = new vicPiece();
     vic.index = -1;
     vic.nType = 0;
     //KT bomb
     if (board.arrSquares[_startIndex].bomb != 0 &&
         board.arrSquares[_startIndex].bomb != nType && Buff != 2) //Co bomb k fai cua doi minh
     {
         board.arrSquares[_startIndex].shield = 0;
         board.arrSquares[_startIndex].shadow = 0;
         InCage();
         board.arrSquares[_startIndex].bomb = 0;
         SoundPlayer sound1 = new SoundPlayer(@"Resources\Audio\ExClose.wav");
         sound1.LoadAsync();
         sound1.Play();
         sound1.Dispose();
         Started = false;
         Ended = false;
         return vic;
     }
     if (board.arrSquares[_startIndex].shadow != 1)
     {
         vic.nType = board.arrSquares[_startIndex].status;
         vic.index = board.arrSquares[_startIndex].curIndex;
     }
     _curPoint = start;
     _curIndex = _startIndex;
     board.arrSquares[_curIndex].status = nType;
     board.arrSquares[_curIndex].curIndex = index;
     SoundPlayer sound = new SoundPlayer(@"Resources\Audio\Start.wav");
     sound.LoadAsync();
     sound.Play();
     sound.Dispose();
     return vic;
 }
コード例 #26
0
ファイル: MyPieces.cs プロジェクト: anhtenanhminh/FunnyRacing
 public void UpRand(int x, MyBoard board)
 {
     if (_curEnd == 0)
         board.arrSquares[curIndex].status = 0;
     if (x > _curEnd)
     {
         board.arrEndSquares[nType - 1].empty[_curEnd] = true;
         _curEnd = x - 1;
         board.arrEndSquares[nType - 1].empty[_curEnd] = false;
         _curPoint = board.arrEndSquares[nType - 1].p[_curEnd];
         SoundPlayer sound = new SoundPlayer(@"Resources\Audio\UpRand.wav");
         sound.LoadAsync();
         sound.Play();
         sound.Dispose();
         if (_curEnd >= 2)
         {
             int dem = 0;
             for (int i = 5; i > _curEnd; i--)
             {
                 if (!board.arrEndSquares[nType - 1].empty[i])
                     dem++;
             }
             if (dem == (5 - _curEnd))
                 this._isFinish = true;
         }
     }
 }
コード例 #27
0
        public void SignalUpdate(Dictionary<Protocol, Signal> protocolSignal)
        {
            isUpdateSignal = false;
               isUpdateCandleSignal = false;
               Protocol protocol = protocolSignal.Keys.First();
               Signal signal = (Signal)protocolSignal.Values.First();
               Console.WriteLine("  signal   " + signal);
               LogUtil.Info("  signal   " + signal);
               if (dataCache.DataUnits.ContainsKey(currentTInterval))
               {
               lock (dataCache.DataUnits[currentTInterval])
               {
                   if (timerAuto != null)
                   {
                       timerAuto.Stop();
                   }
                   for (int i = dataCache.DataUnits[currentTInterval].Count - 1; i >= 0; i--)
                   {
                       BarData data = dataCache.DataUnits[currentTInterval][i];
                       if (data.SignalList == null)
                           data.SignalList = new List<CandleSignal>();
                       if (protocol==Protocol.K0004_1 && signal.Arrow != 0 && data.DateTime.CompareTo(signal.ActTime) == 0)
                       {
                           isUpdateCandleSignal = true;
                           CandleSignal cs = new CandleSignal(signal, 1);
                           data.SignalList.Add(cs);
                           dataCache.DataUnits[currentTInterval][i] = data;
                           break;
                       }
                       if (protocol == Protocol.K0004_3 &&  signal.GainTip != 0 && data.DateTime.CompareTo(signal.GainTipTime) == 0)
                       {
                           isUpdateCandleSignal = true;
                           CandleSignal cs = new CandleSignal(signal, 2);
                           data.SignalList.Add(cs);
                           dataCache.DataUnits[currentTInterval][i] = data;
                           break;
                       }
                       if (protocol == Protocol.K0004_2 && signal.StopLoss != 0 && data.DateTime.CompareTo(signal.StopLossTime) == 0)
                       {
                           isUpdateCandleSignal = true;
                           CandleSignal cs = new CandleSignal(signal, 3);
                           data.SignalList.Add(cs);
                           dataCache.DataUnits[currentTInterval][i] = data;
                           break;
                       }
                       if (protocol == Protocol.K0004_4 && signal.StopGain != 0 && data.DateTime.CompareTo(signal.StopGainTime) == 0)
                       {
                           isUpdateCandleSignal = true;
                           CandleSignal cs = new CandleSignal(signal, 4);
                           data.SignalList.Add(cs);
                           dataCache.DataUnits[currentTInterval][i] = data;
                           break;
                       }
                       if (data.DateTime.CompareTo(signal.ActTime) < 0)
                       {
                           break;
                       }
                   }
               }
               }
               if (isUpdateCandleSignal)
               {
               Process(null, null);
               }
               else
               {
               RealTimeData rtd = new RealTimeData();
               rtd.symbol = symbol;
               if (protocol == Protocol.K0004_1)
               {
                   rtd.dateTime = signal.ActTime;
                   rtd.datas = new double[] { signal.ActPrice };
               }
               else if (protocol == Protocol.K0004_2)
               {
                   rtd.dateTime = signal.StopLossTime;
                   rtd.datas = new double[] { signal.StopLossBidPrice };
               }
               else if (protocol == Protocol.K0004_3)
               {
                   rtd.dateTime = signal.GainTipTime;
                   rtd.datas = new double[] { signal.GainTipPrice };
               }
               else if (protocol == Protocol.K0004_4)
               {
                   rtd.dateTime = signal.StopGainTime;
                   rtd.datas = new double[] { signal.StopGainPrice };
               }
               dataCache.UpdateDataSource(rtd);
               isUpdateCandleSignal = true;
               }

               LogUtil.Info("  dataCache.CurrentTimes[currentTInterval]   " + dataCache.CurrentTimes[currentTInterval]);
               if (dataCache.CurrentTimes[currentTInterval].CompareTo(signal.ActTime) == 0)
               {
               lock (dataCache.CurrentDatas[currentTInterval])
               {
                   if (protocol == Protocol.K0004_1 && signal.Arrow != 0)
                   {
                       CandleSignal cs = new CandleSignal(signal, 1);
                       if (!dataCache.CurrentDatas[currentTInterval].SignalList.Contains(cs))
                       dataCache.CurrentDatas[currentTInterval].SignalList.Add(cs);

                       isUpdateSignal = true;
                   }
               }
               }
               if (dataCache.CurrentTimes[currentTInterval].CompareTo(signal.GainTipTime) == 0)
               {
               lock ( dataCache.CurrentDatas[currentTInterval])
               {
                   if (protocol == Protocol.K0004_3 && signal.GainTip != 0)
                   {
                       CandleSignal cs = new CandleSignal(signal, 2);
                       if (!dataCache.CurrentDatas[currentTInterval].SignalList.Contains(cs))
                       dataCache.CurrentDatas[currentTInterval].SignalList.Add(cs);
                       isUpdateSignal = true;
                   }
               }
               }
               if (dataCache.CurrentTimes[currentTInterval].CompareTo(signal.StopLossTime) == 0)
               {
               lock (dataCache.CurrentDatas[currentTInterval])
               {
                   if (protocol == Protocol.K0004_2 && signal.StopLoss != 0)
                   {
                       CandleSignal cs = new CandleSignal(signal, 3);
                       if (!dataCache.CurrentDatas[currentTInterval].SignalList.Contains(cs))
                       dataCache.CurrentDatas[currentTInterval].SignalList.Add(cs);
                       isUpdateSignal = true;
                   }
               }
               }
               if (dataCache.CurrentTimes[currentTInterval].CompareTo(signal.StopGainTime) == 0)
               {
               lock (dataCache.CurrentDatas[currentTInterval])
               {
                   if (protocol==Protocol.K0004_1 &&signal.StopGain != 0)
                   {
                       CandleSignal cs = new CandleSignal(signal, 4);
                       if (!dataCache.CurrentDatas[currentTInterval].SignalList.Contains(cs))
                       dataCache.CurrentDatas[currentTInterval].SignalList.Add(cs);
                       isUpdateSignal = true;
                   }
               }
               }
               LogUtil.Info(" isUpdateSignal   " + isUpdateSignal);
               if (isUpdateSignal || isUpdateCandleSignal)
               {
               AppContext.TradeAnalyzerControl.AddSignalSymbol(signal.Symbol);
               AppContext.TradeAnalyzerControl.ActiveTimer();
               if (AppContext.IsOpenSpeaker)
               {
                   System.Media.SoundPlayer player = new SoundPlayer(Properties.Resources.chimes);
                   player.LoadAsync();
                   player.Play();
               }
               }
               Process(null, null);
               isUpdateSignal = false;
               isUpdateCandleSignal = false;
               if (timerAuto != null)
               {
               timerAuto.Start();
               }
        }
コード例 #28
0
ファイル: MyPieces.cs プロジェクト: anhtenanhminh/FunnyRacing
        public vicPiece MoveSteponStep(MyBoard board, int index)
        {
            vicPiece vic = new vicPiece();
            vic.index = -1;
            vic.nType = 0;
            IsChoice = true;

            board.arrSquares[curIndex].status = 0;
            board.arrSquares[curIndex].curIndex = -1;
            board.arrSquares[curIndex].shadow = 0;
            board.arrSquares[curIndex].shield = 0;

            curIndex = (curIndex + 1) % 56;
            if (board.arrSquares[_curIndex].bomb != 0 &&
               board.arrSquares[_curIndex].bomb != nType && Buff != 6 && Buff != 2) //Co bomb k fai cua doi minh
            {
                board.arrSquares[_startIndex].shield = 0;
                board.arrSquares[_startIndex].shadow = 0;
                board.arrSquares[_curIndex].bomb = 0;
                InCage();
                vic.nType = -2;
                SoundPlayer sound1 = new SoundPlayer(@"Resources\Audio\ExClose.wav");
                sound1.LoadAsync();
                sound1.Play();
                Started = false;
                Ended = false;
                sound1.Dispose();
                return vic;
            }
            if (board.arrSquares[_curIndex].shadow != 1 && board.arrSquares[_curIndex].status != nType)
            {
                vic.nType = board.arrSquares[_curIndex].status;
                vic.index = board.arrSquares[_curIndex].curIndex;
            }
            if (board.arrSquares[curIndex].status == nType) // nguoi doi minh
                curIndex = (curIndex + 1) % 56;
            _curPoint = board.arrSquares[curIndex].square;
            board.arrSquares[_curIndex].status = nType;
            board.arrSquares[_curIndex].curIndex = index;
            if (curIndex == _endIndex)
                _ended = true;
            return vic;
        }
コード例 #29
0
        public MarconiRaceController()
        {
            InitializeComponent();
            relayBoard = RelayBoardDriver.Instance;

            logic     = new MarconiRaceControllerLogic();
            _raceList = new List <MarconiRaceControllerLogic>();
            _raceList.Add(logic);

            if (ConfigurationManager.AppSettings["HornPatternEventT5"] != null)
            {
                logic.HornPatternEventT5 = ConfigurationManager.AppSettings["HornPatternEventT5"];
            }
            else
            {
                logic.HornPatternEventT5 = "1,1";
            }

            if (ConfigurationManager.AppSettings["HornPatternEventT4"] != null)
            {
                logic.HornPatternEventT4 = ConfigurationManager.AppSettings["HornPatternEventT4"];
            }
            else
            {
                logic.HornPatternEventT4 = "1,1";
            }


            if (ConfigurationManager.AppSettings["HornPatternEventT1"] != null)
            {
                logic.HornPatternEventT1 = ConfigurationManager.AppSettings["HornPatternEventT1"];
            }
            else
            {
                logic.HornPatternEventT1 = "1,1";
            }


            if (ConfigurationManager.AppSettings["HornPatternEventStart"] != null)
            {
                logic.HornPatternEventStart = ConfigurationManager.AppSettings["HornPatternEventStart"];
            }
            else
            {
                logic.HornPatternEventStart = "1,1";
            }


            if (ConfigurationManager.AppSettings["HornPatternEventGeneralRecall"] != null)
            {
                logic.HornPatternEventGeneralRecall = ConfigurationManager.AppSettings["HornPatternEventGeneralRecall"];
            }
            else
            {
                logic.HornPatternEventGeneralRecall = "1,1";
            }

            if (ConfigurationManager.AppSettings["HornPatternIndividualRecall"] != null)
            {
                logic.HornPatternIndividualRecall = ConfigurationManager.AppSettings["HornPatternIndividualRecall"];
            }
            else
            {
                logic.HornPatternIndividualRecall = "1,1";
            }

            System.Media.SoundPlayer _soundPlayer = new SoundPlayer();
            Stream str = Marconi.Properties.Resources.marconi_race_sound1;

            _soundPlayer        = new System.Media.SoundPlayer();
            _soundPlayer.Stream = str;
            _soundPlayer.LoadAsync();

            logic.InternalPlayer = _soundPlayer;

            logic.BoardDriver = relayBoard;
            logic.EventReset();


            this.btGeneralRecall.Enabled     = false;
            this.btnIndividualRecall.Enabled = false;



            this.lblRelayBoardStatusValue.Text = relayBoard.RelayBoardMessage;
        }
コード例 #30
0
        //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
        //+++++++++++++++++++++++++++ Computer AI +++++++++++++++++++++++++++++++++++++++++++++++++++//
        private void comAI()
        {
            go = Shaking();
            changeTurn(go);
            //Kiểm tra sử dụng Hổ báo
            if (hasProp)
            {
                isCrossUsed();
            }
            if (cage[turn].CanAction(go))
            {
                if (hasProp)
                {
                    isActiveProp();
                }
                int pieceindex;
                if ((cage[turn].Cross || cage[turn].SpeedUp || cage[turn].GetTurn) && cage[turn].PriP != -2)
                {
                    pieceindex = cage[turn].PriP + 10;
                    if (cage[turn].Pieces[pieceindex - 10].moveFail(go, board))
                    {
                        pieceindex = cage[turn].CheckPieceAI(go);
                    }
                    cage[turn].PriP = -2;
                }
                else
                {
                    pieceindex = cage[turn].CheckPieceAI(go);
                }
                if (pieceindex >= 10 && pieceindex <= 13)
                {
                    if (cage[turn].SpeedUp)
                        go = SpeedUp(turn, pieceindex - 10, go);
                    Process(turn, pieceindex - 10);

                }
                else
                {
                    if (pieceindex >= 20)
                    {
                        vic = cage[turn].Action_AI(go, pieceindex - 20);
                        this.Invoke(new AntiCrossThreadNoArgument(Refresh));
                        if (win)
                            goto exit;
                    }
                    if (pieceindex < 10)
                    {
                        vic = cage[turn].Action_AI(go, pieceindex);
                        this.Invoke(new AntiCrossThreadNoArgument(Refresh));
                    }
                }
            }
            if (turn == nextturn)
            {
                comAI();
            }
            else
            {
                if (!cage[turn].GetTurn)
                {
                    pString.Image = imglstString.Images[nextturn];
                    if (!pString.InvokeRequired)
                        pString.Visible = true;
                    else
                        pString.Invoke(new AntiCrossThread2Argument(SetVisible), pString, true);
                    //Refresh();
                    //Xóa đạo cụ chủ động nếu có xài
                    if (cage[turn].Cross)
                    {
                        cage[turn].Cross = false;
                        cage[turn].clearbuff(board);
                    }
                    if (cage[turn].SpeedUp)
                    {
                        cage[turn].SpeedUp = false;
                        cage[turn].clearbuff(board);//bug
                    }

                    if (cage[nextturn].Hide) //Xóa đạo cụ của địch
                    {
                        for (int i = 0; i < cage[nextturn].nPieces; i++)
                        {
                            MyPieces p = cage[nextturn].Pieces[i];
                            if (p.Started && !p.Ended)
                            {
                                int t = board.arrSquares[p.curIndex % 56].status;
                                if (t != nextturn + 1)
                                {
                                    if (t != 0)
                                    {
                                        int team = board.arrSquares[p.curIndex % 56].status - 1;
                                        int index = board.arrSquares[p.curIndex % 56].curIndex;
                                        cage[team].Update(index);
                                        SoundPlayer sound = new SoundPlayer(@"Resources\Audio\Kick.wav");
                                        sound.LoadAsync();
                                        sound.Play();
                                        sound.Dispose();
                                        this.Invoke(new AntiCrossThreadNoArgument(Refresh));
                                        //Thread.Sleep(300);
                                    }
                                    board.arrSquares[p.curIndex % 56].status = nextturn + 1;
                                    board.arrSquares[p.curIndex % 56].curIndex = i;
                                }
                            }
                        }
                        cage[nextturn].Hide = false;
                        cage[nextturn].clearbuff(board);
                    }
                    if (cage[nextturn].Shield) // Xóa đạo cụ của địch
                    {
                        cage[nextturn].Shield = false;
                        cage[nextturn].clearbuff(board);
                    }

                    for (int i = 0; i < cage[turn].nPieces; i++)
                    {
                        if (cage[turn].Pieces[i].IsChoice)
                            cage[turn].Pieces[i].IsChoice = false;
                    }
                    this.Invoke(new AntiCrossThreadNoArgument(Refresh));
                    if (cage[turn].Useprop)
                        cage[turn].Useprop = false;
                    //KT dùng passiveprop sau khi kết thúc lượt đi
                    if (hasProp)
                    {
                        isPassiveProp();
                    }
                    //Thread.Sleep(200);
                    pString.Invoke(new AntiCrossThread2Argument(SetVisible), pString, false);
                    pShake.Invoke(new AntiCrossThread3Argument(SetImage), pShake, imglstShake.Images[nextturn], 1);
                    btnShake.Invoke(new AntiCrossThread3Argument(SetImage), btnShake, imglstShake.Images[nextturn], 0);
                    turn = nextturn;
                    if (cage[nextturn].isPlayer)
                    {
                        pShake.Invoke(new AntiCrossThread2Argument(SetVisible), pShake, false);
                        btnShake.Invoke(new AntiCrossThread2Argument(SetVisible), btnShake, true);
                    }
                    else
                    {
                        comAI();
                    }
                }
                else
                {
                    MessageBox.Show("Tiếp tục 1 lượt nữa.");
                    cage[turn].GetTurn = false;
                    nextturn = turn;
                    //Refresh();
                    comAI();
                }
            }
            exit:
            if (win && !first)
            {
                first = true;
                Congratulation(turn);
                this.Invoke(new AntiCrossThreadNoArgument(frmMenu.Show));
                this.Invoke(new AntiCrossThreadNoArgument(Dispose));
            }
        }
コード例 #31
0
        //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
        //++++++++++++++++++++++++++++ Player +++++++++++++++++++++++++++++++++++++++++++++++++++++++//
        public void playerProcess()
        {
            if (turn != nextturn)
            {
                if (!cage[turn].GetTurn)
                {
                    btnShake.Visible = false;
                    pShake.Visible = true;

                    if (!useProp && hasProp)
                    {
                        for (int i = 0; i < 6; i++)
                            btnBuff[i].Enabled = false;
                    }
                    else
                    {
                        useProp = false;
                    }

                    for (int i = 0; i < cage[turn].nPieces; i++)
                    {
                        if (cage[turn].Pieces[i].IsChoice)
                            cage[turn].Pieces[i].IsChoice = false;
                    }

                    if (cage[turn].Cross)
                    {
                        cage[turn].Cross = false;
                        cage[turn].clearbuff(board);
                    }
                    if (cage[turn].SpeedUp)
                    {
                        cage[turn].SpeedUp = false;
                        cage[turn].clearbuff(board);
                    }

                    if (cage[nextturn].Hide) // Xoa dao cu cua dich
                    {
                        for (int i = 0; i < cage[nextturn].nPieces; i++)
                        {
                            MyPieces p = cage[nextturn].Pieces[i];
                            if (p.Started && !p.Ended)
                            {
                                int t = board.arrSquares[p.curIndex % 56].status;
                                if (t != nextturn + 1)
                                {
                                    if (t != 0)
                                    {
                                        int team = board.arrSquares[p.curIndex % 56].status - 1;
                                        int index = board.arrSquares[p.curIndex % 56].curIndex;
                                        cage[team].Update(index);
                                        SoundPlayer sound = new SoundPlayer(@"Resources\Audio\Kick.wav");
                                        sound.LoadAsync();
                                        sound.Play();
                                        sound.Dispose();
                                        this.Invoke(new AntiCrossThreadNoArgument(Refresh));
                                        //Thread.Sleep(20);
                                    }
                                    board.arrSquares[p.curIndex % 56].status = nextturn + 1;
                                    board.arrSquares[p.curIndex % 56].curIndex = i;
                                }
                            }
                        }
                        cage[nextturn].Hide = false;
                        cage[nextturn].clearbuff(board);
                    }
                    if (cage[nextturn].Shield) //Xóa đạo cụ của địch
                    {
                        cage[nextturn].Shield = false;
                        cage[nextturn].clearbuff(board);
                    }

                    Refresh();
                    //newthread.Resume();
                    //StartAI = true;
                    if (!cage[nextturn].isPlayer)
                    {
                        Thread thread_AI = new Thread(Thread_AI);
                        thread_AI.Start();
                    }
                    else
                    {
                        changeImageTurn();
                        btnShake.Visible = true;
                        pShake.Visible = false;
                    }
                }
                else //Them luot
                {
                    cage[turn].GetTurn = false;
                    MessageBox.Show("Thêm lượt! Tiến hành lượt quay tiếp theo");
                    nextturn = turn;
                    btnShake.Visible = true;
                    pShake.Visible = false;
                }
            }
            else
            {
                btnShake.Visible = true;
                pShake.Visible = false;
            }
        }
コード例 #32
0
ファイル: Form1.cs プロジェクト: myw88sky/notify
        //请求定时器
        private void timer1_Tick(object sender, EventArgs e)
        {
            string url    = GetAppConfig("GetUrl");
            string userId = GetAppConfig("UserId");



            if (url == "" || userId == "")
            {
                MessageBox.Show("请在配置文件中配置请求url和用户UserId");
            }
            else
            {
                string responseVal = HttpGet(url);

                if (responseVal == "")
                {
                    // MessageBox.Show("请求异常");
                    return;
                }

                ToJsonMy obj = ToObj(responseVal);

                if (obj.code != "00")
                {
                    // MessageBox.Show("请求异常");
                    return;
                }

                if (obj.data.total == "0")
                {
                    type = 0;
                    this.richTextBox1.Text = "";
                    this.richTextBox1.AppendTextColorful("暂无待办", Color.Black, 16);
                }
                else
                {
                    System.Media.SoundPlayer player = new System.Media.SoundPlayer();
                    player.SoundLocation = Application.StartupPath + "\\yinpin.wav";
                    player.LoadAsync();
                    player.PlaySync();

                    type = 1;

                    this.timer.Enabled = true;

                    this.richTextBox1.Text = "";

                    string msg = "总消息数:" + obj.data.total + "\r\n";


                    //this.richTextBox1.AppendTextColorful(msg, Color.Black, 16);

                    int index = 1;
                    List <ToJsonItem> items = obj.data.items;

                    foreach (ToJsonItem item in items)
                    {
                        msg += index + "、" + item.title + "\r\n";
                        // this.richTextBox1.AppendTextColorful(index+"、" + item.title, Color.Black, 16);

                        //this.richTextBox1.AppendTextColorful("申请人:" + item.apply + "    时间:" + item.date, Color.Black, 14);
                        msg += "申请人:" + item.apply + "    时间:" + item.date + "\r\n";
                        index++;
                    }
                    this.richTextBox1.AppendTextColorful(msg, Color.Black, 14);

                    richTextBox1.SelectionStart = 0;
                    richTextBox1.Focus();
                }
            }
        }
コード例 #33
0
 private void Process(int t, int index)
 {
     for (int i = 0; i < cage[turn].nPieces; i++)
         if (cage[turn].Pieces[i].IsChoice)
             cage[turn].Pieces[i].IsChoice = false;
     SoundPlayer sound = new SoundPlayer(@"Resources\Audio\move.wav");
     sound.LoadAsync();
     sound.Play();
     sound.Dispose();
     int count = 0;
     while (count < go)
     {
         count++;
         vic = cage[t].Pieces[index].MoveSteponStep(board, index);
         if (vic.nType == -2)
         {
             this.Invoke(new AntiCrossThreadNoArgument(Refresh));
             break;
         }
         if (!this.InvokeRequired)
         {
             Refresh();
         }
         else
         {
             this.Invoke(new AntiCrossThreadNoArgument(Refresh));
         }
     }
 }
コード例 #34
0
 private void soundAlarm()
 {
     SoundPlayer wavPlayer = new SoundPlayer();
     wavPlayer.SoundLocation = "C:/Users/jessica/Documents/GitHub/Brewduino/Brewduino/Sounds/ALARM.WAV";
     wavPlayer.LoadCompleted += new AsyncCompletedEventHandler(wavPlayer_LoadCompleted);
     wavPlayer.LoadAsync();
 }
コード例 #35
0
ファイル: Info.cs プロジェクト: colombmo/itsi-gamification
        // TODO: Merge common functionality between KeyboardWedgeRead and ReadTags.ReadtheTags
        private void KeyboardWedgeRead()
        {
            List<SendInputWrapper.INPUT> inputList = new List<SendInputWrapper.INPUT>();
            string startIndicator = ".";

            // Signal start of read
            inputList.Clear();
            AddKeypresses(inputList, startIndicator);
            SendInput(inputList);

            properties = Utilities.GetProperties();

            SoundPlayer startSound = new SoundPlayer(properties["startscanwavefile"]);
            if (properties["audiblealert"].ToLower() == "yes")
            {
                startSound.Play();
            }
            SoundPlayer stopSound = new SoundPlayer(properties["endscanwavefile"]);
            stopSound.LoadAsync();

            CoreDLL.SYSTEM_POWER_STATUS_EX status = new CoreDLL.SYSTEM_POWER_STATUS_EX();
            //Check the battery power level
            if (CoreDLL.GetSystemPowerStatusEx(status, false) == 1)
            {
                if (status.BatteryLifePercent <= 5)
                {
                    if (status.ACLineStatus == 0)
                    {
                        MessageBox.Show("Battery level is low to read tags");
                        return;
                    }
                }
            }
            try
            {
                TagReadData[] reads;

                //Utilities.PowerManager.PowerNotify += new PowerManager.PowerEventHandler(PowerManager_PowerNotify);
                using (ThingMagic.RFIDSearchLight.ReadMgr.Session rsess = ThingMagic.RFIDSearchLight.ReadMgr.GetSession())
                {
#if DEBUG
                    if (properties["audiblealert"].ToLower() == "yes")
                    {
                        startSound.Play();
                    }
#endif

                    int radioPower = 0;
                    if (properties["readpower"].ToString() == "")
                    {
                        radioPower = 2300;//While reading read power should be max
                    }
                    else
                    {
                        radioPower = Convert.ToInt32(properties["readpower"].ToString());
                    }
  
                    //Set the region
                    string region = properties["region"];
                    try
                    {
                        Utilities.SwitchRegion(region);
                    }
                    catch (ArgumentException)
                    {
                        MessageBox.Show(
                            "Unknown Region: " + region + "\r\n" +
                            "Please run RFIDSearchLight to initialize the region."
                            );
                    }
                    
                    rsess.Reader.ParamSet("/reader/powerMode", Reader.PowerMode.FULL);
                    rsess.Reader.ParamSet("/reader/radio/readPower", radioPower);
                    rsess.Reader.ParamSet("/reader/antenna/txRxMap", new int[][] { new int[] { 1, 1, 1 } });
                    List<int> ant = new List<int>();
                    ant.Add(1);
                    //set the tag population settings
                    rsess.Reader.ParamSet("/reader/gen2/target", Gen2.Target.A);//default target
                    string tagPopulation = properties["tagpopulation"];
                    switch (tagPopulation)
                    {
                        case "small":
                            rsess.Reader.ParamSet("/reader/gen2/q", new Gen2.StaticQ(2));
                            rsess.Reader.ParamSet("/reader/gen2/session", Gen2.Session.S0);
                            rsess.Reader.ParamSet("/reader/gen2/tagEncoding", Gen2.TagEncoding.M4);
                            break;
                        case "medium":
                            rsess.Reader.ParamSet("/reader/gen2/q", new Gen2.StaticQ(4));
                            rsess.Reader.ParamSet("/reader/gen2/session", Gen2.Session.S1);
                            rsess.Reader.ParamSet("/reader/gen2/tagEncoding", Gen2.TagEncoding.M4);
                            break;
                        case "large":
                            rsess.Reader.ParamSet("/reader/gen2/q", new Gen2.StaticQ(6));
                            rsess.Reader.ParamSet("/reader/gen2/session", Gen2.Session.S2);
                            rsess.Reader.ParamSet("/reader/gen2/tagEncoding", Gen2.TagEncoding.M2);
                            break;
                        default: break;
                    }
                    //set the read plan and filter
                    TagFilter filter;
                    int addressToRead = int.Parse(properties["selectionaddress"]);
                    Gen2.Bank bank = Gen2.Bank.EPC;
                    switch (properties["tagselection"].ToLower())
                    {
                        case "None":
                        case "epc": bank = Gen2.Bank.EPC; break;
                        case "tid": bank = Gen2.Bank.TID; break;
                        case "user": bank = Gen2.Bank.USER; break;
                        case "reserved": bank = Gen2.Bank.RESERVED; break;
                        default: break;

                    }
                    if ("yes" == properties["ismaskselected"])
                    {
                        filter = new Gen2.Select(true, bank, (uint)addressToRead * 8, (ushort)(properties["selectionmask"].Length * 4), ByteFormat.FromHex(properties["selectionmask"]));
                    }
                    else
                    {
                        filter = new Gen2.Select(false, bank, (uint)addressToRead * 8, (ushort)(properties["selectionmask"].Length * 4), ByteFormat.FromHex(properties["selectionmask"]));
                    }
                    //set the read plan
                    SimpleReadPlan srp;
                    if (properties["tagselection"].ToLower() == "none")
                    {
                        srp = new SimpleReadPlan(new int[] { 1 }, TagProtocol.GEN2, null, 0);
                    }
                    else
                    {
                        srp = new SimpleReadPlan(new int[] { 1 }, TagProtocol.GEN2, filter, 0);
                    }
                    rsess.Reader.ParamSet("/reader/read/plan", srp);

                    double readDuration = Convert.ToDouble(properties["scanduration"].ToString()) * 1000;
                    int readTimeout = Convert.ToInt32(readDuration);

                    //Do a sync read for the readduration
#if DEBUG
                    if (properties["audiblealert"].ToLower() == "yes")
                    {
                        startSound.Play();
                    }
#endif
                    reads = rsess.Reader.Read(readTimeout);

                    rsess.Reader.ParamSet("/reader/powerMode", Reader.PowerMode.MINSAVE);
                    if (properties["audiblealert"].ToLower() == "yes")
                    {
                        stopSound.Play();
                    }
                    // Clear start indicator
                    inputList.Clear();
                    for (int i = 0; i < startIndicator.Length; i++)
                    {
                        AddKeypresses(inputList, new byte[] {
                            // Don't send Backspace -- that's one of our hotkeys,
                            // so it'll put us in an infinite loop.
                            (byte)Keys.Left,
                            (byte)Keys.Delete,
                        });
                    }
                    SendInput(inputList);
                }

                inputList.Clear();
                //HideWindow();
                bool timestamp = false, rssi = false, position = false;
                string[] metadata = properties["metadatatodisplay"].Split(',');
                //Metadata boolean variables
                foreach (string mdata in metadata)
                {
                    switch (mdata.ToLower())
                    {
                        case "timestamp": timestamp = true; break;
                        case "rssi": rssi = true; break;
                        case "position": position = true; break;
                        default: break;
                    }
                }
                string metadataseparator = properties["metadataseparator"];
                byte metadataseparatorInByte = 0x00;
                switch (metadataseparator.ToLower())
                {
                    //The byte representation of special characters can be found here - http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx
                    case "comma": metadataseparatorInByte = 0xBC; break;
                    case "space": metadataseparatorInByte = 0x20; break;
                    case "enter": metadataseparatorInByte = 0x0D; break;
                    case "tab": metadataseparatorInByte = 0x09; break;
                    default: break;
                }
                //Print the epc in caps
                AddKeypress(inputList, (byte)Keys.Capital);  // Toggle Caps Lock

                //Print the tag reads
                foreach (TagReadData dat in reads)
                {
                    string tagData = string.Empty;
                    string epc = string.Empty;
                    if (properties["displayformat"] == "base36")
                    {
                        epc = ConvertEPC.ConvertHexToBase36(dat.EpcString);
                    }
                    else
                    {
                        epc = dat.EpcString;
                    }

                    AddKeypresses(inputList, properties["prefix"].ToUpper());
                    AddKeypresses(inputList, epc.ToUpper());
                    AddKeypresses(inputList, properties["suffix"].ToUpper());

                    if (timestamp)
                    {
                        AddKeypress(inputList, metadataseparatorInByte);
                        AddKeypresses(inputList, dat.Time.ToString("yyyy-MM-dd-HH-mm-ss"));
                    }
                    if (rssi)
                    {
                        AddKeypress(inputList, metadataseparatorInByte);
                        AddKeypresses(inputList, dat.Rssi.ToString());
                    }
                    if (position)
                    {
                        AddKeypress(inputList, metadataseparatorInByte);
                        AddKeypresses(inputList, GpsMgr.LatLonString);
                    }

                    switch (properties["multipletagseparator"].ToLower())
                    {
                        case "comma": AddKeypress(inputList, 0xBC); break;
                        case "space": AddKeypress(inputList, 0x20); break;
                        case "enter": AddKeypress(inputList, 0x0D); break;
                        case "tab": AddKeypress(inputList, 0x09); break;
                        case "pipe":
                            AddInput(inputList, SHIFT_DOWN);
                            AddKeypress(inputList, 0xDC);
                            AddInput(inputList, SHIFT_UP);
                            break;
                        default: break;
                    }
                    // Send keystrokes after each tag read record -- input buffer
                    // isn't big enough to hold more than a few lines
                    SendInput(inputList);
                    inputList.Clear();
                }
                //Turn caps lock back off
                AddKeypress(inputList, (byte)Keys.Capital);  // Toggle Caps Lock
                SendInput(inputList);
            }
            
            catch (Exception ex)
            {
                logger.Error("In KeyboardWedgeRead(): " + ex.ToString());
                //MessageBox.Show(ex.Message);
                //Debug.Log(ex.ToString());
            }
        }