Example #1
0
        private async void buttonOK_Click(object sender, EventArgs e)
        {
            labelStatus.ForeColor = SystemColors.ControlText;
            labelStatus.Text      = "Logging in...";

            SiteInfo site = (SiteInfo)comboBoxSite.SelectedItem;

            Client = new WikiaClient(site.Url, _userAgent);
            bool success = await Client.LoginAsync(textBoxUsername.Text, textBoxPassword.Text);

            if (success)
            {
                SaveDetails();
                DialogResult = DialogResult.OK;
                UserName     = textBoxUsername.Text;
                Site         = site;
                Close();
            }
            else
            {
                labelStatus.ForeColor = Color.Red;
                labelStatus.Text      = "Login Failed";
                Client.Dispose();
                Client = null;
            }
        }
Example #2
0
 private void FormMain_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (_client != null)
     {
         _client.Dispose();
         _client = null;
     }
 }
Example #3
0
 public FormNewDeck(WikiaClient client, string deckPrefix)
 {
     InitializeComponent();
     _client                 = client;
     _deckPrefix             = deckPrefix;
     labelStatus.Text        = "";
     labelStatus.UseMnemonic = false;
 }
Example #4
0
        public FormDecklists(WikiaClient client, Deck deck, IEnumerable <Card> cards, string decklistsPageTitle, string userName)
        {
            InitializeComponent();
            _client    = client;
            _deck      = deck;
            _cards     = cards;
            _userName  = userName;
            _decklists = new Decklists(_client, decklistsPageTitle);

            textBoxName.TextChanged        += InputTextChanged;
            textBoxDescription.TextChanged += InputTextChanged;
            comboBoxStrategy.TextChanged   += InputTextChanged;
        }
Example #5
0
        private void Login()
        {
            FormLogin dlg = new FormLogin();

            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                _client   = dlg.Client;
                _userName = dlg.UserName;
                _cards    = new List <Card>();
                _cards.Load(dlg.Site.CardDataFileName);
                _sets                  = new Sets(_cards);
                _filteredCards         = _cards;
                _decks                 = new Decks(_deckPrefix, _client);
                _useRarityForMaxInHand = dlg.Site.UseRarityForMaxInHand;
                Text = Text + " - " + dlg.Site.Name;
                UpdateCardList();
            }
            else
            {
                Close();
            }
            UpdateUI(false);
        }
Example #6
0
 public Decks(string deckPrefix, WikiaClient client)
 {
     _deckPrefix = deckPrefix;
     _client     = client;
 }
Example #7
0
 public Decklists(WikiaClient client, string decklistsPageTitle)
 {
     _client             = client;
     _decklistsPageTitle = decklistsPageTitle;
     _page = new WikiaPage(_client, _decklistsPageTitle);
 }