Ejemplo n.º 1
0
        /// <summary>
        /// Sets the revision ids to diff. Note that even the pages can be different from each other.
        /// </summary>
        public async Task SetRevisionsAsync(int revisionId1, int revisionId2)
        {
            RevisionId1 = revisionId1;
            RevisionId2 = revisionId2;
            Revision1   = Revision2 = null;
            Title       = Tx.T("page diff.general title", "name1", revisionId1.ToString(), "name2", revisionId2.ToString());
            IsBusy      = true;
            Status      = Tx.T("page diff.fetching", "revs", Tx.EnumAnd(revisionId1.ToString(), revisionId2.ToString()));
            try
            {
                Revision r1, r2;
                var      site = await SiteContext.GetSiteAsync();

                if (revisionId1 == revisionId2)
                {
                    // O' Rly?
                    r1 = r2 = await Revision.FetchRevisionAsync(site, revisionId1);
                }
                else
                {
                    var rs = await Revision.FetchRevisionsAsync(site, revisionId1, revisionId2).ToArray();

                    r1 = rs[0];
                    r2 = rs[1];
                }
                SetRevisions(r1, r2);
                Status = null;
            }
            catch (Exception ex)
            {
                Status = ex.Message;
            }
            finally
            {
                IsBusy = false;
            }
        }