Skip to content

Commit

Permalink
Added documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dirkster99 committed Mar 1, 2018
1 parent 5ad6472 commit 92d5f75
Show file tree
Hide file tree
Showing 40 changed files with 329 additions and 187 deletions.
16 changes: 15 additions & 1 deletion source/FSC_Components/FileListView/Factory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,32 @@
using FileSystemModels.Models.FSItems.Base;

/// <summary>
/// Implements factory methods that creates library objects that are accessible
/// Implements factory methods that create library objects that are accessible
/// through interfaces but are otherwise invisible for the outside world.
/// </summary>
public sealed class Factory
{
private Factory(){ }

/// <summary>
/// Creates a viewmodel object that implements the <see cref="IFileListViewModel"/>
/// interface to drive a file listview.
/// </summary>
/// <param name="browseNavigation"></param>
/// <returns></returns>
public static IFileListViewModel CreateFileListViewModel(IBrowseNavigation browseNavigation)
{
return new FileListViewModel(browseNavigation);
}

/// <summary>
/// Creates a viewmodel object that implements the <see cref="ILVItemViewModel"/>
/// interface to drive one item that can be part of a file listview.
/// </summary>
/// <param name="path"></param>
/// <param name="type"></param>
/// <param name="displayName"></param>
/// <returns></returns>
public static ILVItemViewModel CreateItem(
string path
, FSItemType type
Expand Down
2 changes: 2 additions & 0 deletions source/FSC_Components/FileListView/FileListView.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<DocumentationFile>bin\Debug\FileListView.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -32,6 +33,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<DocumentationFile>bin\Release\FileListView.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ ICommand ToggleIsHiddenVisibleCommand

/// <summary>
/// Gets a command that will open the folder in which an item is stored.
/// The item (path to a file) is expected as <seealso cref="FSItemViewModel"/> parameter.
/// The item (path to a file) is expected as
/// <seealso cref="ILVItemViewModel"/> parameter.
/// </summary>
ICommand OpenContainingFolderCommand
{
Expand All @@ -103,7 +104,7 @@ ICommand OpenContainingFolderCommand

/// <summary>
/// Gets a command that will open the selected item with the current default application
/// in Windows. The selected item (path to a file) is expected as <seealso cref="FSItemViewModel"/> parameter.
/// in Windows. The selected item (path to a file) is expected as <seealso cref="ILVItemViewModel"/> parameter.
/// (eg: Item is HTML file -> Open in Windows starts the web browser for viewing the HTML
/// file if thats the currently associated Windows default application.
/// </summary>
Expand All @@ -114,7 +115,7 @@ ICommand OpenInWindowsCommand

/// <summary>
/// Gets a command that will copy the path of an item into the Windows Clipboard.
/// The item (path to a file) is expected as <seealso cref="FSItemViewModel"/> parameter.
/// The item (path to a file) is expected as <seealso cref="ILVItemViewModel"/> parameter.
/// </summary>
ICommand CopyPathCommand
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
namespace FileListView.Interfaces
{
using FileSystemModels.Interfaces;
using InplaceEditBoxLib.Interfaces;
using System.ComponentModel;

/// <summary>
/// Defines the properties and members of an item view model that is
/// designed for usage in list views or similar controls.
/// </summary>
public interface ILVItemViewModel : IListItemViewModel
public interface ILVItemViewModel : IListItemViewModel, IEditBox, INotifyPropertyChanged
{
/// <summary>
/// Renames this item with the indicated name.
Expand Down
31 changes: 18 additions & 13 deletions source/FSC_Components/FileListView/ViewModels/FileListViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ public ICommand ToggleIsHiddenVisibleCommand

/// <summary>
/// Gets a command that will open the folder in which an item is stored.
/// The item (path to a file) is expected as <seealso cref="FSItemViewModel"/> parameter.
/// The item (path to a file) is expected as <seealso cref="ILVItemViewModel"/> parameter.
/// </summary>
public ICommand OpenContainingFolderCommand
{
Expand All @@ -408,7 +408,7 @@ public ICommand OpenContainingFolderCommand
this._OpenContainingFolderCommand = new RelayCommand<object>(
(p) =>
{
var path = p as LVItemViewModel;
var path = p as ILVItemViewModel;
if (path == null)
return;
Expand All @@ -425,7 +425,8 @@ public ICommand OpenContainingFolderCommand

/// <summary>
/// Gets a command that will open the selected item with the current default application
/// in Windows. The selected item (path to a file) is expected as <seealso cref="FSItemViewModel"/> parameter.
/// in Windows. The selected item (path to a file) is expected as
/// <seealso cref="ILVItemViewModel"/> parameter.
/// (eg: Item is HTML file -> Open in Windows starts the web browser for viewing the HTML
/// file if thats the currently associated Windows default application.
/// </summary>
Expand All @@ -437,7 +438,7 @@ public ICommand OpenInWindowsCommand
this._OpenInWindowsCommand = new RelayCommand<object>(
(p) =>
{
var path = p as LVItemViewModel;
var path = p as ILVItemViewModel;
if (path == null)
return;
Expand All @@ -454,7 +455,7 @@ public ICommand OpenInWindowsCommand

/// <summary>
/// Gets a command that will copy the path of an item into the Windows Clipboard.
/// The item (path to a file) is expected as <seealso cref="FSItemViewModel"/> parameter.
/// The item (path to a file) is expected as <seealso cref="ILVItemViewModel"/> parameter.
/// </summary>
public ICommand CopyPathCommand
{
Expand All @@ -464,7 +465,7 @@ public ICommand CopyPathCommand
this._CopyPathCommand = new RelayCommand<object>(
(p) =>
{
var path = p as LVItemViewModel;
var path = p as ILVItemViewModel;
if (path == null)
return;
Expand Down Expand Up @@ -500,9 +501,9 @@ public ICommand ToggleIsFilteredCommand
#endregion Windows Integration FileSystem Commands

/// <summary>
/// Renames the folder that is represented by this viewmodel.
/// This command should be called directly by the implementing view
/// since the new name of the folder is delivered as string.
/// Renames the folder that is delivered in a Tuple parameter
/// containing the new string and the <see cref="ILVItemViewModel"/> item
/// who's rename method is to be called in this command.
/// </summary>
public ICommand RenameCommand
{
Expand All @@ -515,7 +516,7 @@ public ICommand RenameCommand
if (tuple != null)
{
var folderVM = tuple.Item2 as LVItemViewModel;
var folderVM = tuple.Item2 as ILVItemViewModel;
if (tuple.Item1 != null && folderVM != null)
folderVM.RenameFileOrFolder(tuple.Item1);
Expand All @@ -532,6 +533,9 @@ public ICommand RenameCommand
///
/// This command implements an event that triggers the actual rename
/// process in the connected view.
///
/// The expected parameter is a <see cref="LVItemViewModel"/>
/// that can be supplied as <see cref="ILVItemViewModel"/>.
/// </summary>
public ICommand StartRenameCommand
{
Expand All @@ -552,9 +556,10 @@ public ICommand StartRenameCommand

/// <summary>
/// Starts the create folder process by creating a new folder
/// in the given location. The location is supplied as <seealso cref="System.Windows.Input.ICommandSource.CommandParameter"/>
/// which is a <seealso cref="IFolderViewModel"/> item. So, the <seealso cref="IFolderViewModel"/> item
/// is the parent of the new folder and the new folder is created with a standard name:
/// in the given location. The location is supplied as string
///
/// So, the string is the name of the new folder that is created underneath this folder.
/// The new folder is created with a standard name:
/// 'New Folder n'. The new folder n is selected and in rename mode such that users can edit
/// the name of the new folder right away.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ internal class LVItemViewModel : EditInPlaceViewModel, ILVItemViewModel
/// <param name="displayName"></param>
/// <param name="itemType"></param>
/// <param name="showIcon"></param>
/// <param name="indentation"></param>
public LVItemViewModel(string curdir,
FSItemType itemType,
string displayName,
Expand Down Expand Up @@ -73,7 +72,7 @@ public LVItemViewModel(string curdir,
/// </summary>
/// <param name="model"></param>
/// <param name="itemName"></param>
/// <param name="indentation"></param>
/// <param name="isReadOnly"></param>
public LVItemViewModel(IPathModel model,
string itemName,
bool isReadOnly = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\FilterControlsLib.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -30,6 +31,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\FilterControlsLib.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down Expand Up @@ -80,6 +82,10 @@
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FileListView\FileListView.csproj">
<Project>{735CF8EC-A4EF-49A2-BC72-EC360A0185A4}</Project>
<Name>FileListView</Name>
</ProjectReference>
<ProjectReference Include="..\FileSystemModels\FileSystemModels.csproj">
<Project>{391639c4-5c43-4391-9465-27686e82c33f}</Project>
<Name>FileSystemModels</Name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace FilterControlsLib.ViewModels
using FileSystemModels.Events;
using FilterControlsLib.Collections;
using FileSystemModels.ViewModels.Base;
using FileListView.Interfaces;

/// <summary>
/// Class implements a viewmodel for a combo box like control that
Expand Down Expand Up @@ -259,7 +260,7 @@ public void SetCurrentFilter(string filterDisplayName, string filterText)
/// <summary>
/// Method executes when the SelectionChanged command is invoked.
/// The parameter <paramref name="p"/> can be an array of objects
/// containing objects of the <seealso cref="FSItemViewModel"/> type or
/// containing objects of the <seealso cref="ILVItemViewModel"/> type or
/// p can also be string.
///
/// Each parameter item that adheres to the above types results in
Expand Down
Original file line number Diff line number Diff line change
@@ -1,54 +1,82 @@
namespace FolderBrowser.Converters
{
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

/// <summary>
/// Converts a boolean value into a configurable
/// value of type <seealso cref="Visibility"/>.
///
/// Source: http://stackoverflow.com/questions/3128023/wpf-booleantovisibilityconverter-that-converts-to-hidden-instead-of-collapsed-wh
/// </summary>
[ValueConversion(typeof(bool), typeof(Visibility))]
public sealed class BoolToVisibilityConverter : IValueConverter
{
#region constructor
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

/// <summary>
/// Class constructor
/// Converts a boolean value into a configurable
/// value of type <seealso cref="Visibility"/>.
///
/// Source: http://stackoverflow.com/questions/3128023/wpf-booleantovisibilityconverter-that-converts-to-hidden-instead-of-collapsed-wh
/// </summary>
public BoolToVisibilityConverter()
[ValueConversion(typeof(bool), typeof(Visibility))]
public sealed class BoolToVisibilityConverter : IValueConverter
{
// set defaults
TrueValue = Visibility.Visible;
FalseValue = Visibility.Collapsed;
}
#endregion constructor
#region constructor
/// <summary>
/// Class constructor
/// </summary>
public BoolToVisibilityConverter()
{
// set defaults
TrueValue = Visibility.Visible;
FalseValue = Visibility.Collapsed;
}
#endregion constructor

#region properties
public Visibility TrueValue { get; set; }
public Visibility FalseValue { get; set; }
#endregion properties
#region properties
/// <summary>
/// Gets/sets the <see cref="Visibility"/> value that is associated
/// (converted into) with the boolean true value.
/// </summary>
public Visibility TrueValue { get; set; }

#region methods
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (!(value is bool))
return null;
return (bool)value ? TrueValue : FalseValue;
}
/// <summary>
/// Gets/sets the <see cref="Visibility"/> value that is associated
/// (converted into) with the boolean false value.
/// </summary>
public Visibility FalseValue { get; set; }
#endregion properties

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (Equals(value, TrueValue))
return true;
#region methods
/// <summary>
/// Convertzs a bool value into <see cref="Visibility"/> as configured in the
/// <see cref="TrueValue"/> and <see cref="FalseValue"/> properties.
/// </summary>
/// <param name="value"></param>
/// <param name="targetType"></param>
/// <param name="parameter"></param>
/// <param name="culture"></param>
/// <returns></returns>
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (!(value is bool))
return null;

return (bool)value ? TrueValue : FalseValue;
}

/// <summary>
/// Convertzs a <see cref="Visibility"/> value into bool as configured in the
/// <see cref="TrueValue"/> and <see cref="FalseValue"/> properties.
/// </summary>
/// <param name="value"></param>
/// <param name="targetType"></param>
/// <param name="parameter"></param>
/// <param name="culture"></param>
/// <returns></returns>
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (Equals(value, TrueValue))
return true;

if (Equals(value, FalseValue))
return false;
if (Equals(value, FalseValue))
return false;

return null;
return null;
}
#endregion methods
}
#endregion methods
}
}
Loading

0 comments on commit 92d5f75

Please sign in to comment.