Skip to content

Commit

Permalink
removed slow entity framework, commented all methods, added dummy for…
Browse files Browse the repository at this point in the history
… splom, pcp and data filtering
  • Loading branch information
braunms committed Sep 4, 2023
1 parent 4c69ad8 commit d4f5222
Show file tree
Hide file tree
Showing 64 changed files with 1,109 additions and 1,065 deletions.
45 changes: 30 additions & 15 deletions Core/Abstracts/AbstractContent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Runtime.Remoting.Contexts;
using System.Windows.Controls;

using Core.Utilities;


Expand All @@ -20,39 +21,44 @@ public abstract class AbstractContent : IAbstractService, IAbstractContent
/* ------------------------------------------------------------------*/
// public classes

public class Settings : IAbstractSettings
/// <summary>
/// Class defining the settings required for restoring content.
/// </summary>
public class Settings : IAbstractSettingData
{
public string ContentID { get; set; }
public string ContentType { get; set; }
public string ID { get; set; }
public string Type { get; set; }
/// TODO Add additional settings that should be saved here...
}


/* ------------------------------------------------------------------*/
// public properties

public abstract string Name { get; }
public abstract bool MultipleIntances { get; }
public abstract bool MultipleInstances { get; }
public abstract List<Type> DependingServices { get; }


public bool IsAttached { get { return _attached; } }
public string ID { get { return _id; } set { _id = value; } }


/* ------------------------------------------------------------------*/
// public functions

/// <summary>
/// Ctor.
/// </summary>
public AbstractContent()
{
_id = UniqueID.Generate();
_timer = new TimeBenchmark();
}


/// <summary>
/// If derived class might requires additional data on initialization (declaring Initialize taking parameter(s)),
/// throw error when method of base class is called instead.
/// If derived class might requires additional data on initialization (declaring Initialize taking parameter(s)) ...
/// </summary>
/// <returns>True on success, false otherwise.</returns>
/// <exception cref="InvalidOperationException">...throw error when method of base class is called instead.</exception>
public virtual bool Initialize()
{
throw new InvalidOperationException("Call Initialize method of derived class");
Expand Down Expand Up @@ -83,7 +89,10 @@ public override bool Initialize()
}
*/


/// <summary>
/// Called to actually create the WPF content.
/// </summary>
/// <returns>True on success, false otherwise.</returns>
public abstract bool Create();
/*
{
Expand All @@ -107,10 +116,10 @@ public override bool Initialize()
}
*/


/// <summary>
/// Attach content to provided content_element.
/// Called when content element is being attached to a parent element.
/// </summary>
/// <returns>The WPF control element holding the content.</returns>
public abstract Control Attach();
/* TEMPLATE
{
Expand All @@ -132,7 +141,10 @@ public override bool Initialize()
}
*/


/// <summary>
/// Called when content has been detached.
/// </summary>
/// <returns>True on success, false otherwise.</returns>
public virtual bool Detach()
{
if (!_attached)
Expand All @@ -144,7 +156,10 @@ public virtual bool Detach()
return true;
}


/// <summary>
/// Called when content should be terminated. Should implement counterpart to Initialize().
/// </summary>
/// <returns>True on success, false otherwise.</returns>
public abstract bool Terminate();
/* TEMPLATE
{
Expand All @@ -162,7 +177,7 @@ public virtual bool Detach()
/* ------------------------------------------------------------------*/
// protected variables

protected bool _initilized = false;
protected bool _initialized = false;
protected bool _created = false;
protected bool _attached = false;

Expand Down
29 changes: 28 additions & 1 deletion Core/Abstracts/IAbstractContent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,51 @@ public interface IAbstractContent
/* ------------------------------------------------------------------*/
// interface properties

/// <summary>
/// The name of the content.
/// </summary>
string Name { get; }

bool MultipleIntances { get; }
/// <summary>
/// True if multiple instances of the content would be created, false otherwise.
/// </summary>
bool MultipleInstances { get; }

/// <summary>
/// Services the content depends on.
/// </summary>
List<Type> DependingServices { get; }

/// <summary>
/// Returns whether WPF content is attached or not.
/// </summary>
bool IsAttached { get; }

/// <summary>
/// The id string of the content.
/// </summary>
string ID { get; }


/* ------------------------------------------------------------------*/
// interface functions

/// <summary>
/// Create the content. To be called only once.
/// </summary>
/// <returns>True on success, false otherwise.</returns>
bool Create();

