53 lines
1.6 KiB
C#
53 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Runtime.InteropServices.WindowsRuntime;
|
|
using IPClab3.Models;
|
|
using IPClab3.ViewModels;
|
|
using Microsoft.UI.Xaml;
|
|
using Microsoft.UI.Xaml.Controls;
|
|
using Microsoft.UI.Xaml.Controls.Primitives;
|
|
using Microsoft.UI.Xaml.Data;
|
|
using Microsoft.UI.Xaml.Input;
|
|
using Microsoft.UI.Xaml.Media;
|
|
using Microsoft.UI.Xaml.Navigation;
|
|
using Windows.Foundation;
|
|
using Windows.Foundation.Collections;
|
|
|
|
// To learn more about WinUI, the WinUI project structure,
|
|
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
|
|
|
namespace IPClab3.Hack;
|
|
|
|
public sealed partial class Hack : UserControl
|
|
{
|
|
public MainWindowViewModel ViewModel;
|
|
public Window window;
|
|
public Hack()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void AutoSuggestBox_SuggestionChosen(AutoSuggestBox sender, AutoSuggestBoxSuggestionChosenEventArgs args)
|
|
{
|
|
ViewModel.SelectedProcess = (ProcessItem)args.SelectedItem;
|
|
}
|
|
|
|
private void AutoSuggestBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
|
|
{
|
|
if (ViewModel.SelectedProcess?.ProcessName != sender.Text)
|
|
ViewModel.SelectedProcess = null;
|
|
}
|
|
|
|
private void Button_PointerEntered(object sender, PointerRoutedEventArgs e)
|
|
{
|
|
ViewModel.AttachProcessCommand.NotifyCanExecuteChanged();
|
|
}
|
|
|
|
private async void Button_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
await ViewModel.PickFile(WinRT.Interop.WindowNative.GetWindowHandle(window));
|
|
}
|
|
}
|