From 0bd3760bec105a00efa0fe624da2eb82d85d06c9 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 14 Jan 2018 16:16:08 +0200 Subject: Added code comments for: MachineStudio.DB --- .../Controls/DbTableView.xaml.cs | 10 +++- .../Converters/ByteArrayToFileSizeConverter.cs | 4 ++ .../EventTypeActionsToStringConverter.cs | 4 ++ .../Converters/LiquidTypeRmlsToStringConverter.cs | 4 ++ .../RolesPermissionsToStringConverter.cs | 4 ++ .../Converters/UsersRolesToStringConverter.cs | 4 ++ .../CustomAttributes/DBViewAttribute.cs | 4 ++ .../Modules/Tango.MachineStudio.DB/DBModule.cs | 32 ++++++++++ .../Managers/RegisteredView.cs | 24 ++++++++ .../Managers/ViewsManager.cs | 12 ++++ .../Messages/CloseEntityEditViewMessage.cs | 4 ++ .../Messages/OpenEntityEditViewMessage.cs | 19 ++++++ .../Tango.MachineStudio.DB.csproj | 7 --- .../Windows/DBDialogWindow.xaml | 32 ---------- .../Windows/DBDialogWindow.xaml.cs | 68 ---------------------- 15 files changed, 124 insertions(+), 108 deletions(-) delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Windows/DBDialogWindow.xaml delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Windows/DBDialogWindow.xaml.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Controls/DbTableView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Controls/DbTableView.xaml.cs index 9ae14952b..8d2a44213 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Controls/DbTableView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Controls/DbTableView.xaml.cs @@ -17,11 +17,16 @@ using System.Windows.Shapes; namespace Tango.MachineStudio.DB.Controls { /// - /// Interaction logic for DbTableView.xaml + /// Represents a database table view wrapper. /// + /// + /// [ContentProperty(nameof(MainContent))] public partial class DbTableView : UserControl { + /// + /// Gets or sets the data table view. + /// public FrameworkElement MainContent { get { return (FrameworkElement)GetValue(MainContentProperty); } @@ -30,6 +35,9 @@ namespace Tango.MachineStudio.DB.Controls public static readonly DependencyProperty MainContentProperty = DependencyProperty.Register("MainContent", typeof(FrameworkElement), typeof(DbTableView), new PropertyMetadata(null)); + /// + /// Initializes a new instance of the class. + /// public DbTableView() { InitializeComponent(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/ByteArrayToFileSizeConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/ByteArrayToFileSizeConverter.cs index 8a690450c..36591cb65 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/ByteArrayToFileSizeConverter.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/ByteArrayToFileSizeConverter.cs @@ -8,6 +8,10 @@ using System.Windows.Data; namespace Tango.MachineStudio.DB.Converters { + /// + /// Converts a byte array size to friendly size string. + /// + /// public class ByteArrayToFileSizeConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/EventTypeActionsToStringConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/EventTypeActionsToStringConverter.cs index 4673d12b2..278802863 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/EventTypeActionsToStringConverter.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/EventTypeActionsToStringConverter.cs @@ -10,6 +10,10 @@ using Tango.MachineStudio.DB.ViewModels; namespace Tango.MachineStudio.DB.Converters { + /// + /// Converts an event type action to string representation. + /// + /// public class EventTypeActionsToStringConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/LiquidTypeRmlsToStringConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/LiquidTypeRmlsToStringConverter.cs index 0bbcd68a3..05ffa684c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/LiquidTypeRmlsToStringConverter.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/LiquidTypeRmlsToStringConverter.cs @@ -10,6 +10,10 @@ using Tango.MachineStudio.DB.ViewModels; namespace Tango.MachineStudio.DB.Converters { + /// + /// Converts a liquid type RML to string. + /// + /// public class LiquidTypeRmlsToStringConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/RolesPermissionsToStringConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/RolesPermissionsToStringConverter.cs index 7a301bd12..6ad99213d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/RolesPermissionsToStringConverter.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/RolesPermissionsToStringConverter.cs @@ -11,6 +11,10 @@ using Tango.MachineStudio.DB.ViewModels; namespace Tango.MachineStudio.DB.Converters { + /// + /// Converts user permission to string. + /// + /// public class RolesPermissionsToStringConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/UsersRolesToStringConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/UsersRolesToStringConverter.cs index 5f820d41d..6b2712642 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/UsersRolesToStringConverter.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/UsersRolesToStringConverter.cs @@ -11,6 +11,10 @@ using Tango.MachineStudio.DB.ViewModels; namespace Tango.MachineStudio.DB.Converters { + /// + /// Converts user role to string. + /// + /// public class UsersRolesToStringConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/CustomAttributes/DBViewAttribute.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/CustomAttributes/DBViewAttribute.cs index 4bf920015..d512ae460 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/CustomAttributes/DBViewAttribute.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/CustomAttributes/DBViewAttribute.cs @@ -6,6 +6,10 @@ using System.Threading.Tasks; namespace Tango.MachineStudio.DB.CustomAttributes { + /// + /// Represents a database view attribute. This will tell the module to treat the view as a data table view. + /// + /// public class DBViewAttribute : Attribute { } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs index 0928d2a1f..4f751d9da 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs @@ -11,27 +11,59 @@ using Tango.MachineStudio.DB.Views; namespace Tango.MachineStudio.DB { + /// + /// Represents a Machine Studio database module. + /// + /// public class DBModule : IStudioModule { + /// + /// The is initialized + /// private bool _isInitialized; + /// + /// Gets the module name. + /// public string Name => "Data Base"; + /// + /// Gets the module description. + /// public string Description => "Provides access to raw database tables."; + /// + /// Gets the module cover image. + /// public BitmapSource Image => SharedUI.Helpers.ResourceHelper.GetImageFromResources("Images/db.png"); + /// + /// Gets the module entry point view. + /// public FrameworkElement MainView => new MainDBView(); + /// + /// Gets a value indicating whether this module has been initialized. + /// public bool IsInitialized => _isInitialized; + /// + /// Gets the permission required to see and load this module. + /// public Permissions Permission => Permissions.RunDataBaseModule; + /// + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// + /// public void Dispose() { throw new NotImplementedException(); } + /// + /// Perform any operations required to initialize this module. + /// public void Initialize() { if (!_isInitialized) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Managers/RegisteredView.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Managers/RegisteredView.cs index fc9051edb..cdd32eaa5 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Managers/RegisteredView.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Managers/RegisteredView.cs @@ -10,12 +10,25 @@ using Tango.MachineStudio.Common.Controls; namespace Tango.MachineStudio.DB.Managers { + /// + /// Represents a registered MDI child (data table) view + /// + /// public class RegisteredView : MdiChild { private static Random rnd = new Random(); + /// + /// Adds the view to the display. + /// public RelayCommand AddCommand { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// The header. + /// The view. + /// The action. public RegisteredView(String header, FrameworkElement view, Action action) { Location = new Point(rnd.Next(30, 200), rnd.Next(30, 200)); @@ -44,12 +57,23 @@ namespace Tango.MachineStudio.DB.Managers } } + /// + /// Initializes a new instance of the class. + /// + /// The header. + /// The view. public RegisteredView(String header, FrameworkElement view) : this(header, view, null) { Header = header; View = view; } + /// + /// Returns a that represents this instance. + /// + /// + /// A that represents this instance. + /// public override string ToString() { return Header; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Managers/ViewsManager.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Managers/ViewsManager.cs index 2bb5969bc..e136c5983 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Managers/ViewsManager.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Managers/ViewsManager.cs @@ -11,12 +11,24 @@ using Tango.MachineStudio.DB.Views.DBViews; namespace Tango.MachineStudio.DB.Managers { + /// + /// Represents the data table views manager. + /// public static class ViewsManager { + /// + /// Gets or sets the displayed views. + /// public static ObservableCollection DisplayedViews { get; set; } + /// + /// Gets or sets all the views. + /// public static ObservableCollection DbViews { get; set; } + /// + /// Initializes the class. + /// static ViewsManager() { DisplayedViews = new ObservableCollection(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Messages/CloseEntityEditViewMessage.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Messages/CloseEntityEditViewMessage.cs index 97e5cf21c..22e65149e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Messages/CloseEntityEditViewMessage.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Messages/CloseEntityEditViewMessage.cs @@ -7,6 +7,10 @@ using Tango.MachineStudio.Common.Messages; namespace Tango.MachineStudio.DB.Messages { + /// + /// Invoked when the user has closed the current editable entity. + /// + /// public class CloseEntityEditViewMessage : IStudioMessage { } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Messages/OpenEntityEditViewMessage.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Messages/OpenEntityEditViewMessage.cs index b3bf53f93..b0c099f1a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Messages/OpenEntityEditViewMessage.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Messages/OpenEntityEditViewMessage.cs @@ -10,14 +10,33 @@ using Tango.SharedUI; namespace Tango.MachineStudio.DB.Messages { + /// + /// Invoked when the user has opened an entity for editing. + /// + /// public class OpenEntityEditViewMessage : IStudioMessage { + /// + /// Gets or sets the dialog open mode. + /// public DialogOpenMode DialogOpenMode { get; set; } + /// + /// Gets or sets the context. + /// public ViewModel Context { get; set; } + /// + /// Gets or sets the type of the entity. + /// public Type EntityType { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// The mode. + /// The context. + /// Type of the entity. public OpenEntityEditViewMessage(DialogOpenMode mode, ViewModel context, Type entityType) { DialogOpenMode = mode; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj index 4faf2125a..ca71f1897 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj @@ -348,9 +348,6 @@ MainDBView.xaml - - DBDialogWindow.xaml - MSBuild:Compile Designer @@ -650,10 +647,6 @@ MSBuild:Compile Designer - - Designer - MSBuild:Compile - diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Windows/DBDialogWindow.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Windows/DBDialogWindow.xaml deleted file mode 100644 index 83cd48926..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Windows/DBDialogWindow.xaml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Windows/DBDialogWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Windows/DBDialogWindow.xaml.cs deleted file mode 100644 index d9629c642..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Windows/DBDialogWindow.xaml.cs +++ /dev/null @@ -1,68 +0,0 @@ -using MahApps.Metro.Controls; -using MaterialDesignThemes.Wpf; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Shapes; -namespace Tango.MachineStudio.DB.Windows -{ - /// - /// Interaction logic for DBDialogWindow.xaml - /// - public partial class DBDialogWindow : MetroWindow - { - public DBDialogWindow() - { - InitializeComponent(); - } - - public String InnerTitle - { - get { return (String)GetValue(InnerTitleProperty); } - set { SetValue(InnerTitleProperty, value); } - } - public static readonly DependencyProperty InnerTitleProperty = - DependencyProperty.Register("InnerTitle", typeof(String), typeof(DBDialogWindow), new PropertyMetadata(null)); - - - - public PackIconKind IconKind - { - get { return (PackIconKind)GetValue(IconKindProperty); } - set { SetValue(IconKindProperty, value); } - } - - // Using a DependencyProperty as the backing store for IconKind. This enables animation, styling, binding, etc... - public static readonly DependencyProperty IconKindProperty = - DependencyProperty.Register("IconKind", typeof(PackIconKind), typeof(DBDialogWindow), new PropertyMetadata(PackIconKind.TableEdit)); - - - - - public DBDialogWindow(FrameworkElement content) : this() - { - presenter.Content = content; - } - - private void OnOKClicked(object sender, RoutedEventArgs e) - { - DialogResult = true; - Close(); - } - - private void OnCancelClicked(object sender, RoutedEventArgs e) - { - DialogResult = false; - Close(); - } - } -} -- cgit v1.3.1