Skip to content

Commit df43935

Browse files
committed
update installation list release type at getunityinstallation, editors: add release type column, re-arrange column orders, press any key to focus on search, searc also release type and platforms, #113
1 parent 4415870 commit df43935

File tree

4 files changed

+33
-46
lines changed

4 files changed

+33
-46
lines changed

Diff for: UnityLauncherPro/GetUnityInstallations.cs

+17
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,23 @@ public static List<UnityInstallation> Scan()
6565
unity.IsPreferred = (version == MainWindow.preferredVersion);
6666
unity.ProjectCount = GetProjectCountForUnityVersion(version);
6767

68+
if (Tools.IsLTS(version))
69+
{
70+
unity.ReleaseType = "LTS";
71+
}
72+
else if (Tools.IsAlpha(version))
73+
{
74+
unity.ReleaseType = "Alpha";
75+
}
76+
else if (Tools.IsBeta(version))
77+
{
78+
unity.ReleaseType = "Beta";
79+
}
80+
else
81+
{
82+
unity.ReleaseType = ""; // cannot be null for UnitysFilter to work properly
83+
}
84+
6885
// get platforms, NOTE if this is slow, do it later, or skip for commandline
6986
var platforms = GetPlatforms(dataFolder);
7087
// this is for editor tab, show list of all platforms in cell

Diff for: UnityLauncherPro/MainWindow.xaml

+4-3
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,12 @@
266266
</DataGridTextColumn.ElementStyle>
267267
</DataGridTextColumn>
268268

269-
<DataGridTextColumn Binding="{Binding Version}" ClipboardContentBinding="{x:Null}" Header="Version" IsReadOnly="True" MinWidth="123"/>
270-
<DataGridTextColumn Binding="{Binding Path}" ClipboardContentBinding="{x:Null}" Header="Path" IsReadOnly="True"/>
271-
<DataGridTextColumn Binding="{Binding Installed, StringFormat=\{0:dd/MM/yyyy HH:mm:ss\}}" ClipboardContentBinding="{x:Null}" Header="Installed" IsReadOnly="True"/>
269+
<DataGridTextColumn Binding="{Binding Version}" ClipboardContentBinding="{x:Null}" Header="Version" IsReadOnly="True" MinWidth="90"/>
270+
<DataGridTextColumn Header="Release" Binding="{Binding ReleaseType}" IsReadOnly="True" CanUserResize="False" MinWidth="50" />
272271
<DataGridTextColumn Binding="{Binding PlatformsCombined}" ClipboardContentBinding="{x:Null}" Header="Platforms" IsReadOnly="True"/>
272+
<DataGridTextColumn Binding="{Binding Installed, StringFormat=\{0:dd/MM/yyyy HH:mm:ss\}}" ClipboardContentBinding="{x:Null}" Header="Installed" IsReadOnly="True"/>
273273
<DataGridTextColumn Binding="{Binding ProjectCount}" ClipboardContentBinding="{x:Null}" Header="Projects" IsReadOnly="True"/>
274+
<DataGridTextColumn Binding="{Binding Path}" ClipboardContentBinding="{x:Null}" Header="Path" IsReadOnly="True"/>
274275
</DataGrid.Columns>
275276

276277
<!-- right click context menu -->

Diff for: UnityLauncherPro/MainWindow.xaml.cs

+10-24
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ private bool UpdatesFilter(object item)
335335
private bool UnitysFilter(object item)
336336
{
337337
UnityInstallation unity = item as UnityInstallation;
338-
return (unity.Version.IndexOf(_filterString, 0, StringComparison.CurrentCultureIgnoreCase) != -1);
338+
return (unity.Version?.IndexOf(_filterString, 0, StringComparison.CurrentCultureIgnoreCase) != -1) || (unity.ReleaseType?.IndexOf(_filterString, 0, StringComparison.CurrentCultureIgnoreCase) != -1) || (unity.PlatformsCombined?.IndexOf(_filterString, 0, StringComparison.CurrentCultureIgnoreCase) != -1);
339339
}
340340

