Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Kiertscher committed Nov 13, 2017
2 parents 8979ebb + 1be6fe1 commit da2d7ea
Show file tree
Hide file tree
Showing 197 changed files with 1,771 additions and 581 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
/release
/applibs

/env.cmd
/env.*
/bench-*.cmd
/*.zip
/bench-site.md
*.lnk
Expand Down
1 change: 1 addition & 0 deletions BenchManager/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
obj
bin
.vs/
*.suo
*.user
*.cache
Expand Down
5 changes: 4 additions & 1 deletion BenchManager/BenchCLI/BenchCLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Mastersign.Bench.Cli</RootNamespace>
<AssemblyName>bench</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
Expand All @@ -26,6 +26,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand All @@ -35,6 +36,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>logo.ico</ApplicationIcon>
Expand Down Expand Up @@ -132,6 +134,7 @@
<Content Include="logo.ico" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="Properties\App.config" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions BenchManager/BenchCLI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.16.2.0")]
[assembly: AssemblyFileVersion("0.16.2.0")]
[assembly: AssemblyVersion("0.17.0.0")]
[assembly: AssemblyFileVersion("0.17.0.0")]
3 changes: 3 additions & 0 deletions BenchManager/BenchCLI/app.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
8 changes: 6 additions & 2 deletions BenchManager/BenchDashboard/AppLauncherControl.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

112 changes: 108 additions & 4 deletions BenchManager/BenchDashboard/AppLauncherControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,20 @@
using System.Windows.Forms;
using Mastersign.Bench.Dashboard.Properties;
using System.Threading.Tasks;
using System.Diagnostics;

namespace Mastersign.Bench.Dashboard
{
public partial class AppLauncherControl : UserControl
{
private AppFacade contextApp;

public AppLauncherControl()
{
InitializeComponent();
VisibleChanged += VisibleChangedHandler;
}

private void VisibleChangedHandler(object sender, EventArgs e)
{
if (!Visible) return;
Expand Down Expand Up @@ -97,7 +100,39 @@ private Task<Tuple<Icon, Icon>> LoadIcons(AppFacade app)
});
}

private void listView_DoubleClick(object sender, EventArgs e)
private void ShowAppContextMenu(AppFacade app, Point position)
{
contextApp = app;
var ctxm = new ContextMenuStrip();
var runItem = new ToolStripMenuItem("Run App", Resources.do_16, RunAppHandler);
runItem.Font = new Font(runItem.Font, runItem.Font.Style | FontStyle.Bold);
ctxm.Items.Add(runItem);
ctxm.Items.Add(new ToolStripSeparator());
ctxm.Items.Add(new ToolStripMenuItem("App Info", Resources.info_16, AppInfoHandler));
if (!string.IsNullOrWhiteSpace(contextApp.Website))
{
ctxm.Items.Add(new ToolStripMenuItem("Website", Resources.website_16, AppWebsiteHandler));
}
foreach (var n in contextApp.Docs.Keys.OrderBy(k => k))
{
ctxm.Items.Add(new ToolStripMenuItem(n, Resources.website_16, AppDocLinkHandler)
{ Tag = contextApp.Docs[n] });
}
ctxm.Items.Add(new ToolStripSeparator());
ctxm.Items.Add(new ToolStripMenuItem("Open App Directory", Resources.browse_folder_16, AppOpenDirHandler));

var copyMenu = new ToolStripMenuItem("Copy to Clipboard ...", Resources.copy_16);
copyMenu.DropDownItems.Add(new ToolStripMenuItem("Launcher Path", null, CopyLauncherPathHandler));
copyMenu.DropDownItems.Add(new ToolStripMenuItem("Executable Path", null, CopyExecutablePathHandler));
if (!string.IsNullOrWhiteSpace(contextApp.Url))
{
copyMenu.DropDownItems.Add(new ToolStripMenuItem("Download URL", null, CopyDownloadUrlHandler));
}
ctxm.Items.Add(copyMenu);
ctxm.Show(listView, position);
}

private void DoubleClickHandler(object sender, EventArgs e)
{
if (Core == null) return;
var item = listView.SelectedItems.Count > 0 ? listView.SelectedItems[0] : null;
Expand All @@ -107,14 +142,83 @@ private void listView_DoubleClick(object sender, EventArgs e)
}
}

private void listView_MouseClick(object sender, MouseEventArgs e)
private void MouseClickHandler(object sender, MouseEventArgs e)
{
if (e.Button != MouseButtons.Right) return;
if (Core == null) return;
var item = listView.SelectedItems.Count > 0 ? listView.SelectedItems[0] : null;
if (item != null)
{
// nothing yet
ShowAppContextMenu(Core.Config.Apps[(string)item.Tag], e.Location);
}
}

private void RunAppHandler(object sender, EventArgs e)
=> Core.LaunchApp(contextApp.ID);

private void AppInfoHandler(object sender, EventArgs e)
=> Core.ShowAppInfo(contextApp.ID);

private void AppWebsiteHandler(object sender, EventArgs e)
=> Core.ShowAppWebsite(contextApp.ID);

private void AppDocLinkHandler(object sender, EventArgs e)
=> Process.Start((sender as ToolStripItem)?.Tag as string);

private void AppOpenDirHandler(object sender, EventArgs e)
=> Process.Start(contextApp.Dir);

private void CopyLauncherPathHandler(object sender, EventArgs e)
=> Clipboard.SetData("Text", contextApp.GetLauncherScriptFile());

private void CopyExecutablePathHandler(object sender, EventArgs e)
=> Clipboard.SetData("Text", contextApp.Exe);

private void CopyDownloadUrlHandler(object sender, EventArgs e)
=> Clipboard.SetData("Text", contextApp.Url);

private void DragEnterHandler(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent("FileDrop", true))
{
e.Effect = DragDropEffects.Move;
}
else if (e.Data.GetDataPresent("System.String", true))
{
e.Effect = DragDropEffects.Copy;
}
else
{
e.Effect = DragDropEffects.None;
}
}

private void DragOverHandler(object sender, DragEventArgs e)
{
var p = listView.PointToClient(new Point(e.X, e.Y));
var item = listView.GetItemAt(p.X, p.Y);
e.Effect = item != null
? e.Data.GetDataPresent("FileDrop", true)
? DragDropEffects.Move
: DragDropEffects.Copy
: DragDropEffects.None;
}

private void DragDropHandler(object sender, DragEventArgs e)
{
var p = listView.PointToClient(new Point(e.X, e.Y));
var item = listView.GetItemAt(p.X, p.Y);
if (item == null) return;

if (e.Data.GetDataPresent("FileDrop", true))
{
var paths = e.Data.GetData("FileDrop", true) as string[];
Core.LaunchApp((string)item.Tag, paths);
}
else if (e.Data.GetDataPresent("System.String", true))
{
var text = e.Data.GetData("System.String", true) as string;
Core.LaunchApp((string)item.Tag, text);
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions BenchManager/BenchDashboard/AppLauncherControl.resx
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="icons32.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="icons32.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="icons16.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="icons16.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>110, 17</value>
</metadata>
</root>
1 change: 1 addition & 0 deletions BenchManager/BenchDashboard/BenchDashboard.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@
<None Include="Resources\browse_folder_16.png" />
<None Include="Resources\browse_file_16.png" />
<None Include="Resources\export_clone_16.png" />
<Content Include="Resources\copy_16.png" />
<Content Include="Resources\MarkdownViewerTemplate.html" />
<None Include="Resources\doc_16.png" />
<None Include="Resources\docs_16.png" />
Expand Down
25 changes: 25 additions & 0 deletions BenchManager/BenchDashboard/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,31 @@ public Process LaunchApp(string id, params string[] args)
}
}

public void ShowAppInfo(string id)
{
new AppInfoDialog(Config, Config.Apps[id]).ShowDialog(GuiContext);
}

public void ShowAppWebsite(string id)
{
var app = Config.Apps[id];
try
{
var url = new Uri(app.Website, UriKind.Absolute);
if (url.Scheme != "http" && url.Scheme != "https")
{
throw new ArgumentException("The given URL does not use the HTTP(S) protocol: "
+ app.Website);
}
Process.Start(url.AbsoluteUri);
}
catch (Exception exc)
{
MessageBox.Show(GuiContext, exc.Message, "Open Website",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}

public void ShowPathInExplorer(string path)
{
Process.Start(path);
Expand Down
4 changes: 2 additions & 2 deletions BenchManager/BenchDashboard/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.16.2.0")]
[assembly: AssemblyFileVersion("0.16.2.0")]
[assembly: AssemblyVersion("0.17.0.0")]
[assembly: AssemblyFileVersion("0.17.0.0")]
Loading

0 comments on commit da2d7ea

Please sign in to comment.