Skip to content

Commit

Permalink
show upgrade dialog if no version for commandline launch, override ho…
Browse files Browse the repository at this point in the history
…me and end keys to scroll in recentlist, update unityinstallations on F5 for recentlist, add double click for upgradelist, #build
  • Loading branch information
unitycoder committed Feb 13, 2020
1 parent ed027de commit 56d8839
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
13 changes: 12 additions & 1 deletion UnityLauncherPro/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void HandleCommandLineLaunch()

// check if force-update button is down
// NOTE if keydown, window doesnt become active and focused
if ((Keyboard.Modifiers & ModifierKeys.Shift) != 0)
if (string.IsNullOrEmpty(version) || (Keyboard.Modifiers & ModifierKeys.Shift) != 0)
{
Tools.DisplayUpgradeDialog(proj, null);
}
Expand Down Expand Up @@ -785,7 +785,18 @@ private void GridRecent_PreviewKeyDown(object sender, KeyEventArgs e)
{
switch (e.Key)
{
case Key.Home: // override home
gridRecent.SelectedIndex = 0;
gridRecent.ScrollIntoView(gridRecent.SelectedItem);
e.Handled = true;
break;
case Key.End: // override end
gridRecent.SelectedIndex = gridRecent.Items.Count - 1;
gridRecent.ScrollIntoView(gridRecent.SelectedItem);
e.Handled = true;
break;
case Key.F5: // refresh projects
UpdateUnityInstallationsList();
RefreshRecentProjects();
break;
case Key.Tab:
Expand Down
2 changes: 1 addition & 1 deletion UnityLauncherPro/UpgradeWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
<Button Style="{StaticResource CustomButton}" x:Name="btnUpgradeProject" Background="{DynamicResource ButtonBackground}" Foreground="#FFC1C1C1" Margin="0,434,8,0" BorderBrush="{x:Null}" HorizontalAlignment="Right" Width="159" VerticalAlignment="Top" Height="51" Click="BtnUpgradeProject_Click" >
<Label Foreground="{DynamicResource ButtonForeground}" Content="_Upgrade Project"/>
</Button>
<DataGrid x:Name="gridAvailableVersions" SelectionMode="Single" HorizontalAlignment="Left" Height="304" Margin="10,121,0,0" VerticalAlignment="Top" Width="393" HeadersVisibility="None" AutoGenerateColumns="False" IsSynchronizedWithCurrentItem="True" Foreground="{DynamicResource ButtonForeground}" Background="{DynamicResource MainBackgroundColor}" PreviewKeyDown="GridAvailableVersions_PreviewKeyDown" Loaded="GridAvailableVersions_Loaded">
<DataGrid x:Name="gridAvailableVersions" SelectionMode="Single" HorizontalAlignment="Left" Height="304" Margin="10,121,0,0" VerticalAlignment="Top" Width="393" HeadersVisibility="None" AutoGenerateColumns="False" IsSynchronizedWithCurrentItem="True" Foreground="{DynamicResource ButtonForeground}" Background="{DynamicResource MainBackgroundColor}" PreviewKeyDown="GridAvailableVersions_PreviewKeyDown" Loaded="GridAvailableVersions_Loaded" PreviewMouseDoubleClick="GridAvailableVersions_PreviewMouseDoubleClick">
<DataGrid.Columns>
<DataGridTextColumn Header="Key" Binding="{Binding Key}" IsReadOnly="True" />
<DataGridTextColumn Header="Value" Binding="{Binding Value}" IsReadOnly="True" />
Expand Down
16 changes: 13 additions & 3 deletions UnityLauncherPro/UpgradeWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ public UpgradeWindow(string currentVersion, string projectPath, string commandLi

private void BtnUpgradeProject_Click(object sender, RoutedEventArgs e)
{
var k = (gridAvailableVersions.SelectedItem) as KeyValuePair<string, string>?;
upgradeVersion = k.Value.Key;
DialogResult = true;
Upgrade();
}

private void BtnCancelUpgrade_Click(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -130,5 +128,17 @@ private void GridAvailableVersions_Loaded(object sender, RoutedEventArgs e)
// row.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
}

private void GridAvailableVersions_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
{
Upgrade();
}

void Upgrade()
{
var k = (gridAvailableVersions.SelectedItem) as KeyValuePair<string, string>?;
upgradeVersion = k.Value.Key;
DialogResult = true;
}

}
}

0 comments on commit 56d8839

Please sign in to comment.