private async Task LoadTabs() { var stashData = Clipboard.GetText(); _tabs.Clear(); try { var tabs = (JArray)JObject.Parse(stashData)["tabs"]; foreach (var tab in tabs) { if (tab["hidden"].Value <bool>()) { continue; } var name = tab["n"].Value <string>(); var index = tab["i"].Value <int>(); var c = tab["colour"].Value <JObject>(); var color = Color.FromArgb(0xFF, c["r"].Value <byte>(), c["g"].Value <byte>(), c["b"].Value <byte>()); _tabs.Add(new StashBookmark(name, index, color)); } if (Build.League != null) { _persistenData.LeagueStashes[Build.League] = new List <StashBookmark>(_tabs); } } catch (Exception e) { await _dialogCoordinator.ShowErrorAsync(this, L10n.Message("An error occurred while attempting to load stash data."), e.Message); } TabsView.Refresh(); TabsView.MoveCurrentToFirst(); }
private void BuildOnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs) { if (propertyChangedEventArgs != null && propertyChangedEventArgs.PropertyName == "League") { _tabs.Clear(); if (Build.League != null && _persistenData.LeagueStashes.ContainsKey(Build.League)) { _tabs.AddRange(_persistenData.LeagueStashes[Build.League]); } TabsView.Refresh(); TabsView.MoveCurrentToFirst(); } TabsLink = string.Format( "https://www.pathofexile.com/character-window/get-stash-items?tabs=1&tabIndex=0&league={0}&accountName={1}", Build.League, Build.AccountName); UpdateTabLink(); }