public Controls() { InitializeComponent(); this.Left = Properties.Settings.Default.controlsWindowLocationX; this.Top = Properties.Settings.Default.controlsWindowLocationY; if (SharedData.settings.AlwaysOnTopCameraControls) this.Topmost = true; else this.Topmost = false; API = new iRTVO.iRacingAPI(); API.sdk.Startup(); }
public MainWindow() { InitializeComponent(); // upgrade settings from previous versions if (Properties.Settings.Default.UpdateSettings) { Properties.Settings.Default.Upgrade(); Properties.Settings.Default.UpdateSettings = false; Properties.Settings.Default.Save(); } // set window position this.Left = Properties.Settings.Default.MainWindowLocationX > 0 ? Properties.Settings.Default.MainWindowLocationX : 0; this.Top = Properties.Settings.Default.MainWindowLocationY > 0 ? Properties.Settings.Default.MainWindowLocationY : 0; this.Width = Properties.Settings.Default.MainWindowWidth; this.Height = Properties.Settings.Default.MainWindowHeight; if (SharedData.settings.AlwaysOnTopMainWindow) this.Topmost = true; else this.Topmost = false; SharedData.serverThread = new Thread(startServer); // autostart client/server if (SharedData.settings.RemoteControlClientAutostart) { Button dummyButton = new Button(); this.bClient_Click(dummyButton, new RoutedEventArgs()); } if (SharedData.settings.RemoteControlServerAutostart) { Button dummyButton = new Button(); this.bServer_Click(dummyButton, new RoutedEventArgs()); } irAPI = new iRacingAPI(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { // Add additional Columns to Standings StandingsItem tmpItem = new StandingsItem(); Type tmpType = tmpItem.GetType(); IEnumerable<string> props = ExtractHelper.IterateProps(tmpType); string validProps = String.Join(" , ", props).Replace("StandingsItem.", ""); foreach (Settings.ColumnSetting col in SharedData.settings.DriversColumns) { if (!props.Contains("StandingsItem."+col.Name)) { logger.Warn("Unkown column in optins.ini standingsgrid::columns '{0}'", col); logger.Warn("Valid Columns are: {0}", validProps); // continue; } DataGridTextColumn textColumn = new DataGridTextColumn(); textColumn.Header = col.Header; textColumn.Binding = new Binding(col.Name); standingsGrid.Columns.Add(textColumn); logger.Trace("Added column '{0}'", col); } // We subscribe to Session change, to prevent staningsGrid show old data SharedData.Sessions.PropertyChanged += CurrentSession_PropertyChanged; BindingOperations.CollectionRegistering += BindingOperations_CollectionRegistering; UpdateDataContext(); BookmarksGrid.DataContext = SharedData.Bookmarks.List; Cameras = SharedData.Camera.Groups; API = new iRTVO.iRacingAPI(); API.sdk.Startup(); updateTimer.Interval = new TimeSpan(0, 0, 0, 0, 500); updateTimer.Tick += new EventHandler(updateGrids); updateTimer.Start(); updateGrids(new object(), new EventArgs()); int i = 0; foreach (Single sector in SharedData.Sectors) { CheckBox cb = new CheckBox(); cb.Content = "Sector " + i + ": " + sector.ToString("0.000"); cb.Name = "s" + i; cb.Click += new RoutedEventHandler(sectorClick); sectorsStackPanel.Children.Add(cb); int found = SharedData.SelectedSectors.FindIndex(s => s.Equals(sector)); if (found >= 0) { cb.IsChecked = true; } i++; } }
private void Window_Loaded(object sender, RoutedEventArgs e) { standingsGrid.DataContext = SharedData.Sessions.CurrentSession.Standings; //eventsGrid.DataContext = SharedData.Events.List; //BookmarksGrid.DataContext = SharedData.Bookmarks.List; API = new iRTVO.iRacingAPI(); API.sdk.Startup(); updateTimer.Interval = new TimeSpan(0, 0, 0, 0, 500); updateTimer.Tick += new EventHandler(updateGrids); updateTimer.Start(); updateGrids(new object(), new EventArgs()); int i = 0; foreach (Single sector in SharedData.Sectors) { CheckBox cb = new CheckBox(); cb.Content = "Sector " + i + ": " + sector.ToString("0.000"); cb.Name = "s" + i; cb.Click += new RoutedEventHandler(sectorClick); sectorsStackPanel.Children.Add(cb); int found = SharedData.SelectedSectors.FindIndex(s => s.Equals(sector)); if (found >= 0) { cb.IsChecked = true; } i++; } }
private void Window_Loaded(object sender, RoutedEventArgs e) { // load theme loadTheme(SharedData.settings.Theme); // size and position overlay.Left = SharedData.settings.OverlayX; overlay.Top = SharedData.settings.OverlayY; overlay.Width = SharedData.settings.OverlayW; overlay.Height = SharedData.settings.OverlayH; // start api thread irAPI = new iRacingAPI(); irAPI.sdk.Startup(); thApi = new Thread(new ThreadStart(irAPI.getData)); thApi.IsBackground = true; thApi.Start(); // overlay update timer overlayUpdateTimer.Tick += new EventHandler(overlayUpdate); overlayUpdateTimer.Start(); /* tickerScroller.Interval = TimeSpan.FromMilliseconds(16.0); tickerScroller.Tick += new EventHandler(scrollTickers); tickerScroller.Start(); */ resizeOverlay(overlay.Width, overlay.Height); }