@@ -385,7 +385,7 @@ void LaunchProject(Project proj)
385385
386386
387387 // we dont have this version installed (or no version info available)
388- var unityExePath = GetSelectedUnityExePath ( proj . Version ) ;
388+ var unityExePath = GetUnityExePath ( proj . Version ) ;
389389 if ( unityExePath == null )
390390 {
391391 Console . WriteLine ( "Missing unity version " + proj . Version ) ;
@@ -440,7 +440,7 @@ void LaunchProject(Project proj)
440440 }
441441
442442
443- string GetSelectedUnityExePath ( string version )
443+ string GetUnityExePath ( string version )
444444 {
445445 return unityInstalledVersions . ContainsKey ( version ) ? unityInstalledVersions [ version ] : null ;
446446 }
@@ -483,7 +483,86 @@ private void BtnRefreshProjectList_Click(object sender, RoutedEventArgs e)
483483 gridRecent . ItemsSource = projectsSource ;
484484 }
485485
486+ // run unity only
487+ private void BtnLaunchUnity_Click ( object sender , RoutedEventArgs e )
488+ {
489+ var proj = GetSelectedProject ( ) ;
490+ var unitypath = GetUnityExePath ( proj ? . Version ) ;
491+ Tools . LaunchExe ( unitypath ) ;
492+ }
493+
494+ private void BtnUpgradeProject_Click ( object sender , RoutedEventArgs e )
495+ {
496+ var proj = GetSelectedProject ( ) ;
497+ if ( proj == null ) return ;
498+
499+ DisplayUpgradeDialog ( proj ) ;
500+ }
486501
502+ void DisplayUpgradeDialog ( Project proj )
503+ {
504+ UpgradeWindow modalWindow = new UpgradeWindow ( proj . Version , proj . Path , proj . Arguments ) ;
505+ modalWindow . Owner = this ;
506+ modalWindow . ShowDialog ( ) ;
507+ var results = modalWindow . DialogResult . HasValue && modalWindow . DialogResult . Value ;
508+
509+ if ( results == true )
510+ {
511+ var upgradeToVersion = UpgradeWindow . upgradeVersion ;
512+ if ( string . IsNullOrEmpty ( upgradeToVersion ) ) return ;
513+
514+ // get selected version to upgrade for
515+ Console . WriteLine ( "Upgrade to " + upgradeToVersion ) ;
516+
517+ // inject new version for this item
518+ proj . Version = upgradeToVersion ;
519+ LaunchProject ( proj ) ;
520+ }
521+ else
522+ {
523+ Console . WriteLine ( "results = " + results ) ;
524+ }
525+
526+
527+ /*
528+ // display upgrade dialog (version selector)
529+ Form2 upgradeDialog = new Form2();
530+ Form2.currentVersion = currentVersion;
531+
532+ // check what user selected
533+ var results = upgradeDialog.ShowDialog(this);
534+ switch (results)
535+ {
536+ case DialogResult.Ignore: // view release notes page
537+ Tools.OpenReleaseNotes(currentVersion);
538+ // display window again for now..
539+ DisplayUpgradeDialog(currentVersion, projectPath, launchProject, commandLineArguments);
540+ break;
541+ case DialogResult.Cancel: // cancelled
542+ SetStatus("Cancelled project upgrade");
543+ break;
544+ case DialogResult.Retry: // download and install missing version
545+ SetStatus("Download and install missing version " + currentVersion);
546+ string url = Tools.GetUnityReleaseURL(currentVersion);
547+ if (string.IsNullOrEmpty(url) == false)
548+ {
549+ DownloadInBrowser(url, currentVersion);
550+ }
551+ else
552+ {
553+ SetStatus("Failed getting Unity Installer URL");
554+ }
555+ break;
556+ case DialogResult.Yes: // upgrade
557+ SetStatus("Upgrading project to " + Form2.currentVersion);
558+ if (launchProject == true) LaunchProject(projectPath, Form2.currentVersion);
559+ break;
560+ default:
561+ Console.WriteLine("Unknown DialogResult: " + results);
562+ break;
563+ }
564+ upgradeDialog.Close();*/
565+ }
487566
488567 } // class
489568} //namespace
0 commit comments