Skip to content

Commit

Permalink
Initial draft.
Browse files Browse the repository at this point in the history
  • Loading branch information
akesseler committed Jun 2, 2019
1 parent 4ccf491 commit 9543c5a
Show file tree
Hide file tree
Showing 44 changed files with 4,918 additions and 3 deletions.
5 changes: 3 additions & 2 deletions LICENSE → LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MIT License

Copyright (c) 2019 Axel Kesseler
# MIT License

Copyright (c) 2019 plexdata.de

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@

# EnvironmentManager
Managing tool for Windows environment variables.

Mainly, this program is designed to switch Windows environment variables using the tray icon
menu. But the program also allows to manage (creating, modifying and deleting) all environment
variables.

Another feature of this program is the possibility to relaunch the program with administrator
privileges as well as to install or remove auto-launch behavior on user logon.
5 changes: 5 additions & 0 deletions code/HISTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

**1.0.0.0**

- Initial draft.
- Published on [https://github.com/akesseler/EnvironmentManager](https://github.com/akesseler/EnvironmentManager).
6 changes: 6 additions & 0 deletions code/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

## Project Build

Best way to build the whole project is to use _Visual Studio 2017 Community_. Thereafter,
download the complete sources, open the solution file ``EnvironmentManager.sln``, switch
to release and rebuild all.
41 changes: 41 additions & 0 deletions code/clean.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
@echo off

goto CHOICE_BINARIES

:CHOICE_BINARIES

choice /M "Do you really want to remove all \"bin\" and \"obj\" folders"

if %ERRORLEVEL% == 1 (
goto CLEAN_BINARIES
) else (
goto CHOICE_PACKAGES
)

:CLEAN_BINARIES

echo Clean up all "bin" and "obj" folders...

for /d /r %%x in (bin, obj) do rmdir "%%x" /s /q 2> nul

:CHOICE_PACKAGES

choice /M "Do you really want to remove all folders in \"packages\""

if %ERRORLEVEL% == 1 (
goto CLEAN_PACKAGES
) else (
goto CHOICE_FINISHED
)

:CLEAN_PACKAGES

echo Clean up all "packages"...

for /d /r %%x in (packages) do rmdir "%%x" /s /q 2> nul

:CHOICE_FINISHED

echo Done!

pause
25 changes: 25 additions & 0 deletions code/src/EnvironmentManager.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.645
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EnvironmentManager", "EnvironmentManager\EnvironmentManager.csproj", "{C1467758-5E28-4BA1-B416-D8E4685A5609}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C1467758-5E28-4BA1-B416-D8E4685A5609}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C1467758-5E28-4BA1-B416-D8E4685A5609}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C1467758-5E28-4BA1-B416-D8E4685A5609}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C1467758-5E28-4BA1-B416-D8E4685A5609}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E763ED87-E880-43D3-8A13-070E62875753}
EndGlobalSection
EndGlobal
123 changes: 123 additions & 0 deletions code/src/EnvironmentManager/Controls/SplitContainerEx.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/*
* MIT License
*
* Copyright (c) 2019 plexdata.de
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

using System;
using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;

namespace Plexdata.EnvironmentManager.Controls
{
// Find a quite nice example of a splitter based on a TableLayoutPanel...
// http://stackoverflow.com/questions/5033690/add-button-controls-to-splitcontainer-splitter/5046984#5046984

public class SplitContainerEx : SplitContainer
{
public SplitContainerEx()
: base()
{
this.SetStyle(ControlStyles.DoubleBuffer, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.ResizeRedraw, true);

base.TabStop = false;
}

protected override void OnKeyUp(KeyEventArgs args)
{
base.OnKeyUp(args);
// Needed to disable painted focus rectangle...
this.Refresh();
}

protected override void OnPaint(PaintEventArgs args)
{
try
{
Size size = new Size(4, 40); // Gripper dimension...
Rectangle rect = this.SplitterRectangle;
VisualStyleRenderer renderer = null;

if (this.Orientation == Orientation.Vertical)
{
rect.Y = (rect.Bottom - (rect.Top + size.Height)) / 2;
rect.Height = size.Height;
rect.Width = size.Width;
rect.X += Math.Max((this.SplitterWidth - rect.Width) / 2, 0) - 1;

if (VisualStyleRenderer.IsElementDefined(VisualStyleElement.Rebar.Gripper.Normal))
{
renderer = new VisualStyleRenderer(VisualStyleElement.Rebar.Gripper.Normal);
}
}
else
{
rect.X = (rect.Right - (rect.Left + size.Height)) / 2;
rect.Height = size.Width;
rect.Width = size.Height;
rect.Y += Math.Max((this.SplitterWidth - rect.Height) / 2, 0) - 1;

if (VisualStyleRenderer.IsElementDefined(VisualStyleElement.Rebar.GripperVertical.Normal))
{
renderer = new VisualStyleRenderer(VisualStyleElement.Rebar.GripperVertical.Normal);
}
}

if (renderer != null)
{
renderer.DrawBackground(args.Graphics, rect, args.ClipRectangle);
}

if (base.Focused && base.TabStop)
{
ControlPaint.DrawFocusRectangle(args.Graphics,
Rectangle.Inflate(this.SplitterRectangle, -1, -1),
this.ForeColor, this.BackColor);
}
}
catch (Exception exception)
{
Debug.WriteLine(exception);
}
}

protected override void OnDoubleClick(EventArgs args)
{
base.OnDoubleClick(args);
if (this.Orientation == Orientation.Vertical)
{
this.SplitterDistance = this.ClientSize.Width / 2;
}
else
{
this.SplitterDistance = this.ClientSize.Height / 2;
}
this.Refresh();
}
}
}

Loading

0 comments on commit 9543c5a

Please sign in to comment.