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); }
/// <summary> /// Called from view, notifies that an item has been double-clicked. /// </summary> public void NotifyWikiSiteDoubleClick(WikiSiteViewModel site) { if (site == null) { return; } OpenWikiSiteOverview(site); }
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(); }
// 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); }
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()); }
public AccountProfileViewModel(IEventAggregator eventAggregator, WikiSiteViewModel siteVm) : this(eventAggregator, siteVm, null) { }
private WikiSiteOverviewViewModel OpenWikiSiteOverview(WikiSiteViewModel site) { return(_ChildViewModelService.Documents.ActivateOrCreate(site, () => _ViewModelFactory.CreateWikiSiteOverview(site))); }