Click here to Skip to main content
15,895,709 members
Articles / Web Development / HTML

My Personal Commander Variant

Rate me:
Please Sign up or sign in to vote.
4.66/5 (13 votes)
5 Oct 2016CPOL14 min read 44.6K   1.2K   47  
A C#/WPF application for displaying folders on a grid and performing combined functions on them.
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML>
<HEAD>
<meta name="GENERATOR" content="Microsoft&reg; HTML Help Workshop 4.1">
<Title>Customization via PowerShell</Title>
</HEAD>
<BODY>
<h1>MPCV Customization via PowerShell</h1>

<p>The MPCV can be customized by external PowerShell scripts. For now, only the background color of folder browser items can be changed, but this already opens a range of options. Whenever the content of a folder browser is changed, a powershell script may be called with the list of items contained. It will run asynchronously in order not to delay the loading of the folder contents.</p>


<p>The list given to the script is represented by <code>Lobster.MPCV.VM.FolderBrowserInfoVM.FolderItemWrapper</code> objects (simplified declaration):</p>

<pre>public class FolderItemWrapper {
    public PathItemVM Item { get; }
    public PathItemVM GetSynchronizationSource();
}</pre>

<p>This object is a mere level of indirection in order to allow access to the current item as well as its synchronized item in another folder browser (Item Synchronization can be configured in the menu "Tabs" > "Properties"). <code>Item</code> is a property as it is directly bound; the synchronized item has to be actively looked up, which will take about O(N) for each item and O(N�) in total. Each path item iteself can be accessed by the following simplified interface:</p>

<pre>public class PathItemVM {
    public string DisplayName {get;}
    public string PathName {get;}
    public System.Windows.Media.Color BackgroundColor {get; set;}
}</pre>

<p>PowerShell script examples can be found in $\lobster\MPCV\Scripts\.</p> 

<p>The example "Compare.ps1" shows the differences between two synchronized folders. Newer files are marked in light green while older ones are marked in light red. Files that are not found in the other folder are marked light gray. Identical files keep their white background. Once the script is in place, it has to be linked from the folder browsers (see "Tab Configuration"). The resulting customized MPCV will look as follows:</p>

<p><img alt="Tab Configuration" src="main_window_ps1_bkg.jpg" complete="true"></p>

</BODY>
</HTML>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions