Ejemplo n.º 1
0
        private static bool MeetsMinimumGadgeteerCoreVersion(Mainboard board, string selectedVersion)
        {
            Version minimumCoreVersion;

            if (!Version.TryParse(board.MinimumCoreVersion, out minimumCoreVersion))
            {
                return(false);
            }

            Version coreVersion;

            if (!CoreVersions.TryGetValue(selectedVersion, out coreVersion))
            {
                string path = Gadgeteer.GetAssembliesPath("v" + selectedVersion);
                if (path == null)
                {
                    coreVersion = new Version();
                }
                else
                {
                    path = Path.Combine(path, CoreAssemblyFileName);

                    try
                    {
                        FileVersionInfo coreInfo = FileVersionInfo.GetVersionInfo(path);
                        coreVersion = new Version(coreInfo.FileVersion);
                    }
                    catch { coreVersion = new Version(); }
                }

                CoreVersions[selectedVersion] = coreVersion;
            }

            return(coreVersion >= minimumCoreVersion);
        }
Ejemplo n.º 2
0
        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();
            }
        }
Ejemplo n.º 3
0
        private static void SelectVersionFor(Mainboard board, ref string selectedVersion, string projectType)
        {
            if (board.Type == Gadgeteer.LastUsedMainboardType)
            {
                string lastUsedVersion = Gadgeteer.GetLastUsedMicroFrameworkVersionForMainboard(board.Type);
                if (board.SupportedVersions.Contains(lastUsedVersion))
                {
                    selectedVersion = lastUsedVersion;
                    return;
                }
            }

            if (board.AvailableVersions.Length < 1)
            {
                selectedVersion = board.SupportedVersions.FirstOrDefault();
            }
            else
            {
                foreach (string availableVersion in board.AvailableVersions)
                {
                    if (MeetsProjectType(availableVersion, projectType) &&
                        MeetsMinimumGadgeteerCoreVersion(board, availableVersion))
                    {
                        selectedVersion = availableVersion;
                        return;
                    }
                }

                selectedVersion = board.AvailableVersions.FirstOrDefault();
            }
        }
Ejemplo n.º 4
0
        private void OnCreate(object sender, RoutedEventArgs e)
        {
            try
            {
                if (SelectedMainboard == null)
                {
                    return;
                }

                Gadgeteer.SetLastUsedMainboard(SelectedMainboard.Type, SelectedVersion);
            }
            catch { }

            if (_shownAsDialog)
            {
                DialogResult = true;
            }
            else
            {
                Close();
            }
        }