コード例 #1
0
 public void LoadFromWikiSite(WikiSiteViewModel wikiSite)
 {
     Name     = wikiSite.Name;
     SiteName = wikiSite.SiteName;
     UserName = wikiSite.AccountProfile.UserName;
     // So that it won't trigger UpdateSiteInfoAsync
     SetValidatedApiEndpoint(wikiSite.ApiEndpoint);
 }
コード例 #2
0
 /// <summary>
 /// Called from view, notifies that an item has been double-clicked.
 /// </summary>
 public void NotifyWikiSiteDoubleClick(WikiSiteViewModel site)
 {
     if (site == null)
     {
         return;
     }
     OpenWikiSiteOverview(site);
 }
コード例 #3
0
        internal RecentChangeViewModel(IViewModelFactory viewModelFactory,
                                       WikiSiteViewModel wikiSite, RecentChangesEntry model)
        {
            if (viewModelFactory == null)
            {
                throw new ArgumentNullException(nameof(viewModelFactory));
            }
            if (wikiSite == null)
            {
                throw new ArgumentNullException(nameof(wikiSite));
            }
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }
            _ViewModelFactory = viewModelFactory;
            WikiSite          = wikiSite;
            RawEntry          = model;
            TimeStamp         = model.TimeStamp.ToLocalTime();
            NeedPatrol        = RawEntry.PatrolStatus == PatrolStatus.Unpatrolled;
            if (model.OldRevisionId > 0 && model.RevisionId > 0)
            {
                DiffRevisionIds = Tuple.Create(model.OldRevisionId, model.RevisionId);
            }
            var sb = new StringBuilder();

            switch (model.Type)
            {
            case RecentChangesType.Create:
            case RecentChangesType.Edit:
            case RecentChangesType.Move:
                break;

            case RecentChangesType.Log:
                sb.Append(Tx.SafeText("logactions:" + model.LogAction));
                sb.Append(" ");
                break;

            case RecentChangesType.Categorize:
                sb.Append("Categorize");
                sb.Append(" ");
                break;

            case RecentChangesType.External:
                sb.Append(Tx.T("rctypes:external"));
                sb.Append(" ");
                break;

            default:
                break;
            }
            if (model.Comment != null)
            {
                sb.Append(model.Comment);
            }
            Summary = sb.ToString();
        }
コード例 #4
0
 // statusChangedAction : IsWorking, Status
 public LoginViewModel(WikiSiteViewModel siteVm, Action <bool> closeViewAction, Action <bool, string> statusChangedAction)
 {
     if (siteVm == null)
     {
         throw new ArgumentNullException(nameof(siteVm));
     }
     if (closeViewAction == null)
     {
         throw new ArgumentNullException(nameof(closeViewAction));
     }
     if (statusChangedAction == null)
     {
         throw new ArgumentNullException(nameof(statusChangedAction));
     }
     WikiSite             = siteVm;
     _CloseViewAction     = closeViewAction;
     _StatusChangedAction = statusChangedAction;
     errors = new ErrorsContainer <string>(OnErrorsChanged);
 }
コード例 #5
0
 internal AccountProfileViewModel(IEventAggregator eventAggregator, WikiSiteViewModel wikiSite, WikiSite siteModel)
 {
     if (wikiSite == null)
     {
         throw new ArgumentNullException(nameof(wikiSite));
     }
     if (eventAggregator == null)
     {
         throw new ArgumentNullException(nameof(eventAggregator));
     }
     WikiSite = wikiSite;
     // Try to load cached account info
     if (siteModel != null)
     {
         _UserName = siteModel.UserName;
         _Groups   = siteModel.UserGroups?.ToList();
     }
     wikiSite.AccountRefreshedEvent.Subscribe(() => ReloadAsync().Forget());
 }
コード例 #6
0
 public AccountProfileViewModel(IEventAggregator eventAggregator, WikiSiteViewModel siteVm)
     : this(eventAggregator, siteVm, null)
 {
 }
コード例 #7
0
 private WikiSiteOverviewViewModel OpenWikiSiteOverview(WikiSiteViewModel site)
 {
     return(_ChildViewModelService.Documents.ActivateOrCreate(site,
                                                              () => _ViewModelFactory.CreateWikiSiteOverview(site)));
 }