diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-01-14 16:16:08 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-01-14 16:16:08 +0200 |
| commit | 0bd3760bec105a00efa0fe624da2eb82d85d06c9 (patch) | |
| tree | 5ff2c6994a32da9a94571dd653de825f218f51d3 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB | |
| parent | bcdbd113e628e9d69982b16e543bd139f7e22f3f (diff) | |
| download | Tango-0bd3760bec105a00efa0fe624da2eb82d85d06c9.tar.gz Tango-0bd3760bec105a00efa0fe624da2eb82d85d06c9.zip | |
Added code comments for:
MachineStudio.DB
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB')
15 files changed, 124 insertions, 108 deletions
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 { /// <summary> - /// Interaction logic for DbTableView.xaml + /// Represents a database table view wrapper. /// </summary> + /// <seealso cref="System.Windows.Controls.UserControl" /> + /// <seealso cref="System.Windows.Markup.IComponentConnector" /> [ContentProperty(nameof(MainContent))] public partial class DbTableView : UserControl { + /// <summary> + /// Gets or sets the data table view. + /// </summary> 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)); + /// <summary> + /// Initializes a new instance of the <see cref="DbTableView"/> class. + /// </summary> 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 { + /// <summary> + /// Converts a byte array size to friendly size string. + /// </summary> + /// <seealso cref="System.Windows.Data.IValueConverter" /> 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 { + /// <summary> + /// Converts an event type action to string representation. + /// </summary> + /// <seealso cref="System.Windows.Data.IValueConverter" /> 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 { + /// <summary> + /// Converts a liquid type RML to string. + /// </summary> + /// <seealso cref="System.Windows.Data.IValueConverter" /> 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 { + /// <summary> + /// Converts user permission to string. + /// </summary> + /// <seealso cref="System.Windows.Data.IValueConverter" /> 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 { + /// <summary> + /// Converts user role to string. + /// </summary> + /// <seealso cref="System.Windows.Data.IValueConverter" /> 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 { + /// <summary> + /// Represents a database view attribute. This will tell the module to treat the view as a data table view. + /// </summary> + /// <seealso cref="System.Attribute" /> 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 { + /// <summary> + /// Represents a Machine Studio database module. + /// </summary> + /// <seealso cref="Tango.MachineStudio.Common.IStudioModule" /> public class DBModule : IStudioModule { + /// <summary> + /// The is initialized + /// </summary> private bool _isInitialized; + /// <summary> + /// Gets the module name. + /// </summary> public string Name => "Data Base"; + /// <summary> + /// Gets the module description. + /// </summary> public string Description => "Provides access to raw database tables."; + /// <summary> + /// Gets the module cover image. + /// </summary> public BitmapSource Image => SharedUI.Helpers.ResourceHelper.GetImageFromResources("Images/db.png"); + /// <summary> + /// Gets the module entry point view. + /// </summary> public FrameworkElement MainView => new MainDBView(); + /// <summary> + /// Gets a value indicating whether this module has been initialized. + /// </summary> public bool IsInitialized => _isInitialized; + /// <summary> + /// Gets the permission required to see and load this module. + /// </summary> public Permissions Permission => Permissions.RunDataBaseModule; + /// <summary> + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// </summary> + /// <exception cref="NotImplementedException"></exception> public void Dispose() { throw new NotImplementedException(); } + /// <summary> + /// Perform any operations required to initialize this module. + /// </summary> 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 { + /// <summary> + /// Represents a registered MDI child (data table) view + /// </summary> + /// <seealso cref="Tango.MachineStudio.Common.Controls.MdiChild" /> public class RegisteredView : MdiChild { private static Random rnd = new Random(); + /// <summary> + /// Adds the view to the display. + /// </summary> public RelayCommand AddCommand { get; set; } + /// <summary> + /// Initializes a new instance of the <see cref="RegisteredView"/> class. + /// </summary> + /// <param name="header">The header.</param> + /// <param name="view">The view.</param> + /// <param name="action">The action.</param> 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 } } + /// <summary> + /// Initializes a new instance of the <see cref="RegisteredView"/> class. + /// </summary> + /// <param name="header">The header.</param> + /// <param name="view">The view.</param> public RegisteredView(String header, FrameworkElement view) : this(header, view, null) { Header = header; View = view; } + /// <summary> + /// Returns a <see cref="System.String" /> that represents this instance. + /// </summary> + /// <returns> + /// A <see cref="System.String" /> that represents this instance. + /// </returns> 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 { + /// <summary> + /// Represents the data table views manager. + /// </summary> public static class ViewsManager { + /// <summary> + /// Gets or sets the displayed views. + /// </summary> public static ObservableCollection<RegisteredView> DisplayedViews { get; set; } + /// <summary> + /// Gets or sets all the views. + /// </summary> public static ObservableCollection<RegisteredView> DbViews { get; set; } + /// <summary> + /// Initializes the <see cref="ViewsManager"/> class. + /// </summary> static ViewsManager() { DisplayedViews = new ObservableCollection<RegisteredView>(); 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 { + /// <summary> + /// Invoked when the user has closed the current editable entity. + /// </summary> + /// <seealso cref="Tango.MachineStudio.Common.Messages.IStudioMessage" /> 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 { + /// <summary> + /// Invoked when the user has opened an entity for editing. + /// </summary> + /// <seealso cref="Tango.MachineStudio.Common.Messages.IStudioMessage" /> public class OpenEntityEditViewMessage : IStudioMessage { + /// <summary> + /// Gets or sets the dialog open mode. + /// </summary> public DialogOpenMode DialogOpenMode { get; set; } + /// <summary> + /// Gets or sets the context. + /// </summary> public ViewModel Context { get; set; } + /// <summary> + /// Gets or sets the type of the entity. + /// </summary> public Type EntityType { get; set; } + /// <summary> + /// Initializes a new instance of the <see cref="OpenEntityEditViewMessage"/> class. + /// </summary> + /// <param name="mode">The mode.</param> + /// <param name="context">The context.</param> + /// <param name="entityType">Type of the entity.</param> 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 @@ <Compile Include="Views\MainDBView.xaml.cs"> <DependentUpon>MainDBView.xaml</DependentUpon> </Compile> - <Compile Include="Windows\DBDialogWindow.xaml.cs"> - <DependentUpon>DBDialogWindow.xaml</DependentUpon> - </Compile> <Page Include="Controls\DbTableView.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> @@ -650,10 +647,6 @@ <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> - <Page Include="Windows\DBDialogWindow.xaml"> - <SubType>Designer</SubType> - <Generator>MSBuild:Compile</Generator> - </Page> </ItemGroup> <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs"> 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 @@ -<mahapps:MetroWindow x:Class="Tango.MachineStudio.DB.Windows.DBDialogWindow" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" - xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" - xmlns:local="clr-namespace:Tango.MachineStudio.DB.Windows" - mc:Ignorable="d" - Title="Machine Studio" Height="450" Width="650" EnableDWMDropShadow="True" ShowCloseButton="False" WindowTransitionsEnabled="False" ShowMaxRestoreButton="False" ShowMinButton="False" TitleCaps="False" BorderThickness="1" WindowStartupLocation="CenterOwner"> - <Grid> - <Border Margin="16"> - <DockPanel LastChildFill="True"> - <StackPanel Orientation="Horizontal" DockPanel.Dock="Top" VerticalAlignment="Top"> - <materialDesign:PackIcon Kind="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=IconKind}" VerticalAlignment="Center" Width="32" Height="32" Foreground="{StaticResource AccentColorBrush}" /> - <TextBlock Margin="10 0 0 0" Foreground="{StaticResource AccentColorBrush}" FontSize="16" Text="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=InnerTitle}"></TextBlock> - </StackPanel> - <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Right" DockPanel.Dock="Bottom"> - <Button Style="{StaticResource MaterialDesignFlatButton}" IsDefault="True" Margin="0 8 8 0" Command="{Binding DialogOKCommand}" Click="OnOKClicked"> - ACCEPT - </Button> - <Button Style="{StaticResource MaterialDesignFlatButton}" IsCancel="True" Margin="0 8 8 0" Command="{Binding DialogCancelCommand}" Click="OnCancelClicked"> - CANCEL - </Button> - </StackPanel> - <ScrollViewer Margin="0 10 0 10" VerticalScrollBarVisibility="Auto" Padding="5"> - <ContentPresenter x:Name="presenter"></ContentPresenter> - </ScrollViewer> - </DockPanel> - </Border> - </Grid> -</mahapps:MetroWindow> 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 -{ - /// <summary> - /// Interaction logic for DBDialogWindow.xaml - /// </summary> - 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(); - } - } -} |