341341
private bool BuildReportFilter(object item)
@@ -907,7 +907,7 @@ private void OnWindowKeyDown(object sender, KeyEventArgs e)
907907
}
908908

909909
break;
910-
case 1: // Unitys
910+
case 1: // Unitys/Editors
911911

912912
switch (e.Key)
913913
{
@@ -917,6 +917,13 @@ private void OnWindowKeyDown(object sender, KeyEventArgs e)
917917
case Key.Escape: // clear project search
918918
txtSearchBoxUnity.Text = "";
919919
break;
920+
default:
921+
if (txtSearchBoxUnity.IsFocused == false)
922+
{
923+
txtSearchBoxUnity.Focus();
924+
txtSearchBoxUnity.Select(txtSearchBoxUnity.Text.Length, 0);
925+
}
926+
break;
920927
}
921928
break;
922929

@@ -951,7 +958,7 @@ private void OnWindowKeyDown(object sender, KeyEventArgs e)
951958
private async void OnTabSelectionChanged(object sender, SelectionChangedEventArgs e)
952959
{
953960
// if going into updates tab, fetch list (first time only)
954-
if (((TabControl)sender).SelectedIndex == (int)Tabs.Updates)
961+
if (tabControl.SelectedIndex == (int)Tabs.Updates)
955962
{
956963
// if we dont have previous results yet, TODO scan again if previous was 24hrs ago
957964
if (updatesSource == null)
@@ -3351,27 +3358,6 @@ private void tabControl_PreviewKeyDown(object sender, KeyEventArgs e)
33513358
}
33523359
}
33533360

3354-
3355-
3356-
3357-
3358-
//private void BtnBrowseTemplateUnityPackagesFolder_Click(object sender, RoutedEventArgs e)
3359-
//{
3360-
// var folder = Tools.BrowseForOutputFolder("Select unitypackage Templates folder");
3361-
// if (string.IsNullOrEmpty(folder) == false)
3362-
// {
3363-
// txtTemplatePackagesFolder.Text = folder;
3364-
// Properties.Settings.Default.templatePackagesFolder = folder;
3365-
// Properties.Settings.Default.Save();
3366-
// }
3367-
//}
3368-
3369-
//private void TxtTemplatePackagesFolder_TextChanged(object sender, TextChangedEventArgs e)
3370-
//{
3371-
// Properties.Settings.Default.templatePackagesFolder = txtTemplatePackagesFolder.Text;
3372-
// Properties.Settings.Default.Save();
3373-
//}
3374-
33753361
} // class
33763362
} //namespace
33773363

Diff for: UnityLauncherPro/NewProject.xaml.cs

+2-19
Original file line numberDiff line numberDiff line change
@@ -38,29 +38,12 @@ public NewProject(string unityVersion, string suggestedName, string targetFolder
3838
txtNewProjectName.Text = newName;
3939
lblNewProjectFolder.Content = targetFolder;
4040

41-
// fill available versions
41+
//// fill available versions
4242
if (gridAvailableVersions.ItemsSource == null)
4343
{
44-
// get release type info (not done in mainwindow yet, to avoid doing extra stuff)
45-
for (int i = 0, len = MainWindow.unityInstallationsSource.Count; i < len; i++)
46-
{
47-
var ver = MainWindow.unityInstallationsSource[i].Version;
48-
if (Tools.IsLTS(ver))
49-
{
50-
MainWindow.unityInstallationsSource[i].ReleaseType = "LTS";
51-
}
52-
else if (Tools.IsAlpha(ver))
53-
{
54-
MainWindow.unityInstallationsSource[i].ReleaseType = "Alpha";
55-
}
56-
else if (Tools.IsBeta(ver))
57-
{
58-
MainWindow.unityInstallationsSource[i].ReleaseType = "Beta";
59-
}
60-
}
61-
6244
gridAvailableVersions.ItemsSource = MainWindow.unityInstallationsSource;
6345
}
46+
6447
// we have that version installed
6548
if (MainWindow.unityInstalledVersions.ContainsKey(unityVersion) == true)
6649
{

0 commit comments

Comments
 (0)