public void SetApiKeyToUI(EveApiKey activeKey)
 {
     txtAccountName.Text = activeKey.Name;
     txtKeyId.Text = activeKey.KeyId.ToString();
     txtVcode.Text = activeKey.VCode;
     txtCharacterId.Text = activeKey.CharacterId.ToString();
 }
        public void Update(EveApiKey row)
        {
            var itemInList = rows.FirstOrDefault(x => x.KeyId == row.KeyId);
            if (itemInList == null)
                return;

            row.DeepCopyTo(itemInList);
            RaiseCollectionChanged(NotifyCollectionChangedAction.Replace);
        }
        public void Remove(EveApiKey row)
        {
            var itemInList = rows.FirstOrDefault(x => x.KeyId == row.KeyId);
            if (itemInList == null)
                return;

            rows.Remove(itemInList);
            RaiseCollectionChanged(NotifyCollectionChangedAction.Remove);
        }
 public void DeepCopyTo(EveApiKey key)
 {
     key.KeyId = this.KeyId;
     key.VCode = this.VCode;
     key.CharacterId = this.CharacterId;
     key.AccessType = this.AccessType;
     key.AccountStatus = this.AccountStatus;
     key.Name = this.Name;
     key.IsCorp = this.IsCorp;
 }
        public EveApiKey GetApiKeyFromUI()
        {
            var newApiKey = new EveApiKey();

            newApiKey.KeyId = CommonUtils.GetLongFromString(txtKeyId.Text.Trim());
            newApiKey.VCode = txtVcode.Text.Trim();
            newApiKey.Name = txtAccountName.Text.Trim();
            newApiKey.CharacterId = CommonUtils.GetLongFromString(txtCharacterId.Text.Trim());

            return newApiKey;
        }
Exemple #6
0
        private static void InitApiKeys()
        {
            // Check Accounts.json
            var isExists = File.Exists(Consts.FileNameAccounts);
            if( !isExists )
            {
                _apiKeys = new List<EveApiKey>();
                // Add test key
                var apiKey = new EveApiKey {KeyId = 12312, VCode ="xxxx", Name = "Test Account"};
                _apiKeys.Add(apiKey);

                return;
            }

            // If exists - load data
            var fl = new JsonFile<List<EveApiKey>> {FileName = Consts.FileNameAccounts};
            fl.OpenAndRead();
            _apiKeys = fl.GetObject();
        }
 public object Clone()
 {
     var clone = new EveApiKey();
     DeepCopyTo(clone);
     return clone;
 }
 public bool CheckApiKey(EveApiKey apiKey)
 {
     var anonApi = new EveApi(apiKey.KeyId, apiKey.VCode);
     return anonApi.GetAccountEntries().Count > 0;
 }
 public void Add(EveApiKey row)
 {
     rows.Add(row);
     RaiseCollectionChanged(NotifyCollectionChangedAction.Add);
 }
 private void AddApiKeyToList(EveApiKey newApiKey)
 {
     apiKeysCollection.Add(newApiKey);
 }
 private void UpdateApiKeyStatusInGrid(EveApiKey account, int i)
 {
 }
 private void UpdateApiKeyInList(EveApiKey account)
 {
     apiKeysCollection.Update(account);
 }