Merge branch 'feature/environment-var' into 'release/0.1.1.158'

Feature/environment var

See merge request SympatheticFire/linear-app-launcher!8
This commit is contained in:
Ray 2020-11-21 00:32:32 +00:00
commit 73f2dec47c
6 changed files with 36 additions and 31 deletions

View File

@ -8,10 +8,11 @@
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<RootNamespace>AppLauncher</RootNamespace> <RootNamespace>AppLauncher</RootNamespace>
<AssemblyName>fizzylauncher</AssemblyName> <AssemblyName>fizzylauncher</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic> <Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
@ -134,6 +135,7 @@
<EmbeddedResource Include="Windows\Forms\Tile\TTilePanel.resx"> <EmbeddedResource Include="Windows\Forms\Tile\TTilePanel.resx">
<DependentUpon>TTilePanel.cs</DependentUpon> <DependentUpon>TTilePanel.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<None Include="app.config" />
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>

View File

@ -26,6 +26,7 @@ namespace AppLauncher
//protected const int MOD_SHIFT = 0x4; //protected const int MOD_SHIFT = 0x4;
//protected const int MOD_WIN = 0x8; //protected const int MOD_WIN = 0x8;
protected const int WM_HOTKEY = 0x312; protected const int WM_HOTKEY = 0x312;
protected const int WM_QUERYENDSESSION = 0x0011;
protected OptionsForm optionsForm = null; protected OptionsForm optionsForm = null;
protected string sessionFilename = null; protected string sessionFilename = null;
@ -127,17 +128,25 @@ namespace AppLauncher
protected override void WndProc(ref Message m) protected override void WndProc(ref Message m)
{ {
base.WndProc(ref m); switch (m.Msg)
{
if (m.Msg != WM_HOTKEY) return; case WM_HOTKEY:
if (m.WParam.ToInt32() == 1)
switch (m.WParam.ToInt32())
{ {
case 1:
this.Visible = !this.Visible; this.Visible = !this.Visible;
}
break;
case WM_QUERYENDSESSION:
requestExit = true;
this.Close();
break; break;
default: break; default: break;
} }
base.WndProc(ref m);
} }
public LauncherSession CurrentSession { get; set; } = null; public LauncherSession CurrentSession { get; set; } = null;

View File

@ -1,4 +1,5 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing; using System.Drawing;
@ -19,18 +20,11 @@ namespace AppLauncher.Models
public override string ToString() => this.Title ?? string.Empty; public override string ToString() => this.Title ?? string.Empty;
//public void Update(TileModel model) public string CleanProcessFilename => (string.IsNullOrWhiteSpace(this.ProcessFilename) ? string.Empty : Environment.ExpandEnvironmentVariables(this.ProcessFilename));
//{
// this.Title = model.Title; public string CleanProcessArgument => (string.IsNullOrWhiteSpace(this.ProcessArgument) ? string.Empty : Environment.ExpandEnvironmentVariables(this.ProcessArgument));
// this.ProcessFilename = model.ProcessFilename;
// this.ProcessArgument = model.ProcessArgument; public string CleanProcessWorkingDirectory => (string.IsNullOrWhiteSpace(this.ProcessWorkingDirectory) ? string.Empty : Environment.ExpandEnvironmentVariables(this.ProcessWorkingDirectory));
// this.ProcessWorkingDirectory = model.ProcessWorkingDirectory;
// this.ProcessWindowStyle = model.ProcessWindowStyle;
// this.ProcessAsAdmin = model.ProcessAsAdmin;
// this.Position = model.Position;
// this.IsGroup = model.IsGroup;
// this.Items = model.Items;
//}
} }
} }

View File

@ -33,4 +33,4 @@ using System.Runtime.InteropServices;
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("0.1.1.153")] [assembly: AssemblyFileVersion("0.1.1.158")]

View File

@ -12,7 +12,7 @@ namespace AppLauncher.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

View File

@ -283,21 +283,21 @@ namespace AppLauncher.Windows.Forms
return; return;
} }
if (string.IsNullOrWhiteSpace(model.ProcessFilename)) if (string.IsNullOrWhiteSpace(model.CleanProcessFilename))
{ {
return; return;
} }
if (!File.Exists(model.ProcessFilename)) if (!File.Exists(model.CleanProcessFilename))
{ {
return; return;
} }
ProcessStartInfo p = new ProcessStartInfo(); ProcessStartInfo p = new ProcessStartInfo();
p.FileName = model.ProcessFilename; p.FileName = model.CleanProcessFilename;
p.WindowStyle = model.ProcessWindowStyle; p.WindowStyle = model.ProcessWindowStyle;
if (!string.IsNullOrWhiteSpace(model.ProcessArgument)) p.Arguments = model.ProcessArgument; if (!string.IsNullOrWhiteSpace(model.CleanProcessArgument)) p.Arguments = model.CleanProcessArgument;
if (!string.IsNullOrWhiteSpace(model.ProcessWorkingDirectory)) p.WorkingDirectory = model.ProcessWorkingDirectory; if (!string.IsNullOrWhiteSpace(model.CleanProcessWorkingDirectory)) p.WorkingDirectory = model.CleanProcessWorkingDirectory;
if (model.ProcessAsAdmin) p.Verb = "runas"; if (model.ProcessAsAdmin) p.Verb = "runas";
MainForm parentForm = findMainForm(); MainForm parentForm = findMainForm();
@ -324,14 +324,14 @@ namespace AppLauncher.Windows.Forms
protected Image getIcon(TileModel model) protected Image getIcon(TileModel model)
{ {
if (!File.Exists(model.ProcessFilename)) if (!File.Exists(model.CleanProcessFilename))
{ {
return null; return null;
} }
try try
{ {
return Icon.ExtractAssociatedIcon(model.ProcessFilename)?.ToBitmap(); return Icon.ExtractAssociatedIcon(model.CleanProcessFilename)?.ToBitmap();
} }
catch catch
{ {