Files
deskhubsharprevised/DeskHubSharpRevised/SearchWindow.axaml.cs

54 lines
1.3 KiB
C#
Raw Permalink 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
{
public string userResponse { get; set; }
2022-06-29 13:02:15 -04:00
private Request _request;
private ObservableCollection<RepoDetail> _repoDetail;
2022-06-29 13:02:15 -04:00
public SearchWindow()
2022-06-29 12:59:53 -04:00
{
2022-06-29 13:02:15 -04:00
InitializeComponent();
DataContext = this;
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(userResponse))
2022-06-29 13:02:15 -04:00
{
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
{
_request = new Request(userResponse);
2022-06-29 13:02:15 -04:00
_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
}