84 lines
2.7 KiB
C#
84 lines
2.7 KiB
C#
using GTAOnlineCasinoHelper.Classes;
|
|
using MahApps.Metro.Controls;
|
|
using MahApps.Metro.Controls.Dialogs;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
using System.Runtime.InteropServices;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
|
|
namespace GTAOnlineCasinoHelper.Views
|
|
{
|
|
|
|
public partial class CeoVehicleSource : UserControl, INotifyPropertyChanged
|
|
{
|
|
|
|
public Dictionary<int, Dictionary<int, CeoPlate[]>> MidPlates
|
|
{
|
|
get
|
|
{
|
|
return MainWindow.CeoVehicleInventory.MidPlates;
|
|
}
|
|
}
|
|
|
|
public Dictionary<int, Dictionary<int, CeoPlate[]>> TopPlates
|
|
{
|
|
get
|
|
{
|
|
return MainWindow.CeoVehicleInventory.TopPlates;
|
|
}
|
|
}
|
|
|
|
public CeoVehicleSource()
|
|
{
|
|
this.InitializeComponent();
|
|
this.DataContext = this;
|
|
}
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
|
|
protected virtual void OnPropertyChanged(string propertyName)
|
|
{
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
}
|
|
|
|
private async void DoClick(CeoPlate plate)
|
|
{
|
|
MessageDialogResult result = await MainWindow.Instance.ShowMessageAsync(plate.ToString(), "Did you successfully source the vehicle?", MessageDialogStyle.AffirmativeAndNegativeAndSingleAuxiliary, new MetroDialogSettings()
|
|
{
|
|
AffirmativeButtonText = "Yes",
|
|
NegativeButtonText = "No",
|
|
FirstAuxiliaryButtonText = "Cancel",
|
|
DefaultButtonFocus = MessageDialogResult.Affirmative
|
|
});
|
|
if (result != MessageDialogResult.Affirmative && result != MessageDialogResult.Negative)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
|
|
private async void Button_Source_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
string content = (sender as Button)?.Content as string;
|
|
if (content == null)
|
|
{
|
|
await MainWindow.Instance.ShowMessageAsync("Failed to get plate", "Failed to parse plate from the button text", MessageDialogStyle.Affirmative);
|
|
return;
|
|
}
|
|
CeoPlate ceoPlate;
|
|
if (!CeoPlate.TryFind(content, out ceoPlate))
|
|
{
|
|
await MainWindow.Instance.ShowMessageAsync("Failed to get plate", "Failed to parse plate from the button text", MessageDialogStyle.Affirmative);
|
|
return;
|
|
}
|
|
DoClick(ceoPlate);
|
|
}
|
|
}
|
|
|
|
} |