List of analyses was added into main window
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using StructureHelperCommon.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Analyses
|
||||
{
|
||||
public class AnalysisUpdateStrategy : IUpdateStrategy<IAnalysis>
|
||||
{
|
||||
public void Update(IAnalysis targetObject, IAnalysis sourceObject)
|
||||
{
|
||||
CheckObject.IsNull(targetObject, sourceObject, "Analysis Properties");
|
||||
if (ReferenceEquals(targetObject, sourceObject)) { return; }
|
||||
targetObject.Name = sourceObject.Name;
|
||||
targetObject.Tags = sourceObject.Tags;
|
||||
}
|
||||
}
|
||||
}
|
||||
16
StructureHelperCommon/Models/Analyses/IAnalysis.cs
Normal file
16
StructureHelperCommon/Models/Analyses/IAnalysis.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Analyses
|
||||
{
|
||||
public interface IAnalysis : ISaveable
|
||||
{
|
||||
string Name { get; set; }
|
||||
string Tags { get; set; }
|
||||
IVersionProcessor VersionProcessor { get;}
|
||||
}
|
||||
}
|
||||
15
StructureHelperCommon/Models/Analyses/IVersion.cs
Normal file
15
StructureHelperCommon/Models/Analyses/IVersion.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Analyses
|
||||
{
|
||||
public interface IVersion
|
||||
{
|
||||
DateTime DateTime { get; }
|
||||
ISaveable Item { get; set; }
|
||||
}
|
||||
}
|
||||
16
StructureHelperCommon/Models/Analyses/IVersionProcessor.cs
Normal file
16
StructureHelperCommon/Models/Analyses/IVersionProcessor.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Analyses
|
||||
{
|
||||
public interface IVersionProcessor : ISaveable
|
||||
{
|
||||
void AddVersion(ISaveable newItem);
|
||||
List<IVersion> Versions { get; }
|
||||
IVersion GetCurrentVersion();
|
||||
}
|
||||
}
|
||||
16
StructureHelperCommon/Models/Analyses/Version.cs
Normal file
16
StructureHelperCommon/Models/Analyses/Version.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Analyses
|
||||
{
|
||||
public class Version : IVersion
|
||||
{
|
||||
public DateTime DateTime { get; set; }
|
||||
|
||||
public ISaveable Item { get; set; }
|
||||
}
|
||||
}
|
||||
48
StructureHelperCommon/Models/Analyses/VersionProcessor.cs
Normal file
48
StructureHelperCommon/Models/Analyses/VersionProcessor.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using StructureHelperCommon.Infrastructures.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StructureHelperCommon.Models.Analyses
|
||||
{
|
||||
public class VersionProcessor : IVersionProcessor
|
||||
{
|
||||
public List<IVersion> Versions { get; }
|
||||
|
||||
public Guid Id { get; }
|
||||
|
||||
public VersionProcessor(Guid id)
|
||||
{
|
||||
|
||||
Id = id;
|
||||
Versions = new();
|
||||
}
|
||||
public VersionProcessor() : this (new Guid())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void AddVersion(IVersion version)
|
||||
{
|
||||
Versions.Add(version);
|
||||
}
|
||||
|
||||
public void AddVersion(ISaveable newItem)
|
||||
{
|
||||
var version = new Version()
|
||||
{
|
||||
DateTime = DateTime.Now,
|
||||
Item = newItem
|
||||
};
|
||||
AddVersion(version);
|
||||
}
|
||||
|
||||
|
||||
public IVersion GetCurrentVersion()
|
||||
{
|
||||
return Versions[^1];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user