/// <summary>
/// Called when content element should be attached.
/// </summary>
/// <returns>The content to be attached by the caller.</returns>
Control Attach();

/// <summary>
/// Called when the content element has been detached. Should implement counterpart to Attach().
/// </summary>
/// <returns>True on success, false otherwise.</returns>
bool Detach();
}
}
Expand Down
8 changes: 8 additions & 0 deletions Core/Abstracts/IAbstractService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,16 @@ public interface IAbstractService
/* ------------------------------------------------------------------*/
// interface functions

/// <summary>
/// Initialize the service.
/// </summary>
/// <returns>True on success, false otherwise.</returns>
bool Initialize();

/// <summary>
/// Terminate the service. Should implement counterpart to Initialize().
/// </summary>
/// <returns>True on success, false otherwise.</returns>
bool Terminate();
}
}
Expand Down
40 changes: 40 additions & 0 deletions Core/Abstracts/IAbstractSetting.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Core.GUI;



/*
* Abstract Settings Interfaces for data and classes providing settings
*
*/
namespace Core
{
namespace Abstracts
{
public interface IAbstractSettingData
{
/// Empty so far
}


public interface IAbstractSettings
{
/// <summary>
/// Called for collecting all settings.
/// </summary>
/// <returns>The serialized settings as JSON string.</returns>
string CollectSettings();

/// <summary>
/// Called for applying all settings.
/// </summary>
/// <param name="settings">The settings as JSON string.</param>
/// <returns>True on success, false otherwise.</returns>
bool ApplySettings(string settings);
}
}
}
24 changes: 0 additions & 24 deletions Core/Abstracts/IAbstractSettings.cs

This file was deleted.

2 changes: 1 addition & 1 deletion Core/Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<Compile Include="Abstracts\AbstractContent.cs" />
<Compile Include="Abstracts\IAbstractContent.cs" />
<Compile Include="Abstracts\IAbstractService.cs" />
<Compile Include="Abstracts\IAbstractSettings.cs" />
<Compile Include="Abstracts\IAbstractSetting.cs" />
<Compile Include="GUI\MenuBar.cs" />
<Compile Include="GUI\SettingsService.cs" />
<Compile Include="GUI\Windows\WindowBranch.cs" />
Expand Down
28 changes: 14 additions & 14 deletions Core/GUI/Content/LogContent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public class LogContent : AbstractContent
/* ------------------------------------------------------------------*/
// properties

public override string Name { get { return "Log"; } }
public override bool MultipleIntances { get { return false; } }
public override string Name { get { return "Log Console"; } }
public override bool MultipleInstances { get { return false; } }
public override List<Type> DependingServices { get { return new List<Type>() { }; } }


Expand All @@ -35,7 +35,7 @@ public class LogContent : AbstractContent

public override bool Initialize()
{
if (_initilized)
if (_initialized)
{
Terminate();
}
Expand All @@ -47,18 +47,17 @@ public override bool Initialize()
Log.Default.RegisterListener(this.LogListener);

_timer.Stop();
_initilized = true;
if (_initilized)
_initialized = true;
if (_initialized)
{
Log.Default.Msg(Log.Level.Info, "Successfully initialized: " + this.GetType().Name);
}
return _initilized;
return _initialized;
}


public override bool Create()
{
if (!_initilized)
if (!_initialized)
{
Log.Default.Msg(Log.Level.Error, "Initialization required prior to execution");
return false;
Expand Down Expand Up @@ -86,10 +85,9 @@ public override bool Create()
return _created;
}


public override Control Attach()
{
if (!_initilized)
if (!_initialized)
{
Log.Default.Msg(Log.Level.Error, "Initialization required prior to execution");
return null;
Expand All @@ -106,21 +104,23 @@ public override Control Attach()
return _content;
}


public override bool Terminate()
{
if (_initilized)
if (_initialized)
{
_content = null;
_textblock = null;
Log.Default.UnRegisterListener(this.LogListener);

_initilized = false;
_initialized = false;
}
return true;
}


/// <summary>
/// Log listener callback which should be called whenever new messages are available.
/// </summary>
/// <param name="msglist">provide only the new log messages</param>
public void LogListener(List<Log.MessageData> msglist)
{
// Is called before Initialize() therefore _textblock needs to be not null
Expand Down
Loading

0 comments on commit d4f5222

Please sign in to comment.