Revize b4d47cc5
Přidáno uživatelem Oto Šťáva před téměř 4 roky(ů)
- ID b4d47cc5cca230f75538bdb9acb2a6a9c13ad2e5
- Rodič b300a6e1
deltarobot-vr-launcher/.gitignore | ||
---|---|---|
1 |
obj/ |
|
2 |
bin/ |
|
3 |
|
|
4 |
.idea/ |
deltarobot-vr-launcher/DeltarobotVr.Launcher/DeltarobotVr.Launcher.csproj | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8"?> |
|
2 |
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|
3 |
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> |
|
4 |
<PropertyGroup> |
|
5 |
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
|
6 |
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
|
7 |
<ProjectGuid>{3B359CF2-C5D8-4466-983F-E0467CDB1144}</ProjectGuid> |
|
8 |
<OutputType>Exe</OutputType> |
|
9 |
<AppDesignerFolder>Properties</AppDesignerFolder> |
|
10 |
<RootNamespace>DeltarobotVr.Launcher</RootNamespace> |
|
11 |
<AssemblyName>DeltarobotVr.Launcher</AssemblyName> |
|
12 |
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion> |
|
13 |
<FileAlignment>512</FileAlignment> |
|
14 |
</PropertyGroup> |
|
15 |
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|
16 |
<PlatformTarget>AnyCPU</PlatformTarget> |
|
17 |
<DebugSymbols>true</DebugSymbols> |
|
18 |
<DebugType>full</DebugType> |
|
19 |
<Optimize>false</Optimize> |
|
20 |
<OutputPath>bin\Debug\</OutputPath> |
|
21 |
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|
22 |
<ErrorReport>prompt</ErrorReport> |
|
23 |
<WarningLevel>4</WarningLevel> |
|
24 |
</PropertyGroup> |
|
25 |
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|
26 |
<PlatformTarget>AnyCPU</PlatformTarget> |
|
27 |
<DebugType>pdbonly</DebugType> |
|
28 |
<Optimize>true</Optimize> |
|
29 |
<OutputPath>bin\Release\</OutputPath> |
|
30 |
<DefineConstants>TRACE</DefineConstants> |
|
31 |
<ErrorReport>prompt</ErrorReport> |
|
32 |
<WarningLevel>4</WarningLevel> |
|
33 |
</PropertyGroup> |
|
34 |
<ItemGroup> |
|
35 |
<Reference Include="System" /> |
|
36 |
<Reference Include="System.Core" /> |
|
37 |
<Reference Include="System.Data" /> |
|
38 |
<Reference Include="System.Drawing" /> |
|
39 |
<Reference Include="System.Windows.Forms" /> |
|
40 |
<Reference Include="System.Xml" /> |
|
41 |
</ItemGroup> |
|
42 |
<ItemGroup> |
|
43 |
<Compile Include="LauncherForm.cs" /> |
|
44 |
<Compile Include="LayoutRectangle.cs" /> |
|
45 |
<Compile Include="Program.cs" /> |
|
46 |
<Compile Include="Properties\AssemblyInfo.cs" /> |
|
47 |
</ItemGroup> |
|
48 |
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
|
49 |
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
|
50 |
Other similar extension points exist, see Microsoft.Common.targets. |
|
51 |
<Target Name="BeforeBuild"> |
|
52 |
</Target> |
|
53 |
<Target Name="AfterBuild"> |
|
54 |
</Target> |
|
55 |
--> |
|
56 |
|
|
57 |
</Project> |
deltarobot-vr-launcher/DeltarobotVr.Launcher/LauncherForm.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Drawing; |
|
3 |
using System.Windows.Forms; |
|
4 |
|
|
5 |
namespace DeltarobotVr.Launcher |
|
6 |
{ |
|
7 |
public class LauncherForm : Form |
|
8 |
{ |
|
9 |
|
|
10 |
private readonly Label _serverHostLabel = new Label(); |
|
11 |
private readonly TextBox _serverHost = new TextBox(); |
|
12 |
|
|
13 |
private readonly Label _serverPortLabel = new Label(); |
|
14 |
private readonly TextBox _serverPort = new TextBox(); |
|
15 |
|
|
16 |
private readonly Button _launchButton = new Button(); |
|
17 |
|
|
18 |
|
|
19 |
private const int Spacing = 5; |
|
20 |
private const int ControlHeight = 24; |
|
21 |
private const int LabelWidth = 120; |
|
22 |
|
|
23 |
public LauncherForm() |
|
24 |
{ |
|
25 |
Text = "Deltarobot VR Launcher"; |
|
26 |
|
|
27 |
_serverHostLabel.Text = "Server host:"; |
|
28 |
_serverHostLabel.TextAlign = ContentAlignment.MiddleRight; |
|
29 |
Controls.Add(_serverHostLabel); |
|
30 |
|
|
31 |
Controls.Add(_serverHost); |
|
32 |
|
|
33 |
_serverPortLabel.Text = "Server port:"; |
|
34 |
_serverPortLabel.TextAlign = ContentAlignment.MiddleRight; |
|
35 |
Controls.Add(_serverPortLabel); |
|
36 |
|
|
37 |
Controls.Add(_serverPort); |
|
38 |
|
|
39 |
_launchButton.Text = "Launch"; |
|
40 |
Controls.Add(_launchButton); |
|
41 |
} |
|
42 |
|
|
43 |
protected override void OnLoad(EventArgs e) |
|
44 |
{ |
|
45 |
base.OnLoad(e); |
|
46 |
|
|
47 |
Width = 640; |
|
48 |
Height = 480; |
|
49 |
|
|
50 |
UpdateLayout(); |
|
51 |
CenterToScreen(); |
|
52 |
} |
|
53 |
|
|
54 |
protected override void OnResize(EventArgs e) |
|
55 |
{ |
|
56 |
base.OnResize(e); |
|
57 |
|
|
58 |
UpdateLayout(); |
|
59 |
} |
|
60 |
|
|
61 |
private void UpdateLayout() |
|
62 |
{ |
|
63 |
var lr = new LayoutRectangle(ClientRectangle); |
|
64 |
lr.Shrink(10); |
|
65 |
|
|
66 |
var hostRect = lr.RemoveFromTop(ControlHeight); |
|
67 |
_serverHostLabel.Bounds = hostRect.RemoveFromLeft(LabelWidth).ToRectangle(); |
|
68 |
hostRect.RemoveFromLeft(Spacing); |
|
69 |
_serverHost.Bounds = hostRect.RemoveFromLeft(250).ToRectangle(); |
|
70 |
|
|
71 |
lr.RemoveFromTop(Spacing); |
|
72 |
|
|
73 |
var portRect = lr.RemoveFromTop(ControlHeight); |
|
74 |
_serverPortLabel.Bounds = portRect.RemoveFromLeft(LabelWidth).ToRectangle(); |
|
75 |
portRect.RemoveFromLeft(Spacing); |
|
76 |
_serverPort.Bounds = portRect.RemoveFromLeft(64).ToRectangle(); |
|
77 |
|
|
78 |
lr.RemoveFromTop(2 * Spacing); |
|
79 |
|
|
80 |
_launchButton.Bounds = lr.RemoveFromBottom(ControlHeight * 2).Shrink(10).ToRectangle(); |
|
81 |
} |
|
82 |
} |
|
83 |
} |
deltarobot-vr-launcher/DeltarobotVr.Launcher/LayoutRectangle.cs | ||
---|---|---|
1 |
using System.Drawing; |
|
2 |
|
|
3 |
namespace DeltarobotVr.Launcher |
|
4 |
{ |
|
5 |
public struct LayoutRectangle |
|
6 |
{ |
|
7 |
public int Top; |
|
8 |
public int Right; |
|
9 |
public int Bottom; |
|
10 |
public int Left; |
|
11 |
|
|
12 |
public int Width => Right - Left; |
|
13 |
public int Height => Bottom - Top; |
|
14 |
|
|
15 |
public LayoutRectangle(int top, int right, int bottom, int left) |
|
16 |
{ |
|
17 |
Top = top; |
|
18 |
Right = right; |
|
19 |
Bottom = bottom; |
|
20 |
Left = left; |
|
21 |
} |
|
22 |
|
|
23 |
public LayoutRectangle(Rectangle rect) : this(rect.Top, rect.Right, rect.Bottom, rect.Left) |
|
24 |
{ |
|
25 |
} |
|
26 |
|
|
27 |
public Rectangle ToRectangle() => new Rectangle(Left, Top, Right - Left, Bottom - Top); |
|
28 |
|
|
29 |
public LayoutRectangle RemoveFromTop(int value) |
|
30 |
{ |
|
31 |
if (value > Height) |
|
32 |
{ |
|
33 |
value = Height; |
|
34 |
} |
|
35 |
|
|
36 |
var result = new LayoutRectangle(Top, Right, Top + value, Left); |
|
37 |
Top += value; |
|
38 |
return result; |
|
39 |
} |
|
40 |
|
|
41 |
public LayoutRectangle RemoveFromRight(int value) |
|
42 |
{ |
|
43 |
if (value > Width) |
|
44 |
{ |
|
45 |
value = Width; |
|
46 |
} |
|
47 |
|
|
48 |
var result = new LayoutRectangle(Top, Right, Bottom, Right - value); |
|
49 |
Right -= value; |
|
50 |
return result; |
|
51 |
} |
|
52 |
|
|
53 |
public LayoutRectangle RemoveFromBottom(int value) |
|
54 |
{ |
|
55 |
if (value > Height) |
|
56 |
{ |
|
57 |
value = Height; |
|
58 |
} |
|
59 |
|
|
60 |
var result = new LayoutRectangle(Bottom - value, Right, Bottom, Left); |
|
61 |
Bottom -= value; |
|
62 |
return result; |
|
63 |
} |
|
64 |
|
|
65 |
public LayoutRectangle RemoveFromLeft(int value) |
|
66 |
{ |
|
67 |
if (value > Width) |
|
68 |
{ |
|
69 |
value = Width; |
|
70 |
} |
|
71 |
|
|
72 |
var result = new LayoutRectangle(Top, Left + value, Bottom, Left); |
|
73 |
Left += value; |
|
74 |
return result; |
|
75 |
} |
|
76 |
|
|
77 |
public LayoutRectangle Shrink(int value) |
|
78 |
{ |
|
79 |
Top += value; |
|
80 |
Right -= value; |
|
81 |
Bottom -= value; |
|
82 |
Left += value; |
|
83 |
return this; |
|
84 |
} |
|
85 |
} |
|
86 |
} |
deltarobot-vr-launcher/DeltarobotVr.Launcher/Program.cs | ||
---|---|---|
1 |
using System.Windows.Forms; |
|
2 |
|
|
3 |
namespace DeltarobotVr.Launcher |
|
4 |
{ |
|
5 |
internal class Program |
|
6 |
{ |
|
7 |
public static void Main(string[] args) |
|
8 |
{ |
|
9 |
Application.Run(new LauncherForm()); |
|
10 |
} |
|
11 |
} |
|
12 |
} |
deltarobot-vr-launcher/DeltarobotVr.Launcher/Properties/AssemblyInfo.cs | ||
---|---|---|
1 |
using System.Reflection; |
|
2 |
using System.Runtime.InteropServices; |
|
3 |
|
|
4 |
// General Information about an assembly is controlled through the following |
|
5 |
// set of attributes. Change these attribute values to modify the information |
|
6 |
// associated with an assembly. |
|
7 |
[assembly: AssemblyTitle("deltarobot_vr_launcher")] |
|
8 |
[assembly: AssemblyDescription("")] |
|
9 |
[assembly: AssemblyConfiguration("")] |
|
10 |
[assembly: AssemblyCompany("")] |
|
11 |
[assembly: AssemblyProduct("deltarobot_vr_launcher")] |
|
12 |
[assembly: AssemblyCopyright("Copyright © 2021")] |
|
13 |
[assembly: AssemblyTrademark("")] |
|
14 |
[assembly: AssemblyCulture("")] |
|
15 |
|
|
16 |
// Setting ComVisible to false makes the types in this assembly not visible |
|
17 |
// to COM components. If you need to access a type in this assembly from |
|
18 |
// COM, set the ComVisible attribute to true on that type. |
|
19 |
[assembly: ComVisible(false)] |
|
20 |
|
|
21 |
// The following GUID is for the ID of the typelib if this project is exposed to COM |
|
22 |
[assembly: Guid("3B359CF2-C5D8-4466-983F-E0467CDB1144")] |
|
23 |
|
|
24 |
// Version information for an assembly consists of the following four values: |
|
25 |
// |
|
26 |
// Major Version |
|
27 |
// Minor Version |
|
28 |
// Build Number |
|
29 |
// Revision |
|
30 |
// |
|
31 |
// You can specify all the values or you can default the Build and Revision Numbers |
|
32 |
// by using the '*' as shown below: |
|
33 |
// [assembly: AssemblyVersion("1.0.*")] |
|
34 |
[assembly: AssemblyVersion("1.0.0.0")] |
|
35 |
[assembly: AssemblyFileVersion("1.0.0.0")] |
deltarobot-vr-launcher/deltarobot-vr-launcher.sln | ||
---|---|---|
1 |
|
|
2 |
Microsoft Visual Studio Solution File, Format Version 12.00 |
|
3 |
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeltarobotVr.Launcher", "DeltarobotVr.Launcher\DeltarobotVr.Launcher.csproj", "{3B359CF2-C5D8-4466-983F-E0467CDB1144}" |
|
4 |
EndProject |
|
5 |
Global |
|
6 |
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
|
7 |
Debug|Any CPU = Debug|Any CPU |
|
8 |
Release|Any CPU = Release|Any CPU |
|
9 |
EndGlobalSection |
|
10 |
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
|
11 |
{3B359CF2-C5D8-4466-983F-E0467CDB1144}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
12 |
{3B359CF2-C5D8-4466-983F-E0467CDB1144}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
13 |
{3B359CF2-C5D8-4466-983F-E0467CDB1144}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
14 |
{3B359CF2-C5D8-4466-983F-E0467CDB1144}.Release|Any CPU.Build.0 = Release|Any CPU |
|
15 |
EndGlobalSection |
|
16 |
EndGlobal |
Také k dispozici: Unified diff
Re #9001 - Base launcher