示例#1
0
        public bool TryGetCustomOutline(IDriverInfo driverInfo, out ColorDto outlineColor)
        {
            if (driverInfo?.DriverName == null)
            {
                outlineColor = null;
                return(false);
            }
            DriverTimingViewModel viewModel;

            lock (DriversViewModels)
            {
                viewModel = DriversViewModels.FirstOrDefault(x => x.Name == driverInfo.DriverName);
            }

            outlineColor = viewModel?.OutLineColor;
            return(viewModel?.HasCustomOutline ?? false);
        }
示例#2
0
        public void RemoveDriver(DriverTiming driver)
        {
            if (!Application.Current.Dispatcher.CheckAccess())
            {
                Application.Current.Dispatcher.Invoke(() => RemoveDriver(driver));
                return;
            }

            lock (_lockObject)
            {
                DriverTimingViewModel toRemove = DriversViewModels.FirstOrDefault(x => x.DriverTiming == driver);
                if (toRemove == null)
                {
                    return;
                }

                _driverNameTimingMap.Remove(driver.Name);
                DriversViewModels.Remove(toRemove);
            }
        }