public SynchronizationReport GetReport(SynchronizationReportName name) { using (var fileStream = File.OpenRead(Path.Combine(_reportDirectory, name.ToString()))) { return(Serializer <SynchronizationReport> .DeserializeFrom(fileStream)); } }
public static ReportViewModel CreateDesignInstance(bool hasWarnings = false, bool hasErrors = false) { var reportName = SynchronizationReportName.Create(Guid.NewGuid(), new DateTime(2000, 10, 10), hasWarnings, hasErrors); var proxy = new ReportProxy(reportName, () => SynchronizationReportDesignInstance, "The profile name"); return(new ReportViewModel(proxy, NullSynchronizationReportRepository.Instance, NullReportViewModelParent.Instance)); }
protected virtual void OnReportAdded(SynchronizationReportName name, SynchronizationReport report) { var handler = ReportAdded; if (handler != null) { handler(this, new ReportAddedEventArgs(report, name)); } }
private SynchronizationReportName GetNextFreeName(string directory, SynchronizationReport report) { var reportName = SynchronizationReportName.Create(report.ProfileId, report.StartTime, report.HasWarnings, report.HasErrors); while (File.Exists(Path.Combine(directory, reportName.ToString()))) { reportName = reportName.IncreaseSequence(); } return(reportName); }
public static ReportViewModel CreateDesignInstance(bool hasWarnings = false, bool hasErrors = false) { var report = new SynchronizationReport(); report.ADelta = "This is the ADelta"; report.BDelta = "This is the BDelta"; var reportName = SynchronizationReportName.Create(Guid.NewGuid(), new DateTime(2000, 10, 10), hasWarnings, hasErrors); var proxy = new ReportProxy(reportName, () => report, "The profile name"); return(new ReportViewModel(proxy, NullSynchronizationReportRepository.Instance)); }
private void AddReportViewModel(SynchronizationReportName reportName) { string profileName; if (!_currentProfileNamesById.TryGetValue(reportName.SyncronizationProfileId, out profileName)) { profileName = "<Not existing anymore>"; } var reportProxy = new ReportProxy(reportName, () => _reportRepository.GetReport(reportName), profileName); var reportViewModel = new ReportViewModel(reportProxy, _reportRepository); _reports.Add(reportViewModel); }
public IReadOnlyList <SynchronizationReportName> GetAvailableReports() { var names = new List <SynchronizationReportName>(); var fileNames = Directory.GetFiles(_reportDirectory); foreach (var fileName in fileNames) { SynchronizationReportName name; if (SynchronizationReportName.TryParse(Path.GetFileName(fileName), out name)) { names.Add(name); } } return(names); }
public Stream GetReportStream(SynchronizationReportName name) { return(new MemoryStream()); }
public void DeleteReport(SynchronizationReportName name) { }
public SynchronizationReport GetReport(SynchronizationReportName name) { return(null); }
public Stream GetReportStream(SynchronizationReportName name) { return(File.OpenRead(Path.Combine(_reportDirectory, name.ToString()))); }
public void DeleteReport(SynchronizationReportName name) { _inner.DeleteReport(name); }
public ReportProxy(SynchronizationReportName name, Func <SynchronizationReport> getValue, string profileName) { _name = name; _getValue = getValue; _profileName = profileName; }
public Stream GetReportStream(SynchronizationReportName name) { return(_inner.GetReportStream(name)); }
public ReportAddedEventArgs(SynchronizationReport report, SynchronizationReportName reportName) : base(report) { _reportName = reportName; }
public void DeleteReport(SynchronizationReportName name) { File.Delete(Path.Combine(_reportDirectory, name.ToString())); }
public SynchronizationReport GetReport(SynchronizationReportName name) { return(_inner.GetReport(name)); }