mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
move calls to viewmodel
This commit is contained in:
parent
9a692a894d
commit
07f77f0077
2 changed files with 22 additions and 5 deletions
|
|
@ -32,18 +32,18 @@ namespace Flow.Launcher
|
|||
|
||||
private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
|
||||
{
|
||||
App.API.OpenUrl(e.Uri.AbsoluteUri);
|
||||
_viewModel.OpenUrl(e.Uri.AbsoluteUri);
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void btnBrowseFile_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var dlg = new Microsoft.Win32.OpenFileDialog();
|
||||
var result = dlg.ShowDialog();
|
||||
if (result == true)
|
||||
var selectedFilePath = _viewModel.SelectFile();
|
||||
|
||||
if (!string.IsNullOrEmpty(selectedFilePath))
|
||||
{
|
||||
var path = (TextBox)(((FrameworkElement)sender).Parent as FrameworkElement).FindName("PathTextBox");
|
||||
path.Text = dlg.FileName;
|
||||
path.Text = selectedFilePath;
|
||||
path.Focus();
|
||||
((Button)sender).Focus();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,6 +98,23 @@ public partial class SelectFileManagerViewModel : BaseModel
|
|||
}
|
||||
}
|
||||
|
||||
internal void OpenUrl(string absoluteUri)
|
||||
{
|
||||
App.API.OpenUrl(absoluteUri);
|
||||
}
|
||||
|
||||
internal string SelectFile()
|
||||
{
|
||||
var dlg = new Microsoft.Win32.OpenFileDialog();
|
||||
var result = dlg.ShowDialog();
|
||||
if (result == true)
|
||||
{
|
||||
return dlg.FileName;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void Add()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue