-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJavaVersionDialog.axaml.cs
More file actions
39 lines (31 loc) · 1.27 KB
/
JavaVersionDialog.axaml.cs
File metadata and controls
39 lines (31 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using JustLauncher.Services;
namespace JustLauncher;
public partial class JavaVersionDialog : UserControl
{
public JavaVersionDialog()
{
InitializeComponent();
}
public JavaVersionDialog(string required, string detected) : this()
{
var reqText = this.FindControl<TextBlock>("RequiredVersionText");
var detText = this.FindControl<TextBlock>("DetectedVersionText");
var msgText = this.FindControl<TextBlock>("MessageText");
if (reqText != null) reqText.Text = required;
if (detText != null) detText.Text = detected;
if (msgText != null) msgText.Text = $"The current Minecraft profile requires Java {required}, but we detected {detected} on your system.";
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
var dlBtn = this.FindControl<Button>("DownloadButton");
var goBtn = this.FindControl<Button>("LaunchAnywayButton");
if (dlBtn != null) dlBtn.Click += (s, e) => {
PlatformManager.OpenBrowser("https://www.oracle.com/java/technologies/downloads/");
OverlayService.Close(false);
};
if (goBtn != null) goBtn.Click += (s, e) => OverlayService.Close(true);
}
}