mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Marked all service implementations as internal
Core - Enabled XML docs Modules - Added DI to module VMs
This commit is contained in:
1 parent
ae9bdecef1
commit
a06ad8f011
29 files changed
+134
-46
No files matched your search
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Core.Plugins.Abstract.ViewModels;
|
||||
|
||||
namespace Artemis.Core.Plugins.Modules
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public class ModuleTab<T> : ModuleTab where T : ModuleViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ModuleTab{T}" /> class
|
||||
/// </summary>
|
||||
/// <param name="title">The title of the tab</param>
|
||||
public ModuleTab(string title)
|
||||
{
|
||||
Title = title;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Type Type => typeof(T);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Describes a UI tab for a specific module
|
||||
/// </summary>
|
||||
public abstract class ModuleTab
|
||||
{
|
||||
/// <summary>
|
||||
/// The module this tab belongs to
|
||||
/// </summary>
|
||||
internal Module Module { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The title of the tab
|
||||
/// </summary>
|
||||
public string Title { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// The type of view model the tab contains
|
||||
/// </summary>
|
||||
public abstract Type Type { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Artemis.Core.Extensions;
|
||||
|
||||
namespace Artemis.Core.Plugins.Modules
|
||||
{
|
||||
public class ProcessActivationRequirement : IModuleActivationRequirement
|
||||
{
|
||||
public string ProcessName { get; set; }
|
||||
public string Location { get; set; }
|
||||
|
||||
public ProcessActivationRequirement(string processName, string location = null)
|
||||
{
|
||||
ProcessName = processName;
|
||||
Location = location;
|
||||
}
|
||||
|
||||
|
||||
public bool Evaluate()
|
||||
{
|
||||
if (ProcessName == null && Location == null)
|
||||
return false;
|
||||
|
||||
var processes = ProcessName != null ? Process.GetProcessesByName(ProcessName).Where(p => !p.HasExited) : Process.GetProcesses().Where(p => !p.HasExited);
|
||||
return Location != null
|
||||
? processes.Any(p => Path.GetDirectoryName(p.GetProcessFilename()) == Location)
|
||||
: processes.Any();
|
||||
}
|
||||
}
|
||||
|
||||
public interface IModuleActivationRequirement
|
||||
{
|
||||
bool Evaluate();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user