예제 #1
0
        public RaceFactoryPanel(Action <RaceDetails> raceOutputRcvr)
        {
            InitializeComponent();
            raceRcvr = raceOutputRcvr;

            if (AntPlusRacerConfig.getInstance().autoLoadAvailableRaceSourcesForRace)
            {
                AntPlusDevMgr antMgr = AntConfigPanel.accessInstance().antMgr;
                for (int i = 0; i < antMgr.deviceList.Count; ++i)
                {
                    AntPlusDevMgr.AntPlus_Connection dev = antMgr.deviceList[i];
                    //Skip devices in use
                    if (dev.dataSource.isInUse || dev.getConnStatus() != AntPlusDevMgr.AntPlus_Connection.ConnState.Connected || isDataSourceReserved(dev.dataSource))
                    {
                        continue;
                    }
                    else
                    {
                        configureRacer(0xFF, dev.dataSource, AntPlusRacerConfig.getInstance().getDefaultRaceTrack(dev.dataSource.getSportType()).distance);
                    }
                }
                if (configuredRacers.Count == 0)
                {
                    DisplayRacerList();
                }
            }
            else
            {
                DisplayRacerList();
            }

            ComboBox_RaceLength.SizeChanged += new SizeChangedEventHandler((sender, args) => comboBoxAutoLblFontSize(sender as ComboBox));
        }
예제 #2
0
        private AntConfigPanel()
        {
            InitializeComponent();
            antMgr = new AntPlusDevMgr();

            ListBox_statusPanelHolder.Items.Clear();
            Binding widthBind = new Binding("ActualWidth");

            widthBind.Source = ListBox_statusPanelHolder;
            foreach (AntPlusDevMgr.AntPlus_Connection i in antMgr.deviceList)
            {
                Fit_ConfigPanelDevice pnl = new Fit_ConfigPanelDevice(i);
                pnl.SetBinding(Fit_ConfigPanelDevice.WidthProperty, widthBind);
                ListBox_statusPanelHolder.Items.Add(pnl);
            }


            if (AntPlusRacerConfig.getInstance().remoteControlDevNum_negativeIsOff > 0)
            {
                Grid.SetRow(RacerRemoteControl.getRemoteStatus(), 1);
                Grid_Main.Children.Add(RacerRemoteControl.getRemoteStatus());
            }
        }
예제 #3
0
        private void DisplayRacerConfig()
        {
            inRacerConfigScreen = true;

            //TODOb this only shows ant plus sources
            ListBox_RacerOrSources.Items.Clear();
            Button_AddRacer.Visibility     = System.Windows.Visibility.Hidden;
            ComboBox_RaceLength.Visibility = System.Windows.Visibility.Visible;
            Button_Start.Visibility        = System.Windows.Visibility.Hidden;
            Label_DisplayTitle.Content     = "Configure New Racer - Source and Track Length:";
            ComboBox_RaceLength.Items.Clear();

            AntPlusDevMgr antMgr    = AntConfigPanel.accessInstance().antMgr;
            Binding       widthBind = new Binding("ActualWidth");

            widthBind.Source = ListBox_RacerOrSources;

            bool select0 = false;

            dsOnDisplay = new List <DataSourceBase>();

            //Add current source
            if (racerIndexUnderConfig >= 0)
            {
                dsOnDisplay.Add(configuredRacers[racerIndexUnderConfig].dataSource);
                select0 = true;
            }

            for (int i = 0; i < antMgr.deviceList.Count; ++i)
            {
                AntPlusDevMgr.AntPlus_Connection dev = antMgr.deviceList[i];
                //Skip devices in use
                if (dev.dataSource.isInUse || dev.getConnStatus() != AntPlusDevMgr.AntPlus_Connection.ConnState.Connected || isDataSourceReserved(dev.dataSource))
                {
                    continue;
                }
                else
                {
                    dsOnDisplay.Add(dev.dataSource);
                }
            }

            if (dsOnDisplay.Count > 0)
            {
                foreach (DataSourceBase i in dsOnDisplay)
                {
                    //Show as option in list
                    Label name = new Label();
                    name.Content = i.getSportType() + "-" + i.getSourceName();
                    Viewbox vb = new Viewbox();
                    vb.SetBinding(Viewbox.WidthProperty, widthBind);
                    vb.Margin = new Thickness(0, 1, 20, 1);
                    vb.Child  = name;
                    ListBox_RacerOrSources.Items.Add(vb);

                    if (select0)
                    {
                        ListBox_RacerOrSources.SelectedIndex = 0;
                    }

                    Button_RacerAddOrFinish.IsEnabled    = true;
                    Button_RacerRemoveOrCancel.IsEnabled = true;
                }
            }
            else
            {
                Label_DisplayTitle.Content           = "...No Data Sources Available";
                Button_RacerAddOrFinish.IsEnabled    = false;
                Button_RacerRemoveOrCancel.IsEnabled = true;
            }

            Label lbl2 = new Label()
            {
                Content = "Save"
            };
            Viewbox vb2 = new Viewbox()
            {
                Child = lbl2
            };

            Button_RacerAddOrFinish.Content = vb2;
            Label lbl3 = new Label()
            {
                Content = "Cancel"
            };
            Viewbox vb3 = new Viewbox()
            {
                Child = lbl3
            };

            Button_RacerRemoveOrCancel.Content = vb3;
        }