Skip to content
Snippets Groups Projects
Commit 32e607ca authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Preliminary code for a folder selection dialog to initiate a transfer.

Refers to #2
parent c4500b10
No related branches found
No related tags found
No related merge requests found
...@@ -35,6 +35,18 @@ ...@@ -35,6 +35,18 @@
<ApplicationIcon>AutoTx.ico</ApplicationIcon> <ApplicationIcon>AutoTx.ico</ApplicationIcon>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Microsoft.WindowsAPICodePack, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.WindowsAPICodePack-Core.1.1.0.0\lib\Microsoft.WindowsAPICodePack.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.WindowsAPICodePack.Shell, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.WindowsAPICodePack-Shell.1.1.0.0\lib\Microsoft.WindowsAPICodePack.Shell.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.WindowsAPICodePack.ShellExtensions, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.WindowsAPICodePack-Shell.1.1.0.0\lib\Microsoft.WindowsAPICodePack.ShellExtensions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
...@@ -59,6 +71,7 @@ ...@@ -59,6 +71,7 @@
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon> <DependentUpon>Resources.resx</DependentUpon>
</Compile> </Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>
......
...@@ -4,6 +4,7 @@ using System.Timers; ...@@ -4,6 +4,7 @@ using System.Timers;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using Microsoft.WindowsAPICodePack.Dialogs;
using ATXSerializables; using ATXSerializables;
using Timer = System.Timers.Timer; using Timer = System.Timers.Timer;
...@@ -35,6 +36,7 @@ namespace ATXTray ...@@ -35,6 +36,7 @@ namespace ATXTray
private readonly ToolStripMenuItem _miSvcRunning = new ToolStripMenuItem(); private readonly ToolStripMenuItem _miSvcRunning = new ToolStripMenuItem();
private readonly ToolStripMenuItem _miSvcSuspended = new ToolStripMenuItem(); private readonly ToolStripMenuItem _miSvcSuspended = new ToolStripMenuItem();
private readonly ToolStripMenuItem _miTxProgress = new ToolStripMenuItem(); private readonly ToolStripMenuItem _miTxProgress = new ToolStripMenuItem();
private readonly ToolStripMenuItem _miTxEnqueue = new ToolStripMenuItem();
public AutoTxTray() { public AutoTxTray() {
_notifyIcon.Visible = true; _notifyIcon.Visible = true;
...@@ -70,15 +72,20 @@ namespace ATXTray ...@@ -70,15 +72,20 @@ namespace ATXTray
_miSvcSuspended.Text = @"No limits apply, service active."; _miSvcSuspended.Text = @"No limits apply, service active.";
_miSvcSuspended.Click += ShowContextMenu; _miSvcSuspended.Click += ShowContextMenu;
_miTxProgress.Text = "No transfer running."; _miTxProgress.Text = @"No transfer running.";
_miTxProgress.Click += ShowContextMenu; _miTxProgress.Click += ShowContextMenu;
_miTxEnqueue.Text = @"+++ Add new directory for transfer. +++";
_miTxEnqueue.Click += _miTxEnqueue_Click;
_cmStrip.Items.AddRange(new ToolStripItem[] { _cmStrip.Items.AddRange(new ToolStripItem[] {
_miTitle, _miTitle,
_miSvcRunning, _miSvcRunning,
_miSvcSuspended, _miSvcSuspended,
_miTxProgress, _miTxProgress,
new ToolStripSeparator(), new ToolStripSeparator(),
_miTxEnqueue,
new ToolStripSeparator(),
_miExit _miExit
}); });
...@@ -135,6 +142,18 @@ namespace ATXTray ...@@ -135,6 +142,18 @@ namespace ATXTray
_notifyIcon.ContextMenuStrip.Show(); _notifyIcon.ContextMenuStrip.Show();
} }
private void _miTxEnqueue_Click(object sender, EventArgs e) {
var dirDialog = new CommonOpenFileDialog {
Title = @"Select directory to be transferred",
IsFolderPicker = true,
EnsurePathExists = true,
DefaultDirectory = _config.SourceDrive
};
if (dirDialog.ShowDialog() == CommonFileDialogResult.Ok) {
MessageBox.Show("Directory selected: " + dirDialog.FileName);
}
}
/// <summary> /// <summary>
/// Read (or re-read) the service status file if it has changed since last time. /// Read (or re-read) the service status file if it has changed since last time.
/// </summary> /// </summary>
......
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.WindowsAPICodePack-Core" version="1.1.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAPICodePack-Shell" version="1.1.0.0" targetFramework="net45" />
</packages>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment