コード例 #1
0
        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");
        }
コード例 #2
0
 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;
 }
コード例 #3
0
 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();
 }