-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathExperimentalRepoDialogWindow.axaml.cs
More file actions
59 lines (49 loc) · 1.59 KB
/
Copy pathExperimentalRepoDialogWindow.axaml.cs
File metadata and controls
59 lines (49 loc) · 1.59 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using System.Collections.Generic;
using Avalonia.Controls;
using Avalonia.Interactivity;
using LlamaServerLauncher.Models;
using LlamaServerLauncher.Resources;
using LlamaServerLauncher.Services;
using LlamaServerLauncher.ViewModels;
namespace LlamaServerLauncher;
public partial class ExperimentalRepoDialogWindow : Window
{
private ExperimentalRepoDialogViewModel? _viewModel;
public LocalizedStrings Localized => LocalizedStrings.Instance;
public DialogGeometry? CapturedGeometry { get; private set; }
public ExperimentalRepoDialogWindow()
{
InitializeComponent();
}
public void SetViewModel(ExperimentalRepoDialogViewModel viewModel, Dictionary<string, DialogGeometry>? dialogGeometryDict = null)
{
_viewModel = viewModel;
DataContext = _viewModel;
_viewModel.RequestClose += OnRequestClose;
if (dialogGeometryDict != null)
DialogPositionHelper.ApplySavedGeometry(this, dialogGeometryDict, "ExperimentalRepoDialog");
}
private void OnRequestClose()
{
Avalonia.Threading.Dispatcher.UIThread.Post(() => Close());
}
private void OkClick(object? sender, RoutedEventArgs e)
{
_viewModel?.Save();
}
private void CancelClick(object? sender, RoutedEventArgs e)
{
_viewModel?.Cancel();
}
protected override void OnClosing(WindowClosingEventArgs e)
{
CapturedGeometry = new DialogGeometry
{
Width = Width,
Height = Height,
Left = Position.X,
Top = Position.Y
};
base.OnClosing(e);
}
}