HashCalculator.GUI/MainWindow.xaml.cs
2020-03-28 23:16:45 +01:00

86 lines
2.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace HashCalculator.GUI
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
internal ViewModel ViewModel => (ViewModel)DataContext;
public MainWindow()
{
InitializeComponent();
}
private void OnMainInputTextChanged(object sender, TextChangedEventArgs e)
{
CopyableBox.ShowDialog(async token =>
{
var init = DateTimeOffset.UtcNow;
var i = 0;
while (i < 100)
{
token.ThrowIfCancellationRequested();
await Task.Delay(100).ConfigureAwait(false);
++i;
}
MessageBox.Show("Completed!");
return $"Completed after exactly {DateTimeOffset.UtcNow - init}";
});
/*var mainInput = _viewModel.MainInput;
if (sender is InputBar)
{
var inputValue = mainInput.Text;
if(inputValue != null)
{
mainInput.Items = _suggestions.ProvideFileSystemSuggestions(inputValue)
.Prepend(new InputEntry(InputEntryType.Text, inputValue, inputValue));
}
}*/
}
private void OnBigInputTextChanged(object sender, TextChangedEventArgs e)
{
/*var mainInput = _viewModel.MainInput;
if (sender is InputBar)
{
var inputValue = mainInput.Text;
if (inputValue != null)
{
mainInput.Items = _suggestions.ProvideFileSystemSuggestions(inputValue)
.Prepend(new InputEntry(InputEntryType.Text, inputValue, inputValue));
}
}*/
}
private void OnAssetInputTextChanged(object sender, TextChangedEventArgs e)
{
/*var mainInput = _viewModel.MainInput;
if (sender is InputBar)
{
var inputValue = mainInput.Text;
if (inputValue != null)
{
mainInput.Items = _suggestions.ProvideFileSystemSuggestions(inputValue)
.Prepend(new InputEntry(InputEntryType.Text, inputValue, inputValue));
}
}*/
}
}
}