Files
deskhubsharprevised/DeskHubSharpRevised/SearchWindow.axaml.cs

52 lines
1.2 KiB
C#
Raw Normal View History

2022-06-29 13:02:15 -04:00
using System.Collections.ObjectModel;
using Avalonia;
2022-06-29 12:59:53 -04:00
using Avalonia.Controls;
2022-06-29 13:02:15 -04:00
using Avalonia.Interactivity;
2022-06-29 12:59:53 -04:00
using Avalonia.Markup.Xaml;
2022-06-29 13:02:15 -04:00
using DeskHubSharpRevised.BLL;
using DeskHubSharpRevised.Models;
2022-06-29 12:59:53 -04:00
2022-06-29 13:02:15 -04:00
namespace DeskHubSharpRevised;
public partial class SearchWindow : Window
2022-06-29 12:59:53 -04:00
{
2022-06-29 13:02:15 -04:00
private Request _request;
private ObservableCollection<RepoDetail> _repoDetail;
public SearchWindow()
2022-06-29 12:59:53 -04:00
{
2022-06-29 13:02:15 -04:00
InitializeComponent();
2022-06-29 12:59:53 -04:00
#if DEBUG
2022-06-29 13:02:15 -04:00
this.AttachDevTools();
2022-06-29 12:59:53 -04:00
#endif
2022-06-29 13:02:15 -04:00
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
private void btn_close_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
2022-06-29 12:59:53 -04:00
2022-06-29 13:02:15 -04:00
private void btn_search_Click(object sender, RoutedEventArgs e)
{
if (string.IsNullOrEmpty(txtbox_query.Text))
{
var parentWindow = this;
ErrorWindow err = new ErrorWindow();
err.txtblk_error.Text = "Please enter a username!";
err.ShowDialog(parentWindow);
}
else
2022-06-29 12:59:53 -04:00
{
2022-06-29 13:02:15 -04:00
_request = new Request(txtbox_query.Text);
_request.PerformSearchRequest();
_request.PerformUserRequest();
this.Close();
2022-06-29 12:59:53 -04:00
}
2022-06-29 13:02:15 -04:00
2022-06-29 12:59:53 -04:00
}
2022-06-29 13:02:15 -04:00
}