ListInputForm.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace Steam_Desktop_Authenticator
  11. {
  12. public partial class ListInputForm : Form
  13. {
  14. public ListInputForm(List<string> options)
  15. {
  16. Items = options;
  17. InitializeComponent();
  18. }
  19. public int SelectedIndex;
  20. List<string> Items;
  21. private void ListInputForm_Load(object sender, EventArgs e)
  22. {
  23. foreach (var item in Items)
  24. {
  25. lbItems.Items.Add(item);
  26. }
  27. }
  28. private void btnAccept_Click(object sender, EventArgs e)
  29. {
  30. if (lbItems.SelectedIndex != -1)
  31. {
  32. SelectedIndex = lbItems.SelectedIndex;
  33. this.Close();
  34. }
  35. }
  36. private void btnCancel_Click(object sender, EventArgs e)
  37. {
  38. this.Close();
  39. }
  40. }
  41. }