forked from files-community/Files
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreateShortcutDialog.xaml.cs
46 lines (39 loc) · 1.19 KB
/
CreateShortcutDialog.xaml.cs
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
// Copyright (c) 2024 Files Community
// Licensed under the MIT License. See the LICENSE.
using Files.App.ViewModels.Dialogs;
using Files.App.ViewModels.Dialogs;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Data;
namespace Files.App.Dialogs
{
public sealed partial class CreateShortcutDialog : ContentDialog, IDialog<CreateShortcutDialogViewModel>, IRealTimeControl
{
private FrameworkElement RootAppElement
=> (FrameworkElement)MainWindow.Instance.Content;
public CreateShortcutDialogViewModel ViewModel
{
get => (CreateShortcutDialogViewModel)DataContext;
set => DataContext = value;
}
public CreateShortcutDialog()
{
InitializeComponent();
InitializeContentLayout();
this.Closing += CreateShortcutDialog_Closing;
InvalidPathWarning.SetBinding(TeachingTip.TargetProperty, new Binding()
{
Source = ShortcutTarget
});
}
private void CreateShortcutDialog_Closing(ContentDialog sender, ContentDialogClosingEventArgs args)
{
this.Closing -= CreateShortcutDialog_Closing;
InvalidPathWarning.IsOpen = false;
}
public new async Task<DialogResult> ShowAsync()
{
return (DialogResult)await base.ShowAsync();
}
}
}