public FindItemWithViewModel() { PricesVisiability = Visibility.Hidden; StickerPriceVisiability = Visibility.Hidden; marketApi = new MarketApi(KeyContorller.LoadKey()); parserWorker = new ParserWorker <ObservableCollection <items> >(new ParserBuyItems()); ListItems = new ObservableCollection <items>(); parserWorker.OnNewData += (arg, collection) => { ListItems = collection; }; }
public string this[string columnName] { get { switch (columnName) { case "ApiKey": if (!string.IsNullOrEmpty(ApiKey)) { MarketApi marketApi = new MarketApi(ApiKey); try { marketApi.StartPing(); var balance = marketApi.GetBalance(); KeyIsFinded = "Ключ валидный"; Balance = balance.Result; KeyContorller.SaveKey(ApiKey); } catch { KeyIsFinded = "Ключ не валидный"; Balance = ""; } break; } else { var ApiKeyWithFile = KeyContorller.LoadKey(); if (string.IsNullOrWhiteSpace(ApiKey)) { ApiKey = ApiKeyWithFile; } } break; } return(_KeyIsFinded); } }