| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 06da9f9 commit d37fba5
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,6 +9,7 @@ public class UnityInstallation : IValueConverter | |||
| 9 | 9 | public string Path { set; get; } | |
| 10 | 10 | public DateTime? Installed { set; get; } | |
| 11 | 11 | public string Platforms { set; get; } | |
| 12 | + public bool IsPreferred { set; get; } | ||
| 12 | 13 | ||
| 13 | 14 | // color project unity version cells, depending if have that version installed | |
| 14 | 15 | // https://stackoverflow.com/a/5551986/5452781 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -48,6 +48,7 @@ public static UnityInstallation[] Scan() | |||
| 48 | 48 | unity.Version = version; | |
| 49 | 49 | unity.Path = exePath; | |
| 50 | 50 | unity.Installed = installDate; | |
| 51 | + unity.IsPreferred = (version == MainWindow.preferredVersion); | ||
| 51 | 52 | ||
| 52 | 53 | // TEST get platforms, NOTE if this is slow, do it later, or skip for commandline | |
| 53 | 54 | var platforms = GetPlatforms(dataFolder); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,7 +15,7 @@ public static async Task<string> Scan() | |||
| 15 | 15 | { | |
| 16 | 16 | if (isDownloadingUnityList == true) | |
| 17 | 17 | { | |
| 18 | - //SetStatus("We are already downloading ..."); | ||
| 18 | + Console.WriteLine("We are already downloading ..."); | ||
| 19 | 19 | return null; | |
| 20 | 20 | } | |
| 21 | 21 | ||
@@ -28,8 +28,8 @@ public static async Task<string> Scan() | |||
| 28 | 28 | ||
| 29 | 29 | Task<string> downloadStringTask = webClient.DownloadStringTaskAsync(new Uri(unityVersionsURL)); | |
| 30 | 30 | result = await downloadStringTask; | |
| 31 | + isDownloadingUnityList = false; | ||
| 31 | 32 | } | |
| 32 | - | ||
| 33 | 33 | return result; | |
| 34 | 34 | } | |
| 35 | 35 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -426,6 +426,19 @@ | |||
| 426 | 426 | <DataGrid x:Name="dataGridUnitys" SelectionMode="Single" Margin="4,30,2,42" Background="{x:Null}" BorderBrush="{x:Null}" ColumnHeaderStyle="{StaticResource HeaderStyle}" Padding="0" HorizontalScrollBarVisibility="Disabled" HeadersVisibility="Column" Foreground="#FFD8D8D8" HorizontalGridLinesBrush="#4C000000" VerticalGridLinesBrush="#19000000" AutoGenerateColumns="False" PreviewKeyDown="DataGridUnitys_PreviewKeyDown" PreviewMouseDoubleClick="DataGridUnitys_PreviewMouseDoubleClick"> | |
| 427 | 427 | ||
| 428 | 428 | <DataGrid.Columns> | |
| 429 | + <DataGridTextColumn ClipboardContentBinding="{x:Null}" IsReadOnly="True" MinWidth="16"> | ||
| 430 | + <DataGridTextColumn.ElementStyle> | ||
| 431 | + <Style TargetType="{x:Type TextBlock}"> | ||
| 432 | + <Style.Triggers> | ||
| 433 | + <DataTrigger Binding="{Binding IsPreferred}" Value="true"> | ||
| 434 | + <Setter Property="Text" Value="★" /> | ||
| 435 | + <Setter Property="TextAlignment" Value="Center" /> | ||
| 436 | + </DataTrigger> | ||
| 437 | + </Style.Triggers> | ||
| 438 | + </Style> | ||
| 439 | + </DataGridTextColumn.ElementStyle> | ||
| 440 | + </DataGridTextColumn> | ||
| 441 | + | ||
| 429 | 442 | <DataGridTextColumn Binding="{Binding Version}" ClipboardContentBinding="{x:Null}" Header="Version" IsReadOnly="True" MinWidth="123"/> | |
| 430 | 443 | <DataGridTextColumn Binding="{Binding Path}" ClipboardContentBinding="{x:Null}" Header="Path" IsReadOnly="True"/> | |
| 431 | 444 | <DataGridTextColumn Binding="{Binding Installed, StringFormat=\{0:dd/MM/yyyy HH:mm:ss\}}" ClipboardContentBinding="{x:Null}" Header="Installed" IsReadOnly="True"/> | |
@@ -503,7 +516,6 @@ | |||
| 503 | 516 | <Button Style="{StaticResource CustomButton}" ToolTip="Fetch released versions" x:Name="btnRefreshUpdatesList" Content="⟳" Height="22" Width="22" HorizontalAlignment="Right" VerticalAlignment="Top" FontSize="16" Background="#FF3F3F46" Foreground="#FFC1C1C1" Margin="0,4,3,0" Padding="1,-2,1,1" BorderBrush="{x:Null}" Click="OnGetUnityUpdatesClick"/> | |
| 504 | 517 | ||
| 505 | 518 | <DataGrid x:Name="dataGridUpdates" SelectionMode="Single" Margin="4,30,2,42" Background="{x:Null}" BorderBrush="{x:Null}" ColumnHeaderStyle="{StaticResource HeaderStyle}" Padding="0" HorizontalScrollBarVisibility="Disabled" HeadersVisibility="Column" Foreground="#FFD8D8D8" HorizontalGridLinesBrush="#4C000000" VerticalGridLinesBrush="#19000000" AutoGenerateColumns="False" PreviewKeyDown="DataGridUpdates_PreviewKeyDown" PreviewMouseDoubleClick="DataGridUpdates_PreviewMouseDoubleClick"> | |
| 506 | - | ||
| 507 | 519 | <DataGrid.Columns> | |
| 508 | 520 | <DataGridTextColumn Binding="{Binding ReleaseDate, StringFormat=\{0:dd/MM/yyyy\}}" ClipboardContentBinding="{x:Null}" MinWidth="100" Header="ReleaseDate" IsReadOnly="True"/> | |
| 509 | 521 | <DataGridTextColumn Binding="{Binding Version}" ClipboardContentBinding="{x:Null}" Header="Version" IsReadOnly="True" MinWidth="123"> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -40,6 +40,7 @@ public partial class MainWindow : Window | |||
| 40 | 40 | string _filterString = null; | |
| 41 | 41 | const string githubURL = "https://github.com/unitycoder/UnityLauncherPro"; | |
| 42 | 42 | int lastSelectedProjectIndex = 0; | |
| 43 | + public static string preferredVersion = "none"; | ||
| 43 | 44 | Mutex myMutex; | |
| 44 | 45 | ||
| 45 | 46 | public MainWindow() | |
@@ -174,11 +175,11 @@ void FilterRecentProjects() | |||
| 174 | 175 | _filterString = txtSearchBox.Text; | |
| 175 | 176 | ICollectionView collection = CollectionViewSource.GetDefaultView(projectsSource); | |
| 176 | 177 | collection.Filter = ProjectFilter; | |
| 177 | - // set first row selected | ||
| 178 | - if (gridRecent.Items.Count > 0) | ||
| 179 | - { | ||
| 180 | - gridRecent.SelectedIndex = 0; | ||
| 181 | - } | ||
| 178 | + // set first row selected, if only 1 row | ||
| 179 | + //if (gridRecent.Items.Count == 1) | ||
| 180 | + //{ | ||
| 181 | + // gridRecent.SelectedIndex = 0; | ||
| 182 | + //} | ||
| 182 | 183 | } | |
| 183 | 184 | ||
| 184 | 185 | void FilterUpdates() | |
@@ -242,7 +243,6 @@ void LoadSettings() | |||
| 242 | 243 | gridRecent.Columns[4].Visibility = (bool)chkShowLauncherArgumentsColumn.IsChecked ? Visibility.Visible : Visibility.Collapsed; | |
| 243 | 244 | gridRecent.Columns[5].Visibility = (bool)chkShowGitBranchColumn.IsChecked ? Visibility.Visible : Visibility.Collapsed; | |
| 244 | 245 | ||
| 245 | - | ||
| 246 | 246 | // update installations folder listbox | |
| 247 | 247 | lstRootFolders.Items.Clear(); | |
| 248 | 248 | lstRootFolders.ItemsSource = Properties.Settings.Default.rootFolders; | |
@@ -256,6 +256,10 @@ void LoadSettings() | |||
| 256 | 256 | gridRecent.Columns[i].Width = gridColumnWidths[i]; | |
| 257 | 257 | } | |
| 258 | 258 | } | |
| 259 | + | ||
| 260 | + // other setting vars | ||
| 261 | + preferredVersion = Properties.Settings.Default.preferredVersion; | ||
| 262 | + | ||
| 259 | 263 | } // LoadSettings() | |
| 260 | 264 | ||
| 261 | 265 | private void SaveSettingsOnExit() | |
@@ -292,6 +296,9 @@ private void SaveSettingsOnExit() | |||
| 292 | 296 | ||
| 293 | 297 | void UpdateUnityInstallationsList() | |
| 294 | 298 | { | |
| 299 | + // reset preferred string, if user changed it | ||
| 300 | + //preferredVersion = "none"; | ||
| 301 | + | ||
| 295 | 302 | unityInstallationsSource = GetUnityInstallations.Scan(); | |
| 296 | 303 | dataGridUnitys.ItemsSource = unityInstallationsSource; | |
| 297 | 304 | ||
@@ -300,7 +307,7 @@ void UpdateUnityInstallationsList() | |||
| 300 | 307 | for (int i = 0, len = unityInstallationsSource.Length; i < len; i++) | |
| 301 | 308 | { | |
| 302 | 309 | var version = unityInstallationsSource[i].Version; | |
| 303 | - if (string.IsNullOrEmpty(version)==false && unityInstalledVersions.ContainsKey(version) == false) | ||
| 310 | + if (string.IsNullOrEmpty(version) == false && unityInstalledVersions.ContainsKey(version) == false) | ||
| 304 | 311 | { | |
| 305 | 312 | unityInstalledVersions.Add(version, unityInstallationsSource[i].Path); | |
| 306 | 313 | } | |
@@ -339,13 +346,13 @@ void AddUnityInstallationRootFolder() | |||
| 339 | 346 | } | |
| 340 | 347 | } | |
| 341 | 348 | ||
| 342 | - | ||
| 343 | - | ||
| 349 | + // waits for unity update results and assigns to datagrid | ||
| 344 | 350 | async void CallGetUnityUpdates() | |
| 345 | 351 | { | |
| 346 | 352 | dataGridUpdates.ItemsSource = null; | |
| 347 | 353 | var task = GetUnityUpdates.Scan(); | |
| 348 | 354 | var items = await task; | |
| 355 | + Console.WriteLine(items == null); | ||
| 349 | 356 | if (items == null) return; | |
| 350 | 357 | updatesSource = GetUnityUpdates.Parse(items); | |
| 351 | 358 | if (updatesSource == null) return; | |
@@ -485,7 +492,7 @@ private void OnWindowKeyDown(object sender, KeyEventArgs e) | |||
| 485 | 492 | case Key.Escape: // clear project search | |
| 486 | 493 | if (txtSearchBox.Text == "") | |
| 487 | 494 | { | |
| 488 | - Tools.SetFocusToGrid(gridRecent); | ||
| 495 | + if (txtSearchBox.IsFocused) Tools.SetFocusToGrid(gridRecent); | ||
| 489 | 496 | } | |
| 490 | 497 | txtSearchBox.Text = ""; | |
| 491 | 498 | break; | |
@@ -555,11 +562,12 @@ private async void OnTabSelectionChanged(object sender, SelectionChangedEventArg | |||
| 555 | 562 | // if going into updates tab, fetch list (first time only) | |
| 556 | 563 | if (((TabControl)sender).SelectedIndex == (int)Tabs.Updates) | |
| 557 | 564 | { | |
| 565 | + // if we dont have previous results yet, TODO scan again if previous was 24hrs ago | ||
| 558 | 566 | if (updatesSource == null) | |
| 559 | 567 | { | |
| 560 | 568 | var task = GetUnityUpdates.Scan(); | |
| 561 | - if (task.IsCompleted == false) return; | ||
| 562 | 569 | var items = await task; | |
| 570 | + if (task.IsCompleted == false || task.IsFaulted == true) return; | ||
| 563 | 571 | if (items == null) return; | |
| 564 | 572 | updatesSource = GetUnityUpdates.Parse(items); | |
| 565 | 573 | if (updatesSource == null) return; | |
@@ -601,12 +609,14 @@ private void Window_SizeChanged(object sender, SizeChangedEventArgs e) | |||
| 601 | 609 | private void BtnLaunchProject_Click(object sender, RoutedEventArgs e) | |
| 602 | 610 | { | |
| 603 | 611 | Tools.LaunchProject(GetSelectedProject()); | |
| 612 | + Tools.SetFocusToGrid(gridRecent); | ||
| 604 | 613 | } | |
| 605 | 614 | ||
| 606 | 615 | private void BtnExplore_Click(object sender, RoutedEventArgs e) | |
| 607 | 616 | { | |
| 608 | 617 | var proj = GetSelectedProject(); | |
| 609 | 618 | Tools.ExploreProjectFolder(proj); | |
| 619 | + Tools.SetFocusToGrid(gridRecent); | ||
| 610 | 620 | } | |
| 611 | 621 | ||
| 612 | 622 | // copy selected row unity version to clipboard | |
@@ -719,6 +729,7 @@ private void TxtSearchBox_PreviewKeyDown(object sender, KeyEventArgs e) | |||
| 719 | 729 | case Key.Up: | |
| 720 | 730 | case Key.Down: | |
| 721 | 731 | Tools.SetFocusToGrid(gridRecent); | |
| 732 | + e.Handled = true; // to stay in first row | ||
| 722 | 733 | break; | |
| 723 | 734 | default: | |
| 724 | 735 | break; | |
@@ -814,6 +825,7 @@ private void TxtSearchBoxUpdates_PreviewKeyDown(object sender, KeyEventArgs e) | |||
| 814 | 825 | case Key.Up: | |
| 815 | 826 | case Key.Down: | |
| 816 | 827 | Tools.SetFocusToGrid(dataGridUpdates); | |
| 828 | + e.Handled = true; | ||
| 817 | 829 | break; | |
| 818 | 830 | default: | |
| 819 | 831 | break; | |
@@ -935,7 +947,7 @@ private void BtnDonwloadInBrowser_Click(object sender, RoutedEventArgs e) | |||
| 935 | 947 | } | |
| 936 | 948 | else | |
| 937 | 949 | { | |
| 938 | - Console.WriteLine("Failed getting Unity Installer URL for " + unity.Version); | ||
| 950 | + Console.WriteLine("Failed getting Unity Installer URL for " + unity?.Version); | ||
| 939 | 951 | } | |
| 940 | 952 | } | |
| 941 | 953 | ||
@@ -1106,10 +1118,13 @@ private void BtnAssetPackages_Click(object sender, RoutedEventArgs e) | |||
| 1106 | 1118 | // sets selected unity version as preferred main unity version (to be preselected in case of unknown version projects, when creating new empty project, etc) | |
| 1107 | 1119 | private void MenuItemSetPreferredUnityVersion_Click(object sender, RoutedEventArgs e) | |
| 1108 | 1120 | { | |
| 1109 | - Properties.Settings.Default.preferredVersion = GetSelectedUnity().Version; | ||
| 1121 | + var ver = GetSelectedUnity().Version; | ||
| 1122 | + Properties.Settings.Default.preferredVersion = ver; | ||
| 1110 | 1123 | Properties.Settings.Default.Save(); | |
| 1111 | - | ||
| 1112 | - // TODO set star icon | ||
| 1124 | + | ||
| 1125 | + preferredVersion = ver; | ||
| 1126 | + // TODO update unity list or just set value? | ||
| 1127 | + UpdateUnityInstallationsList(); | ||
| 1113 | 1128 | ||
| 1114 | 1129 | } | |
| 1115 | 1130 | } // class | |
| Back | FazBrowse Home | New Git URL |
0 commit comments