From 8a59643571080bfff715f0b0e4bb03e2dee4961a Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 12 Jun 2018 15:47:10 +0300 Subject: Starting splitting PPC to modules. --- .../PPC/Tango.PPC.Common/PPCModuleBase.cs | 125 +++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/PPCModuleBase.cs (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/PPCModuleBase.cs') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCModuleBase.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCModuleBase.cs new file mode 100644 index 000000000..31c3218db --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCModuleBase.cs @@ -0,0 +1,125 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media.Imaging; +using Tango.Core; +using Tango.BL.Entities; +using Tango.BL.Enumerations; + +namespace Tango.PPC.Common +{ + /// + /// Represents a base class for studio modules. + /// + /// + public abstract class PPCModuleBase : ExtendedObject, IPPCModule + { + private bool _isInitialized; + private bool _isLoaded; + + /// + /// Occurs when the user has navigated into or out of this module. + /// + public event EventHandler IsLoadedChanged; + + /// + /// Gets the module name. + /// + public abstract string Name { get; } + + /// + /// Gets the module description. + /// + public abstract string Description { get; } + + /// + /// Gets the module cover image. + /// + public abstract BitmapSource Image { get; } + + /// + /// Gets the module entry point view type. + /// + public abstract Type MainViewType { get; } + + /// + /// Gets the permission required to see and load this module. + /// + public abstract Permissions Permission { get; } + + /// + /// Gets a value indicating whether this module has been initialized. + /// + public bool IsInitialized + { + get + { + return _isInitialized; + } + private set + { + _isInitialized = value; + } + } + + /// + /// Sets a value indicating whether this module is loaded. + /// + public bool IsLoaded + { + get + { + return _isLoaded; + } + set + { + _isLoaded = value; + IsLoadedChanged?.Invoke(this, value); + } + } + + private bool _inNewWindow; + /// + /// Gets or sets a value indicating whether this module is shown under a new window. + /// + public bool InNewWindow + { + get { return _inNewWindow; } + set { _inNewWindow = value; RaisePropertyChangedAuto(); } + } + + /// + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// + public abstract void Dispose(); + + /// + /// Perform any operations required to initialize this module. + /// + public void Initialize() + { + OnInitialized(); + IsInitialized = true; + } + + /// + /// Called when machine studio initializes this module. + /// + protected virtual void OnInitialized() + { + + } + + /// + /// Raises the event. + /// + /// if set to true the module is loaded. + protected virtual void OnLoadedChanged(bool loaded) + { + + } + } +} -- cgit v1.3.1