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(); }
public static string _(string value) { //if (string.IsNullOrWhiteSpace(value)) // return value; try { return(Tx.SafeText(value)); } catch { return(value); } }
protected void ReloadPageInformation() { Title = WikiPage.Title; ToolTip = WikiPage.Title + " - " + SiteContext.DisplayName; if (!WikiPage.Exists) { AlertText = Tx.T("editor.page inexistent"); } if ((WikiPage.Protections?.Count ?? 0) == 0) { ProtectionAlertText = null; } else { ProtectionAlertText = Tx.T("page.protected prompt") + string.Join(null, WikiPage.Protections.Select(p => Tx.T("page.protected prompt.1", "expiry", Tx.Time(p.Expiry, TxTime.YearMonthDay | TxTime.HourMinute), "group", p.Level, "action", Tx.SafeText("page actions:" + p.Type)))); } // Notifies VM that the "content" of wikipage has been changed. OnPropertyChanged(nameof(WikiPage)); }