private void OnLoad(object sender, RoutedEventArgs e) { BoardSelector.Focus(); // we do not want to cache the assembliy list // because user could have un/installed SDK without restarting Visual Studio ThreadPool.QueueUserWorkItem(RegisteredAssembliesEnumerator); string[] folderPaths = Gadgeteer.EnumerateHardwareDefinitionFolders(new MainboardNamingFirstComparer()).ToArray(); if (folderPaths != null && folderPaths.Length > 0) { BoardProgress.Maximum = folderPaths.Length; BoardProgress.Visibility = Visibility.Visible; foreach (string folderPath in folderPaths) { ThreadPool.QueueUserWorkItem(CheckForMainboard, folderPath); } } else { InlineMessage = States.InlineStateForNoBoards(); } }
// only called before Start() // have other scripts call BoardSelector data private void Awake() { /* Instance will * not be destroyed when going into next Scene * destroyed when going back to previous Scene */ // if a board was never selected, instantiate it if (Instance == null) { Instance = this; } // board was instantiated, but player wants a different one else { Destroy(Instance.gameObject); Instance = this; } }