private string GetGroupImagePath(string groupName) { // Determine GroupImageChoice for groupName. GroupImageChoice imageChoice; if (groupName == Group.DefaultGroup) { imageChoice = GroupImageChoice.Blue; } else if (_groupNameImageChoiceDic.ContainsKey(groupName)) { imageChoice = _groupNameImageChoiceDic[groupName]; } else { if (_lastUsedGroupImageChoice == GroupImageChoice.None || ((int)_lastUsedGroupImageChoice + 1) == (int)GroupImageChoice.Last) { // First new group that is not DefaultGroup, or a new wrapped-around group imageChoice = GroupImageChoice.Blue + 1; } else { imageChoice = _lastUsedGroupImageChoice + 1; } _groupNameImageChoiceDic[groupName] = imageChoice; _lastUsedGroupImageChoice = imageChoice; } return($"pack://application:,,,/Images/{imageChoice}.png"); }
public MainViewModel() { _twitterHttpClient = new TwitterHttpClient(App.TwitterCreds); RefreshCommand = new DelegateCommand(ExecuteRefreshCommand); OpenUrlCommand = new DelegateCommand <string>(ExecuteOpenUrlCommand); RefreshUserTweetsRetweetsCommand = new DelegateCommand(ExecuteRefreshUserTweetsRetweetsCommand); _groupNameImageChoiceDic = new Dictionary <string, GroupImageChoice>(); _lastUsedGroupImageChoice = GroupImageChoice.None; }
public MainViewModel(List <TwitterCredentials> twitterCredsList) { GenerateGroupsCommand = new DelegateCommand(ExecuteGenerateGroupsCommand); RefreshCommand = new DelegateCommand(ExecuteRefreshCommand); OpenUrlCommand = new DelegateCommand <string>(ExecuteOpenUrlCommand); RefreshUserTweetsRetweetsCommand = new DelegateCommand(ExecuteRefreshUserTweetsRetweetsCommand); _groupNameImageChoiceDic = new Dictionary <string, GroupImageChoice>(); _lastUsedGroupImageChoice = GroupImageChoice.None; GenerateGroupsCommandNotExecuted = true; _twitterCredsList = twitterCredsList; TwitterLoginList = _twitterCredsList.Select(x => x.ScreenName).ToList(); }