コード例 #1
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();
        }
        public void StartCountDown()
        {
            _boardDriver = RelayBoardDriver.Instance;


            _timer       = new HighPrecisionTimer(1000);
            _timer.Tick += _timer_Tick;

            Task.Factory.StartNew(() =>
            {
                EventT5();
            });
        }
コード例 #3
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;
        }