public ReplayBarModel(MainViewModel mainModel) { _mainModel = mainModel; _events = new ObservableCollection<ReplayEventContainer>(); this.UpdateEvents(); }
public AdminListModel(MainViewModel mainModel) { _mainModel = mainModel; _adminsView = CollectionViewSource.GetDefaultView(SyncManager.Instance.Users); _adminsView.Filter += delegate(object o) { var user = (UserContainer) o; return user.User.IsConnected; }; }
public PenaltyListModel(MainViewModel mainModel) { _mainModel = mainModel; _penalties = new ObservableCollection<PenaltyContainer>(); _penaltiesView = CollectionViewSource.GetDefaultView(_penalties); _penaltiesView.SortDescriptions.Add(new SortDescription("Penalty.StartInvestigationTime", ListSortDirection.Descending)); _decidedPenalties = new ObservableCollection<PenaltyContainer>(); _decidedPenaltiesView = CollectionViewSource.GetDefaultView(_decidedPenalties); _decidedPenaltiesView.SortDescriptions.Add(new SortDescription("Penalty.StartInvestigationTime", ListSortDirection.Descending)); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); this.DispatcherUnhandledException += OnDispatcherUnhandledException; AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; // Get path to iRacing folder var settings = iRacingAdmin.Properties.Settings.Default; if (string.IsNullOrWhiteSpace(settings.IRacingPath)) { var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); var path = Path.Combine(documentsPath, "iRacing"); settings.IRacingPath = path; settings.Save(); } Paths.LoadPaths(settings.IRacingPath); // Initialize _sdkModels = new Dictionary<Type, SdkViewModel>(); Simulator.Initialize(); SyncManager.Initialize(this.Dispatcher); _mainModel = new MainViewModel(); _mainModel.View.Show(); this.MainWindow = _mainModel.View; // Start the SDK Connection.Instance.SubSessionIdChanged += OnSubSessionIdChanged; Simulator.Instance.SessionInfoUpdated += OnSessionInfoUpdated; Simulator.Instance.TelemetryUpdated += OnTelemetryUpdated; var args = Environment.GetCommandLineArgs(); if (args.Contains("-sim")) { // Simulate iracing connection for testing Connection.Instance.StartSimulate(); } else { Connection.Instance.Start(); } // React when the sync state changes SyncManager.Instance.StateUpdated += OnSyncStateUpdated; }
public DriverListModel(MainViewModel mainModel) { _mainModel = mainModel; // Initialize views and filters _driversView = (ListCollectionView) CollectionViewSource.GetDefaultView(Simulator.Instance.Drivers); _classFilterItems = new ObservableCollection<ClassFilterItem>(); _classFilterItems.Add(ClassFilterItem.All()); _driverFilter = new DriverFilter(); _driverFilter.Attach(_driversView); _selectedDrivers = new ObservableCollection<DriverContainer>(); }
public OfftracksViewModel(MainViewModel mainModel) { _colors = new Stack<Color>(new Color[] { Colors.White, Colors.Green, Colors.Pink, Colors.Orange, Colors.LightBlue, Colors.Gold, Colors.Fuchsia, Colors.LimeGreen, Colors.Blue, Colors.Red, }); _lines = new Dictionary<int, DriverOfftrackLine>(); _mainModel = mainModel; _limitsModel = new OfftrackLimitsViewModel(this); }
public TrackBarModel(MainViewModel mainModel) { _mainModel = mainModel; _drivers = new ObservableCollection<TrackBarDriver>(); }