| @@ -0,0 +1,6 @@ | |||
| <?xml version="1.0" encoding="utf-8" ?> | |||
| <configuration> | |||
| <startup> | |||
| <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> | |||
| </startup> | |||
| </configuration> | |||
| @@ -0,0 +1,115 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
| <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | |||
| <PropertyGroup> | |||
| <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |||
| <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |||
| <ProjectGuid>{6E722770-D2DB-40AA-BCF4-0443519CCC0C}</ProjectGuid> | |||
| <OutputType>WinExe</OutputType> | |||
| <RootNamespace>FSRemotePowerSwitch</RootNamespace> | |||
| <AssemblyName>FSRemotePowerSwitch</AssemblyName> | |||
| <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> | |||
| <FileAlignment>512</FileAlignment> | |||
| <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | |||
| <Deterministic>true</Deterministic> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |||
| <PlatformTarget>AnyCPU</PlatformTarget> | |||
| <DebugSymbols>true</DebugSymbols> | |||
| <DebugType>full</DebugType> | |||
| <Optimize>false</Optimize> | |||
| <OutputPath>bin\Debug\</OutputPath> | |||
| <DefineConstants>DEBUG;TRACE</DefineConstants> | |||
| <ErrorReport>prompt</ErrorReport> | |||
| <WarningLevel>4</WarningLevel> | |||
| </PropertyGroup> | |||
| <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | |||
| <PlatformTarget>AnyCPU</PlatformTarget> | |||
| <DebugType>pdbonly</DebugType> | |||
| <Optimize>true</Optimize> | |||
| <OutputPath>bin\Release\</OutputPath> | |||
| <DefineConstants>TRACE</DefineConstants> | |||
| <ErrorReport>prompt</ErrorReport> | |||
| <WarningLevel>4</WarningLevel> | |||
| </PropertyGroup> | |||
| <ItemGroup> | |||
| <Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> | |||
| <HintPath>packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> | |||
| </Reference> | |||
| <Reference Include="System" /> | |||
| <Reference Include="System.Core" /> | |||
| <Reference Include="System.Xml.Linq" /> | |||
| <Reference Include="System.Data.DataSetExtensions" /> | |||
| <Reference Include="Microsoft.CSharp" /> | |||
| <Reference Include="System.Data" /> | |||
| <Reference Include="System.Deployment" /> | |||
| <Reference Include="System.Drawing" /> | |||
| <Reference Include="System.Net.Http" /> | |||
| <Reference Include="System.Windows.Forms" /> | |||
| <Reference Include="System.Xml" /> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <Compile Include="Form1.cs"> | |||
| <SubType>Form</SubType> | |||
| </Compile> | |||
| <Compile Include="Form1.Designer.cs"> | |||
| <DependentUpon>Form1.cs</DependentUpon> | |||
| </Compile> | |||
| <Compile Include="Message.cs" /> | |||
| <Compile Include="Program.cs" /> | |||
| <Compile Include="Properties.cs" /> | |||
| <Compile Include="Properties\AssemblyInfo.cs" /> | |||
| <Compile Include="SButton.cs"> | |||
| <SubType>Component</SubType> | |||
| </Compile> | |||
| <Compile Include="Utility.cs" /> | |||
| <EmbeddedResource Include="Form1.resx"> | |||
| <DependentUpon>Form1.cs</DependentUpon> | |||
| </EmbeddedResource> | |||
| <EmbeddedResource Include="Properties\Resources.resx"> | |||
| <Generator>ResXFileCodeGenerator</Generator> | |||
| <LastGenOutput>Resources.Designer.cs</LastGenOutput> | |||
| <SubType>Designer</SubType> | |||
| </EmbeddedResource> | |||
| <Compile Include="Properties\Resources.Designer.cs"> | |||
| <AutoGen>True</AutoGen> | |||
| <DependentUpon>Resources.resx</DependentUpon> | |||
| <DesignTime>True</DesignTime> | |||
| </Compile> | |||
| <None Include="packages.config" /> | |||
| <None Include="Properties\Settings.settings"> | |||
| <Generator>SettingsSingleFileGenerator</Generator> | |||
| <LastGenOutput>Settings.Designer.cs</LastGenOutput> | |||
| </None> | |||
| <Compile Include="Properties\Settings.Designer.cs"> | |||
| <AutoGen>True</AutoGen> | |||
| <DependentUpon>Settings.settings</DependentUpon> | |||
| <DesignTimeSharedInput>True</DesignTimeSharedInput> | |||
| </Compile> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <None Include="App.config" /> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <None Include="Resources\status_online_1.png" /> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <None Include="Resources\status_offline_1.png" /> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <None Include="Resources\Arduino_Logo.png" /> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <None Include="Resources\blue_led_on.png" /> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <None Include="Resources\blue_led_off.png" /> | |||
| </ItemGroup> | |||
| <ItemGroup> | |||
| <ProjectReference Include="..\KnobControl-master\KnobControl.csproj"> | |||
| <Project>{04123F59-331D-4582-BE0D-721FEAB6050F}</Project> | |||
| <Name>KnobControl</Name> | |||
| </ProjectReference> | |||
| </ItemGroup> | |||
| <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |||
| </Project> | |||
| @@ -0,0 +1,31 @@ | |||
| | |||
| Microsoft Visual Studio Solution File, Format Version 12.00 | |||
| # Visual Studio Version 16 | |||
| VisualStudioVersion = 16.0.31702.278 | |||
| MinimumVisualStudioVersion = 10.0.40219.1 | |||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FSRemotePowerSwitch", "FSRemotePowerSwitch.csproj", "{6E722770-D2DB-40AA-BCF4-0443519CCC0C}" | |||
| EndProject | |||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KnobControl", "..\KnobControl-master\KnobControl.csproj", "{04123F59-331D-4582-BE0D-721FEAB6050F}" | |||
| EndProject | |||
| Global | |||
| GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||
| Debug|Any CPU = Debug|Any CPU | |||
| Release|Any CPU = Release|Any CPU | |||
| EndGlobalSection | |||
| GlobalSection(ProjectConfigurationPlatforms) = postSolution | |||
| {6E722770-D2DB-40AA-BCF4-0443519CCC0C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
| {6E722770-D2DB-40AA-BCF4-0443519CCC0C}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
| {6E722770-D2DB-40AA-BCF4-0443519CCC0C}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
| {6E722770-D2DB-40AA-BCF4-0443519CCC0C}.Release|Any CPU.Build.0 = Release|Any CPU | |||
| {04123F59-331D-4582-BE0D-721FEAB6050F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
| {04123F59-331D-4582-BE0D-721FEAB6050F}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
| {04123F59-331D-4582-BE0D-721FEAB6050F}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
| {04123F59-331D-4582-BE0D-721FEAB6050F}.Release|Any CPU.Build.0 = Release|Any CPU | |||
| EndGlobalSection | |||
| GlobalSection(SolutionProperties) = preSolution | |||
| HideSolutionNode = FALSE | |||
| EndGlobalSection | |||
| GlobalSection(ExtensibilityGlobals) = postSolution | |||
| SolutionGuid = {F528582E-39CA-473D-8D6E-46AE61B95A8A} | |||
| EndGlobalSection | |||
| EndGlobal | |||
| @@ -0,0 +1,494 @@ | |||
| | |||
| namespace FSRemotePowerSwitch { | |||
| partial class MainForm { | |||
| /// <summary> | |||
| /// Erforderliche Designervariable. | |||
| /// </summary> | |||
| private System.ComponentModel.IContainer components = null; | |||
| /// <summary> | |||
| /// Verwendete Ressourcen bereinigen. | |||
| /// </summary> | |||
| /// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param> | |||
| protected override void Dispose(bool disposing) { | |||
| if (disposing && (components != null)) { | |||
| components.Dispose(); | |||
| } | |||
| base.Dispose(disposing); | |||
| } | |||
| #region Vom Windows Form-Designer generierter Code | |||
| /// <summary> | |||
| /// Erforderliche Methode für die Designerunterstützung. | |||
| /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. | |||
| /// </summary> | |||
| private void InitializeComponent() { | |||
| this.components = new System.ComponentModel.Container(); | |||
| System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); | |||
| this.serialPort = new System.IO.Ports.SerialPort(this.components); | |||
| this.openBtn = new System.Windows.Forms.Button(); | |||
| this.closeBtn = new System.Windows.Forms.Button(); | |||
| this.serialPortsCboBox = new System.Windows.Forms.ComboBox(); | |||
| this.serialPortLbl = new System.Windows.Forms.Label(); | |||
| this.switchOffStateLbl = new System.Windows.Forms.Label(); | |||
| this.switchOnStateLbl = new System.Windows.Forms.Label(); | |||
| this.switchStateTitelLbl = new System.Windows.Forms.Label(); | |||
| this.label1 = new System.Windows.Forms.Label(); | |||
| this.statusTimer = new System.Windows.Forms.Timer(this.components); | |||
| this.statusBar = new System.Windows.Forms.StatusStrip(); | |||
| this.hrzStrut = new System.Windows.Forms.ToolStripStatusLabel(); | |||
| this.initStatusLbl = new System.Windows.Forms.ToolStripStatusLabel(); | |||
| this.initProgressBar = new System.Windows.Forms.ToolStripProgressBar(); | |||
| this.reconnectBtn = new System.Windows.Forms.ToolStripSplitButton(); | |||
| this.connectedSerialPortLbl = new System.Windows.Forms.ToolStripStatusLabel(); | |||
| this.fwVersionLbl = new System.Windows.Forms.ToolStripStatusLabel(); | |||
| this.pictureBox1 = new System.Windows.Forms.PictureBox(); | |||
| this.powerStateLed = new System.Windows.Forms.PictureBox(); | |||
| this.webCamRotator = new KnobControl.KnobControl(); | |||
| this.rotatorActValue = new System.Windows.Forms.Label(); | |||
| this.webCamRotatorLbl = new System.Windows.Forms.Label(); | |||
| this.webCamRotPowerLbl = new System.Windows.Forms.Label(); | |||
| this.webCamRotatorPowerStatusLed = new System.Windows.Forms.PictureBox(); | |||
| this.webCamRotPwrStatusLbl = new System.Windows.Forms.Label(); | |||
| this.webCamRotatorPowerOffLbl = new System.Windows.Forms.Label(); | |||
| this.webCamRotatorPowerOnLbl = new System.Windows.Forms.Label(); | |||
| this.label2 = new System.Windows.Forms.Label(); | |||
| this.button1 = new System.Windows.Forms.Button(); | |||
| this.webCamRotatorPowerSwitch = new FSRemotePowerSwitch.SButton(); | |||
| this.powerSwitchButton = new FSRemotePowerSwitch.SButton(); | |||
| this.statusBar.SuspendLayout(); | |||
| ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); | |||
| ((System.ComponentModel.ISupportInitialize)(this.powerStateLed)).BeginInit(); | |||
| ((System.ComponentModel.ISupportInitialize)(this.webCamRotatorPowerStatusLed)).BeginInit(); | |||
| this.SuspendLayout(); | |||
| // | |||
| // serialPort | |||
| // | |||
| this.serialPort.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(this.onSerialPortDataReceived); | |||
| // | |||
| // openBtn | |||
| // | |||
| this.openBtn.Enabled = false; | |||
| this.openBtn.Location = new System.Drawing.Point(204, 13); | |||
| this.openBtn.Name = "openBtn"; | |||
| this.openBtn.Size = new System.Drawing.Size(100, 29); | |||
| this.openBtn.TabIndex = 1; | |||
| this.openBtn.Text = "Öffnen"; | |||
| this.openBtn.UseVisualStyleBackColor = true; | |||
| this.openBtn.Click += new System.EventHandler(this.onOpenBtnClick); | |||
| // | |||
| // closeBtn | |||
| // | |||
| this.closeBtn.Enabled = false; | |||
| this.closeBtn.Location = new System.Drawing.Point(310, 13); | |||
| this.closeBtn.Name = "closeBtn"; | |||
| this.closeBtn.Size = new System.Drawing.Size(100, 29); | |||
| this.closeBtn.TabIndex = 2; | |||
| this.closeBtn.Text = "Schliessen"; | |||
| this.closeBtn.UseVisualStyleBackColor = true; | |||
| this.closeBtn.Click += new System.EventHandler(this.onCloseBtnClick); | |||
| // | |||
| // serialPortsCboBox | |||
| // | |||
| this.serialPortsCboBox.FormattingEnabled = true; | |||
| this.serialPortsCboBox.Location = new System.Drawing.Point(111, 14); | |||
| this.serialPortsCboBox.Name = "serialPortsCboBox"; | |||
| this.serialPortsCboBox.Size = new System.Drawing.Size(80, 26); | |||
| this.serialPortsCboBox.TabIndex = 5; | |||
| this.serialPortsCboBox.SelectedIndexChanged += new System.EventHandler(this.onSerialPortsCboBoxSelectedIndexChanged); | |||
| // | |||
| // serialPortLbl | |||
| // | |||
| this.serialPortLbl.AutoSize = true; | |||
| this.serialPortLbl.Location = new System.Drawing.Point(14, 15); | |||
| this.serialPortLbl.Name = "serialPortLbl"; | |||
| this.serialPortLbl.Size = new System.Drawing.Size(91, 18); | |||
| this.serialPortLbl.TabIndex = 6; | |||
| this.serialPortLbl.Text = "Serieller Port:"; | |||
| // | |||
| // switchOffStateLbl | |||
| // | |||
| this.switchOffStateLbl.AutoSize = true; | |||
| this.switchOffStateLbl.Font = new System.Drawing.Font("Bahnschrift SemiBold SemiConden", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); | |||
| this.switchOffStateLbl.ForeColor = System.Drawing.Color.Red; | |||
| this.switchOffStateLbl.Location = new System.Drawing.Point(22, 143); | |||
| this.switchOffStateLbl.Name = "switchOffStateLbl"; | |||
| this.switchOffStateLbl.Size = new System.Drawing.Size(44, 25); | |||
| this.switchOffStateLbl.TabIndex = 9; | |||
| this.switchOffStateLbl.Text = "AUS"; | |||
| // | |||
| // switchOnStateLbl | |||
| // | |||
| this.switchOnStateLbl.AutoSize = true; | |||
| this.switchOnStateLbl.Font = new System.Drawing.Font("Bahnschrift SemiBold SemiConden", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); | |||
| this.switchOnStateLbl.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(151)))), ((int)(((byte)(156))))); | |||
| this.switchOnStateLbl.Location = new System.Drawing.Point(158, 143); | |||
| this.switchOnStateLbl.Name = "switchOnStateLbl"; | |||
| this.switchOnStateLbl.Size = new System.Drawing.Size(39, 25); | |||
| this.switchOnStateLbl.TabIndex = 10; | |||
| this.switchOnStateLbl.Text = "EIN"; | |||
| // | |||
| // switchStateTitelLbl | |||
| // | |||
| this.switchStateTitelLbl.AutoSize = true; | |||
| this.switchStateTitelLbl.Font = new System.Drawing.Font("Bahnschrift SemiBold SemiConden", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); | |||
| this.switchStateTitelLbl.ForeColor = System.Drawing.SystemColors.HotTrack; | |||
| this.switchStateTitelLbl.Location = new System.Drawing.Point(36, 96); | |||
| this.switchStateTitelLbl.Name = "switchStateTitelLbl"; | |||
| this.switchStateTitelLbl.Size = new System.Drawing.Size(147, 19); | |||
| this.switchStateTitelLbl.TabIndex = 11; | |||
| this.switchStateTitelLbl.Text = "Relais Power Schalter"; | |||
| // | |||
| // label1 | |||
| // | |||
| this.label1.AutoSize = true; | |||
| this.label1.Font = new System.Drawing.Font("Bahnschrift SemiBold SemiConden", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); | |||
| this.label1.ForeColor = System.Drawing.SystemColors.HotTrack; | |||
| this.label1.Location = new System.Drawing.Point(44, 219); | |||
| this.label1.Name = "label1"; | |||
| this.label1.Size = new System.Drawing.Size(135, 19); | |||
| this.label1.TabIndex = 13; | |||
| this.label1.Text = "Relais Power Status"; | |||
| // | |||
| // statusTimer | |||
| // | |||
| this.statusTimer.Interval = 5000; | |||
| this.statusTimer.Tick += new System.EventHandler(this.onStatusTimerTick); | |||
| // | |||
| // statusBar | |||
| // | |||
| this.statusBar.Font = new System.Drawing.Font("Bahnschrift SemiLight SemiConde", 11F); | |||
| this.statusBar.ImageScalingSize = new System.Drawing.Size(24, 24); | |||
| this.statusBar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { | |||
| this.hrzStrut, | |||
| this.initStatusLbl, | |||
| this.initProgressBar, | |||
| this.reconnectBtn, | |||
| this.connectedSerialPortLbl, | |||
| this.fwVersionLbl}); | |||
| this.statusBar.Location = new System.Drawing.Point(0, 327); | |||
| this.statusBar.Name = "statusBar"; | |||
| this.statusBar.Padding = new System.Windows.Forms.Padding(1, 0, 16, 0); | |||
| this.statusBar.Size = new System.Drawing.Size(584, 34); | |||
| this.statusBar.SizingGrip = false; | |||
| this.statusBar.TabIndex = 0; | |||
| this.statusBar.Text = "statusBar"; | |||
| // | |||
| // hrzStrut | |||
| // | |||
| this.hrzStrut.Name = "hrzStrut"; | |||
| this.hrzStrut.Size = new System.Drawing.Size(204, 29); | |||
| this.hrzStrut.Spring = true; | |||
| // | |||
| // initStatusLbl | |||
| // | |||
| this.initStatusLbl.Name = "initStatusLbl"; | |||
| this.initStatusLbl.Size = new System.Drawing.Size(101, 29); | |||
| this.initStatusLbl.Text = "Am Verbinden ..."; | |||
| // | |||
| // initProgressBar | |||
| // | |||
| this.initProgressBar.AutoSize = false; | |||
| this.initProgressBar.MarqueeAnimationSpeed = 20; | |||
| this.initProgressBar.Name = "initProgressBar"; | |||
| this.initProgressBar.Size = new System.Drawing.Size(100, 28); | |||
| this.initProgressBar.Step = 25; | |||
| this.initProgressBar.Style = System.Windows.Forms.ProgressBarStyle.Marquee; | |||
| // | |||
| // reconnectBtn | |||
| // | |||
| this.reconnectBtn.AutoSize = false; | |||
| this.reconnectBtn.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; | |||
| this.reconnectBtn.DropDownButtonWidth = 0; | |||
| this.reconnectBtn.Image = ((System.Drawing.Image)(resources.GetObject("reconnectBtn.Image"))); | |||
| this.reconnectBtn.ImageTransparentColor = System.Drawing.Color.Magenta; | |||
| this.reconnectBtn.Margin = new System.Windows.Forms.Padding(10, 2, 0, 0); | |||
| this.reconnectBtn.Name = "reconnectBtn"; | |||
| this.reconnectBtn.Size = new System.Drawing.Size(22, 32); | |||
| this.reconnectBtn.Visible = false; | |||
| this.reconnectBtn.ButtonClick += new System.EventHandler(this.onReconnectBtnClick); | |||
| // | |||
| // connectedSerialPortLbl | |||
| // | |||
| this.connectedSerialPortLbl.AutoSize = false; | |||
| this.connectedSerialPortLbl.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Left; | |||
| this.connectedSerialPortLbl.BorderStyle = System.Windows.Forms.Border3DStyle.Etched; | |||
| this.connectedSerialPortLbl.Margin = new System.Windows.Forms.Padding(10, 3, 0, 2); | |||
| this.connectedSerialPortLbl.Name = "connectedSerialPortLbl"; | |||
| this.connectedSerialPortLbl.Size = new System.Drawing.Size(70, 29); | |||
| this.connectedSerialPortLbl.Text = "Port: "; | |||
| this.connectedSerialPortLbl.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; | |||
| // | |||
| // fwVersionLbl | |||
| // | |||
| this.fwVersionLbl.AutoSize = false; | |||
| this.fwVersionLbl.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Left; | |||
| this.fwVersionLbl.BorderStyle = System.Windows.Forms.Border3DStyle.Etched; | |||
| this.fwVersionLbl.Margin = new System.Windows.Forms.Padding(10, 3, 0, 2); | |||
| this.fwVersionLbl.Name = "fwVersionLbl"; | |||
| this.fwVersionLbl.Size = new System.Drawing.Size(70, 29); | |||
| this.fwVersionLbl.Text = "Ver: "; | |||
| this.fwVersionLbl.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; | |||
| // | |||
| // pictureBox1 | |||
| // | |||
| this.pictureBox1.BackgroundImage = global::FSRemotePowerSwitch.Properties.Resources.Arduino_Logo; | |||
| this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; | |||
| this.pictureBox1.Location = new System.Drawing.Point(472, 12); | |||
| this.pictureBox1.Name = "pictureBox1"; | |||
| this.pictureBox1.Size = new System.Drawing.Size(100, 75); | |||
| this.pictureBox1.TabIndex = 14; | |||
| this.pictureBox1.TabStop = false; | |||
| // | |||
| // powerStateLed | |||
| // | |||
| this.powerStateLed.BackgroundImage = global::FSRemotePowerSwitch.Properties.Resources.blue_led_off; | |||
| this.powerStateLed.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; | |||
| this.powerStateLed.InitialImage = null; | |||
| this.powerStateLed.Location = new System.Drawing.Point(92, 258); | |||
| this.powerStateLed.Name = "powerStateLed"; | |||
| this.powerStateLed.Size = new System.Drawing.Size(40, 40); | |||
| this.powerStateLed.TabIndex = 12; | |||
| this.powerStateLed.TabStop = false; | |||
| // | |||
| // webCamRotator | |||
| // | |||
| this.webCamRotator.EndAngle = 420F; | |||
| this.webCamRotator.ForeColor = System.Drawing.Color.AliceBlue; | |||
| this.webCamRotator.ImeMode = System.Windows.Forms.ImeMode.On; | |||
| this.webCamRotator.KnobBackColor = System.Drawing.Color.Silver; | |||
| this.webCamRotator.KnobPointerStyle = KnobControl.KnobControl.KnobPointerStyles.circle; | |||
| this.webCamRotator.LargeChange = 5; | |||
| this.webCamRotator.Location = new System.Drawing.Point(247, 122); | |||
| this.webCamRotator.Maximum = 180; | |||
| this.webCamRotator.Minimum = -180; | |||
| this.webCamRotator.Name = "webCamRotator"; | |||
| this.webCamRotator.PointerColor = System.Drawing.SystemColors.HotTrack; | |||
| this.webCamRotator.ScaleColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(151)))), ((int)(((byte)(156))))); | |||
| this.webCamRotator.ScaleDivisions = 13; | |||
| this.webCamRotator.ScaleFont = new System.Drawing.Font("Bahnschrift SemiLight SemiConde", 9F); | |||
| this.webCamRotator.ScaleFontAutoSize = false; | |||
| this.webCamRotator.ScaleSubDivisions = 2; | |||
| this.webCamRotator.ShowLargeScale = true; | |||
| this.webCamRotator.ShowSmallScale = true; | |||
| this.webCamRotator.Size = new System.Drawing.Size(165, 165); | |||
| this.webCamRotator.SmallChange = 1; | |||
| this.webCamRotator.StartAngle = 120F; | |||
| this.webCamRotator.TabIndex = 17; | |||
| this.webCamRotator.Value = 0; | |||
| this.webCamRotator.ValueChanged += new KnobControl.ValueChangedEventHandler(this.onWebCamRotatorValueChanged); | |||
| this.webCamRotator.MiddleAreaClicked += new KnobControl.MiddleAreaMouseClickEventHandler(this.onWebCamRotatorMiddleAreaClicked); | |||
| // | |||
| // rotatorActValue | |||
| // | |||
| this.rotatorActValue.BackColor = System.Drawing.Color.Black; | |||
| this.rotatorActValue.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; | |||
| this.rotatorActValue.Font = new System.Drawing.Font("Bahnschrift", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); | |||
| this.rotatorActValue.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(151)))), ((int)(((byte)(156))))); | |||
| this.rotatorActValue.Location = new System.Drawing.Point(309, 264); | |||
| this.rotatorActValue.Name = "rotatorActValue"; | |||
| this.rotatorActValue.Size = new System.Drawing.Size(40, 20); | |||
| this.rotatorActValue.TabIndex = 18; | |||
| this.rotatorActValue.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; | |||
| // | |||
| // webCamRotatorLbl | |||
| // | |||
| this.webCamRotatorLbl.AutoSize = true; | |||
| this.webCamRotatorLbl.Font = new System.Drawing.Font("Bahnschrift SemiBold SemiConden", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); | |||
| this.webCamRotatorLbl.ForeColor = System.Drawing.SystemColors.HotTrack; | |||
| this.webCamRotatorLbl.Location = new System.Drawing.Point(261, 96); | |||
| this.webCamRotatorLbl.Name = "webCamRotatorLbl"; | |||
| this.webCamRotatorLbl.Size = new System.Drawing.Size(137, 19); | |||
| this.webCamRotatorLbl.TabIndex = 19; | |||
| this.webCamRotatorLbl.Text = "Drehwinkel WebCam"; | |||
| // | |||
| // webCamRotPowerLbl | |||
| // | |||
| this.webCamRotPowerLbl.AutoSize = true; | |||
| this.webCamRotPowerLbl.Font = new System.Drawing.Font("Bahnschrift SemiBold SemiConden", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); | |||
| this.webCamRotPowerLbl.ForeColor = System.Drawing.SystemColors.HotTrack; | |||
| this.webCamRotPowerLbl.Location = new System.Drawing.Point(412, 219); | |||
| this.webCamRotPowerLbl.Name = "webCamRotPowerLbl"; | |||
| this.webCamRotPowerLbl.Size = new System.Drawing.Size(157, 19); | |||
| this.webCamRotPowerLbl.TabIndex = 21; | |||
| this.webCamRotPowerLbl.Text = "WebCam Stepper Power"; | |||
| // | |||
| // webCamRotatorPowerStatusLed | |||
| // | |||
| this.webCamRotatorPowerStatusLed.BackgroundImage = global::FSRemotePowerSwitch.Properties.Resources.blue_led_off; | |||
| this.webCamRotatorPowerStatusLed.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; | |||
| this.webCamRotatorPowerStatusLed.InitialImage = null; | |||
| this.webCamRotatorPowerStatusLed.Location = new System.Drawing.Point(525, 258); | |||
| this.webCamRotatorPowerStatusLed.Name = "webCamRotatorPowerStatusLed"; | |||
| this.webCamRotatorPowerStatusLed.Size = new System.Drawing.Size(40, 40); | |||
| this.webCamRotatorPowerStatusLed.TabIndex = 20; | |||
| this.webCamRotatorPowerStatusLed.TabStop = false; | |||
| // | |||
| // webCamRotPwrStatusLbl | |||
| // | |||
| this.webCamRotPwrStatusLbl.AutoSize = true; | |||
| this.webCamRotPwrStatusLbl.Font = new System.Drawing.Font("Bahnschrift SemiBold SemiConden", 10F, System.Drawing.FontStyle.Bold); | |||
| this.webCamRotPwrStatusLbl.ForeColor = System.Drawing.SystemColors.HotTrack; | |||
| this.webCamRotPwrStatusLbl.Location = new System.Drawing.Point(524, 241); | |||
| this.webCamRotPwrStatusLbl.Name = "webCamRotPwrStatusLbl"; | |||
| this.webCamRotPwrStatusLbl.Size = new System.Drawing.Size(43, 17); | |||
| this.webCamRotPwrStatusLbl.TabIndex = 22; | |||
| this.webCamRotPwrStatusLbl.Text = "Status"; | |||
| // | |||
| // webCamRotatorPowerOffLbl | |||
| // | |||
| this.webCamRotatorPowerOffLbl.AutoSize = true; | |||
| this.webCamRotatorPowerOffLbl.Font = new System.Drawing.Font("Bahnschrift SemiBold SemiConden", 12F, System.Drawing.FontStyle.Bold); | |||
| this.webCamRotatorPowerOffLbl.ForeColor = System.Drawing.Color.Red; | |||
| this.webCamRotatorPowerOffLbl.Location = new System.Drawing.Point(413, 267); | |||
| this.webCamRotatorPowerOffLbl.Name = "webCamRotatorPowerOffLbl"; | |||
| this.webCamRotatorPowerOffLbl.Size = new System.Drawing.Size(34, 19); | |||
| this.webCamRotatorPowerOffLbl.TabIndex = 23; | |||
| this.webCamRotatorPowerOffLbl.Text = "AUS"; | |||
| // | |||
| // webCamRotatorPowerOnLbl | |||
| // | |||
| this.webCamRotatorPowerOnLbl.AutoSize = true; | |||
| this.webCamRotatorPowerOnLbl.Font = new System.Drawing.Font("Bahnschrift SemiBold SemiConden", 12F, System.Drawing.FontStyle.Bold); | |||
| this.webCamRotatorPowerOnLbl.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(151)))), ((int)(((byte)(156))))); | |||
| this.webCamRotatorPowerOnLbl.Location = new System.Drawing.Point(491, 268); | |||
| this.webCamRotatorPowerOnLbl.Name = "webCamRotatorPowerOnLbl"; | |||
| this.webCamRotatorPowerOnLbl.Size = new System.Drawing.Size(30, 19); | |||
| this.webCamRotatorPowerOnLbl.TabIndex = 24; | |||
| this.webCamRotatorPowerOnLbl.Text = "EIN"; | |||
| // | |||
| // label2 | |||
| // | |||
| this.label2.AutoSize = true; | |||
| this.label2.Font = new System.Drawing.Font("Bahnschrift SemiBold SemiConden", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); | |||
| this.label2.ForeColor = System.Drawing.SystemColors.HotTrack; | |||
| this.label2.Location = new System.Drawing.Point(427, 135); | |||
| this.label2.Name = "label2"; | |||
| this.label2.Size = new System.Drawing.Size(128, 19); | |||
| this.label2.TabIndex = 26; | |||
| this.label2.Text = "WebCam 0° Azimut"; | |||
| // | |||
| // button1 | |||
| // | |||
| this.button1.Location = new System.Drawing.Point(456, 165); | |||
| this.button1.Name = "button1"; | |||
| this.button1.Size = new System.Drawing.Size(75, 26); | |||
| this.button1.TabIndex = 27; | |||
| this.button1.Text = "0° setzen"; | |||
| this.button1.UseVisualStyleBackColor = true; | |||
| this.button1.Click += new System.EventHandler(this.onSetWebCamZero); | |||
| // | |||
| // webCamRotatorPowerSwitch | |||
| // | |||
| this.webCamRotatorPowerSwitch.Location = new System.Drawing.Point(447, 267); | |||
| this.webCamRotatorPowerSwitch.MinimumSize = new System.Drawing.Size(45, 22); | |||
| this.webCamRotatorPowerSwitch.Name = "webCamRotatorPowerSwitch"; | |||
| this.webCamRotatorPowerSwitch.OffBackColor = System.Drawing.Color.Gray; | |||
| this.webCamRotatorPowerSwitch.OffToggleColor = System.Drawing.Color.Gainsboro; | |||
| this.webCamRotatorPowerSwitch.OnBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(151)))), ((int)(((byte)(156))))); | |||
| this.webCamRotatorPowerSwitch.OnToggleColor = System.Drawing.Color.WhiteSmoke; | |||
| this.webCamRotatorPowerSwitch.Size = new System.Drawing.Size(45, 22); | |||
| this.webCamRotatorPowerSwitch.TabIndex = 25; | |||
| this.webCamRotatorPowerSwitch.UseVisualStyleBackColor = true; | |||
| this.webCamRotatorPowerSwitch.CheckStateChanged += new System.EventHandler(this.onWebCamPowerSwitchCheckStateChanged); | |||
| // | |||
| // powerSwitchButton | |||
| // | |||
| this.powerSwitchButton.Location = new System.Drawing.Point(72, 135); | |||
| this.powerSwitchButton.MinimumSize = new System.Drawing.Size(45, 22); | |||
| this.powerSwitchButton.Name = "powerSwitchButton"; | |||
| this.powerSwitchButton.OffBackColor = System.Drawing.Color.Gray; | |||
| this.powerSwitchButton.OffToggleColor = System.Drawing.Color.Gainsboro; | |||
| this.powerSwitchButton.OnBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(151)))), ((int)(((byte)(156))))); | |||
| this.powerSwitchButton.OnToggleColor = System.Drawing.Color.WhiteSmoke; | |||
| this.powerSwitchButton.Size = new System.Drawing.Size(80, 40); | |||
| this.powerSwitchButton.TabIndex = 16; | |||
| this.powerSwitchButton.UseVisualStyleBackColor = true; | |||
| this.powerSwitchButton.CheckStateChanged += new System.EventHandler(this.onSwitchCheckStateChanged); | |||
| // | |||
| // MainForm | |||
| // | |||
| this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 18F); | |||
| this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; | |||
| this.ClientSize = new System.Drawing.Size(584, 361); | |||
| this.Controls.Add(this.button1); | |||
| this.Controls.Add(this.label2); | |||
| this.Controls.Add(this.webCamRotatorPowerSwitch); | |||
| this.Controls.Add(this.webCamRotatorPowerOffLbl); | |||
| this.Controls.Add(this.webCamRotatorPowerOnLbl); | |||
| this.Controls.Add(this.webCamRotPwrStatusLbl); | |||
| this.Controls.Add(this.webCamRotPowerLbl); | |||
| this.Controls.Add(this.webCamRotatorPowerStatusLed); | |||
| this.Controls.Add(this.webCamRotatorLbl); | |||
| this.Controls.Add(this.rotatorActValue); | |||
| this.Controls.Add(this.webCamRotator); | |||
| this.Controls.Add(this.powerSwitchButton); | |||
| this.Controls.Add(this.serialPortLbl); | |||
| this.Controls.Add(this.serialPortsCboBox); | |||
| this.Controls.Add(this.openBtn); | |||
| this.Controls.Add(this.closeBtn); | |||
| this.Controls.Add(this.pictureBox1); | |||
| this.Controls.Add(this.switchStateTitelLbl); | |||
| this.Controls.Add(this.switchOffStateLbl); | |||
| this.Controls.Add(this.switchOnStateLbl); | |||
| this.Controls.Add(this.label1); | |||
| this.Controls.Add(this.powerStateLed); | |||
| this.Controls.Add(this.statusBar); | |||
| this.Font = new System.Drawing.Font("Bahnschrift SemiLight SemiConde", 11F); | |||
| this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); | |||
| this.Margin = new System.Windows.Forms.Padding(2, 4, 2, 4); | |||
| this.MaximizeBox = false; | |||
| this.MaximumSize = new System.Drawing.Size(600, 400); | |||
| this.MinimumSize = new System.Drawing.Size(600, 400); | |||
| this.Name = "MainForm"; | |||
| this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; | |||
| this.Text = "FSRemotePowerSwitch"; | |||
| this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.onMainFormClosing); | |||
| this.Shown += new System.EventHandler(this.onFormShown); | |||
| this.statusBar.ResumeLayout(false); | |||
| this.statusBar.PerformLayout(); | |||
| ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); | |||
| ((System.ComponentModel.ISupportInitialize)(this.powerStateLed)).EndInit(); | |||
| ((System.ComponentModel.ISupportInitialize)(this.webCamRotatorPowerStatusLed)).EndInit(); | |||
| this.ResumeLayout(false); | |||
| this.PerformLayout(); | |||
| } | |||
| #endregion | |||
| private System.IO.Ports.SerialPort serialPort; | |||
| private System.Windows.Forms.Button openBtn; | |||
| private System.Windows.Forms.Button closeBtn; | |||
| private System.Windows.Forms.ComboBox serialPortsCboBox; | |||
| private System.Windows.Forms.Label serialPortLbl; | |||
| private System.Windows.Forms.Label switchOffStateLbl; | |||
| private System.Windows.Forms.Label switchOnStateLbl; | |||
| private System.Windows.Forms.Label switchStateTitelLbl; | |||
| private System.Windows.Forms.PictureBox powerStateLed; | |||
| private System.Windows.Forms.Label label1; | |||
| private System.Windows.Forms.PictureBox pictureBox1; | |||
| private System.Windows.Forms.Timer statusTimer; | |||
| private System.Windows.Forms.StatusStrip statusBar; | |||
| private System.Windows.Forms.ToolStripProgressBar initProgressBar; | |||
| private System.Windows.Forms.ToolStripStatusLabel fwVersionLbl; | |||
| private System.Windows.Forms.ToolStripStatusLabel connectedSerialPortLbl; | |||
| private System.Windows.Forms.ToolStripStatusLabel hrzStrut; | |||
| private System.Windows.Forms.ToolStripStatusLabel initStatusLbl; | |||
| private System.Windows.Forms.ToolStripSplitButton reconnectBtn; | |||
| private FSRemotePowerSwitch.SButton powerSwitchButton; | |||
| private KnobControl.KnobControl webCamRotator; | |||
| private System.Windows.Forms.Label rotatorActValue; | |||
| private System.Windows.Forms.Label webCamRotatorLbl; | |||
| private System.Windows.Forms.Label webCamRotPowerLbl; | |||
| private System.Windows.Forms.PictureBox webCamRotatorPowerStatusLed; | |||
| private System.Windows.Forms.Label webCamRotPwrStatusLbl; | |||
| private SButton webCamRotatorPowerSwitch; | |||
| private System.Windows.Forms.Label webCamRotatorPowerOffLbl; | |||
| private System.Windows.Forms.Label webCamRotatorPowerOnLbl; | |||
| private System.Windows.Forms.Label label2; | |||
| private System.Windows.Forms.Button button1; | |||
| } | |||
| } | |||
| @@ -0,0 +1,320 @@ | |||
| using Newtonsoft.Json; | |||
| using System; | |||
| using System.Diagnostics; | |||
| using System.IO.Ports; | |||
| using System.Runtime.CompilerServices; | |||
| using System.Threading; | |||
| using System.Windows.Forms; | |||
| namespace FSRemotePowerSwitch { | |||
| public partial class MainForm : Form { | |||
| private static string SETTINGS_FILE = "Settings.txt"; | |||
| private static string SERIALPORT_KEY = "LastSerialPort"; | |||
| private static string EXP_FIRMWARE_VER = "ExpectedFirmwareVersion"; | |||
| private static bool connected; | |||
| private static Boolean Connected { | |||
| [MethodImpl(MethodImplOptions.Synchronized)] | |||
| get { return connected; } | |||
| [MethodImpl(MethodImplOptions.Synchronized)] | |||
| set { connected = value; } | |||
| } | |||
| private static bool requestPending; | |||
| private static Boolean RequestPending { | |||
| [MethodImpl(MethodImplOptions.Synchronized)] | |||
| get { return requestPending; } | |||
| [MethodImpl(MethodImplOptions.Synchronized)] | |||
| set { requestPending = value; } | |||
| } | |||
| private Boolean initializing; | |||
| private string firmwareVersion; | |||
| public MainForm() { | |||
| initializing = false; | |||
| Connected = false; | |||
| RequestPending = false; | |||
| firmwareVersion = new PropertiesHandler(SETTINGS_FILE).get(EXP_FIRMWARE_VER, "V0.0.1"); | |||
| InitializeComponent(); | |||
| initializeSerialPortComboBox(); | |||
| } | |||
| private void onFormShown(object sender, EventArgs e) { | |||
| connect(); | |||
| } | |||
| private void connect() { | |||
| if (serialPort.IsOpen) { | |||
| serialPort.Close(); | |||
| } | |||
| if (serialPortsCboBox.SelectedItem != null) { | |||
| Application.UseWaitCursor = true; | |||
| serialPort.PortName = serialPortsCboBox.SelectedItem.ToString(); | |||
| serialPort.Open(); | |||
| sendVersionCmd(); | |||
| Thread waitThread = new Thread(Wait); | |||
| waitThread.Start(); | |||
| } else { | |||
| initStatusLbl.Text = "Kein Port verfügbar!"; | |||
| connectedSerialPortLbl.Text = "Port: "; | |||
| initProgressBar.Style = ProgressBarStyle.Continuous; | |||
| initProgressBar.Value = 0; | |||
| } | |||
| } | |||
| private void Wait() { | |||
| Stopwatch stopwatch = new Stopwatch(); | |||
| stopwatch.Start(); | |||
| while (stopwatch.ElapsedMilliseconds < 3000) { | |||
| Thread.Sleep(50); | |||
| if (Connected) { | |||
| break; | |||
| } | |||
| } | |||
| if (!Connected) { | |||
| BeginInvoke(new EventHandler(delegate { | |||
| initStatusLbl.Text = "Zeitüberschreitung!"; | |||
| connectedSerialPortLbl.Text = "Port: "; | |||
| initProgressBar.Style = ProgressBarStyle.Continuous; | |||
| initProgressBar.Value = 0; | |||
| reconnectBtn.Visible = true; | |||
| })); | |||
| } | |||
| Application.UseWaitCursor = false; | |||
| Cursor.Position = Cursor.Position; | |||
| } | |||
| private void initializeSerialPortComboBox() { | |||
| initializing = true; | |||
| string[] ports = SerialPort.GetPortNames(); | |||
| foreach (string port in ports) { | |||
| serialPortsCboBox.Items.Add(port); | |||
| } | |||
| PropertiesHandler serialPortCfg = new PropertiesHandler(SETTINGS_FILE); | |||
| string lastselectedComPort = serialPortCfg.get(SERIALPORT_KEY, ""); | |||
| serialPortsCboBox.SelectedItem = lastselectedComPort; | |||
| initializing = false; | |||
| } | |||
| private void onSerialPortsCboBoxSelectedIndexChanged(object sender, EventArgs e) { | |||
| PropertiesHandler serialPortCfg = new PropertiesHandler(SETTINGS_FILE); | |||
| serialPortCfg.set(SERIALPORT_KEY, serialPortsCboBox.SelectedItem); | |||
| serialPortCfg.Save(); | |||
| if (!initializing) { | |||
| reconnectBtn.Visible = false; | |||
| connect(); | |||
| } | |||
| } | |||
| private void onSerialPortDataReceived(object sender, SerialDataReceivedEventArgs e) { | |||
| string s = readSerialPortData((SerialPort)sender); | |||
| try { | |||
| Message msg = JsonConvert.DeserializeObject<Message>(s); | |||
| if (msg.Sender.Equals(Message.CMD_SENDER_AN) && msg.Cmd.Equals(Message.CMD_VER) && msg.Val.Equals(firmwareVersion)) { | |||
| RequestPending = false; | |||
| BeginInvoke(new EventHandler(delegate { | |||
| sendRelayStatusCmd(); | |||
| Connected = true; | |||
| initStatusLbl.Text = "Verbunden"; | |||
| connectedSerialPortLbl.Text = "Port: " + ((SerialPort)sender).PortName; | |||
| fwVersionLbl.Text = "Ver: " + firmwareVersion; | |||
| initProgressBar.Style = ProgressBarStyle.Continuous; | |||
| initProgressBar.Value = 100; | |||
| openBtn.Enabled = false; | |||
| closeBtn.Enabled = true; | |||
| powerSwitchButton.Enabled = true; | |||
| statusTimer.Enabled = true; | |||
| })); | |||
| } else if (msg.Sender.Equals(Message.CMD_SENDER_AN) && msg.Cmd.Equals(Message.CMD_STATUS_RELAY)) { | |||
| RequestPending = false; | |||
| BeginInvoke(new EventHandler(delegate { | |||
| if (msg.Val.Equals(Message.CMD_VAL_ON)) { | |||
| powerStateLed.BackgroundImage = FSRemotePowerSwitch.Properties.Resources.blue_led_on; | |||
| powerSwitchButton.CheckStateChanged -= onSwitchCheckStateChanged; | |||
| powerSwitchButton.Checked = true; | |||
| powerSwitchButton.CheckStateChanged += onSwitchCheckStateChanged; | |||
| } else if (msg.Val.Equals(Message.CMD_VAL_OFF)) { | |||
| powerStateLed.BackgroundImage = FSRemotePowerSwitch.Properties.Resources.blue_led_off; | |||
| powerSwitchButton.CheckStateChanged -= onSwitchCheckStateChanged; | |||
| powerSwitchButton.Checked = false; | |||
| powerSwitchButton.CheckStateChanged += onSwitchCheckStateChanged; | |||
| } | |||
| })); | |||
| } | |||
| } catch (Exception ex) when (ex is Newtonsoft.Json.JsonReaderException || | |||
| ex is Newtonsoft.Json.JsonSerializationException) { | |||
| RequestPending = false; | |||
| initStatusLbl.Text = "Json Deserialize Exception!"; | |||
| serialPort.DiscardInBuffer(); | |||
| serialPort.DiscardOutBuffer(); | |||
| serialPort.Dispose(); | |||
| } | |||
| } | |||
| private void onOpenBtnClick(object sender, EventArgs e) { | |||
| if (serialPort.PortName != "COM1" && !serialPort.IsOpen) { | |||
| serialPort.Open(); | |||
| openBtn.Enabled = false; | |||
| closeBtn.Enabled = true; | |||
| powerSwitchButton.Enabled = true; | |||
| } | |||
| } | |||
| private void onCloseBtnClick(object sender, EventArgs e) { | |||
| if (serialPort.IsOpen) { | |||
| serialPort.Close(); | |||
| openBtn.Enabled = true; | |||
| closeBtn.Enabled = false; | |||
| powerSwitchButton.Enabled = false; | |||
| } | |||
| } | |||
| private void onReconnectBtnClick(object sender, EventArgs e) { | |||
| reconnectBtn.Visible = false; | |||
| connect(); | |||
| } | |||
| private void onSwitchCheckStateChanged(object sender, EventArgs e) { | |||
| if (powerSwitchButton.Checked) { | |||
| sendRelayPowerCmd(Message.CMD_VAL_ON); | |||
| } else { | |||
| sendRelayPowerCmd(Message.CMD_VAL_OFF); | |||
| } | |||
| } | |||
| private void onWebCamPowerSwitchCheckStateChanged(object sender, EventArgs e) { | |||
| if (webCamRotatorPowerSwitch.Checked) { | |||
| sendWebCamPowerCmd(Message.CMD_VAL_ON); | |||
| } else { | |||
| sendWebCamPowerCmd(Message.CMD_VAL_OFF); | |||
| } | |||
| } | |||
| private String readSerialPortData(SerialPort serialPort) { | |||
| string data = ""; | |||
| while (serialPort.BytesToRead > 0) { | |||
| data += serialPort.ReadExisting(); | |||
| Thread.Sleep(50); | |||
| } | |||
| return data; | |||
| } | |||
| private void sendVersionCmd() { | |||
| Message msg = new Message(); | |||
| msg.Sender = Message.CMD_SENDER_PC; | |||
| msg.Cmd = Message.CMD_VER; | |||
| msg.Val = null; | |||
| string msJson = JsonConvert.SerializeObject(msg); | |||
| if (serialPort.IsOpen && !RequestPending) { | |||
| serialPort.Write(msJson); | |||
| RequestPending = true; | |||
| } | |||
| } | |||
| private void sendRelayPowerCmd(string value) { | |||
| Message msg = new Message(); | |||
| msg.Sender = Message.CMD_SENDER_PC; | |||
| msg.Cmd = Message.CMD_POWER_RELAY; | |||
| msg.Val = value; | |||
| string msJson = JsonConvert.SerializeObject(msg); | |||
| if (serialPort.IsOpen && !RequestPending) { | |||
| serialPort.Write(msJson); | |||
| RequestPending = true; | |||
| } | |||
| } | |||
| private void sendRelayStatusCmd() { | |||
| Message msg = new Message(); | |||
| msg.Sender = Message.CMD_SENDER_PC; | |||
| msg.Cmd = Message.CMD_STATUS_RELAY; | |||
| msg.Val = null; | |||
| string msJson = JsonConvert.SerializeObject(msg); | |||
| if (serialPort.IsOpen && !RequestPending) { | |||
| serialPort.Write(msJson); | |||
| RequestPending = true; | |||
| } | |||
| } | |||
| private void sendWebCamZeroCmd() | |||
| { | |||
| Message msg = new Message(); | |||
| msg.Sender = Message.CMD_SENDER_PC; | |||
| msg.Cmd = Message.CMD_ZERO_CAM; | |||
| msg.Val = "0"; | |||
| string msJson = JsonConvert.SerializeObject(msg); | |||
| if (serialPort.IsOpen && !RequestPending) | |||
| { | |||
| serialPort.Write(msJson); | |||
| RequestPending = true; | |||
| } | |||
| } | |||
| private void sendWebCamAzimutCmd() | |||
| { | |||
| Message msg = new Message(); | |||
| msg.Sender = Message.CMD_SENDER_PC; | |||
| msg.Cmd = Message.CMD_AZIMUT_CAM; | |||
| msg.Val = webCamRotator.Value.ToString(); | |||
| string msJson = JsonConvert.SerializeObject(msg); | |||
| if (serialPort.IsOpen && !RequestPending) | |||
| { | |||
| serialPort.Write(msJson); | |||
| RequestPending = true; | |||
| } | |||
| } | |||
| private void sendWebCamPowerCmd(string value) | |||
| { | |||
| Message msg = new Message(); | |||
| msg.Sender = Message.CMD_SENDER_PC; | |||
| msg.Cmd = Message.CMD_POWER_CAM; | |||
| msg.Val = value; | |||
| string msJson = JsonConvert.SerializeObject(msg); | |||
| if (serialPort.IsOpen && !RequestPending) | |||
| { | |||
| serialPort.Write(msJson); | |||
| RequestPending = true; | |||
| } | |||
| } | |||
| private void onStatusTimerTick(object sender, EventArgs e) { | |||
| sendRelayStatusCmd(); | |||
| } | |||
| private void onMainFormClosing(object sender, FormClosingEventArgs e) { | |||
| Stopwatch stopwatch = new Stopwatch(); | |||
| stopwatch.Start(); | |||
| while (RequestPending && stopwatch.ElapsedMilliseconds < 2000) { | |||
| Thread.Sleep(50); | |||
| } | |||
| if (serialPort.IsOpen) { | |||
| serialPort.DiscardInBuffer(); | |||
| serialPort.DiscardOutBuffer(); | |||
| serialPort.Close(); | |||
| serialPort.Dispose(); | |||
| } | |||
| } | |||
| private void onWebCamRotatorValueChanged(object Sender) | |||
| { | |||
| rotatorActValue.Text = webCamRotator.Value.ToString(); | |||
| } | |||
| private void onSetWebCamZero(object sender, EventArgs e) | |||
| { | |||
| sendWebCamZeroCmd(); | |||
| } | |||
| private void onWebCamRotatorMiddleAreaClicked(object Sender) | |||
| { | |||
| sendWebCamAzimutCmd(); | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,219 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <root> | |||
| <!-- | |||
| Microsoft ResX Schema | |||
| Version 2.0 | |||
| The primary goals of this format is to allow a simple XML format | |||
| that is mostly human readable. The generation and parsing of the | |||
| various data types are done through the TypeConverter classes | |||
| associated with the data types. | |||
| Example: | |||
| ... ado.net/XML headers & schema ... | |||
| <resheader name="resmimetype">text/microsoft-resx</resheader> | |||
| <resheader name="version">2.0</resheader> | |||
| <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | |||
| <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | |||
| <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | |||
| <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | |||
| <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | |||
| <value>[base64 mime encoded serialized .NET Framework object]</value> | |||
| </data> | |||
| <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | |||
| <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | |||
| <comment>This is a comment</comment> | |||
| </data> | |||
| There are any number of "resheader" rows that contain simple | |||
| name/value pairs. | |||
| Each data row contains a name, and value. The row also contains a | |||
| type or mimetype. Type corresponds to a .NET class that support | |||
| text/value conversion through the TypeConverter architecture. | |||
| Classes that don't support this are serialized and stored with the | |||
| mimetype set. | |||
| The mimetype is used for serialized objects, and tells the | |||
| ResXResourceReader how to depersist the object. This is currently not | |||
| extensible. For a given mimetype the value must be set accordingly: | |||
| Note - application/x-microsoft.net.object.binary.base64 is the format | |||
| that the ResXResourceWriter will generate, however the reader can | |||
| read any of the formats listed below. | |||
| mimetype: application/x-microsoft.net.object.binary.base64 | |||
| value : The object must be serialized with | |||
| : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | |||
| : and then encoded with base64 encoding. | |||
| mimetype: application/x-microsoft.net.object.soap.base64 | |||
| value : The object must be serialized with | |||
| : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | |||
| : and then encoded with base64 encoding. | |||
| mimetype: application/x-microsoft.net.object.bytearray.base64 | |||
| value : The object must be serialized into a byte array | |||
| : using a System.ComponentModel.TypeConverter | |||
| : and then encoded with base64 encoding. | |||
| --> | |||
| <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | |||
| <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | |||
| <xsd:element name="root" msdata:IsDataSet="true"> | |||
| <xsd:complexType> | |||
| <xsd:choice maxOccurs="unbounded"> | |||
| <xsd:element name="metadata"> | |||
| <xsd:complexType> | |||
| <xsd:sequence> | |||
| <xsd:element name="value" type="xsd:string" minOccurs="0" /> | |||
| </xsd:sequence> | |||
| <xsd:attribute name="name" use="required" type="xsd:string" /> | |||
| <xsd:attribute name="type" type="xsd:string" /> | |||
| <xsd:attribute name="mimetype" type="xsd:string" /> | |||
| <xsd:attribute ref="xml:space" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| <xsd:element name="assembly"> | |||
| <xsd:complexType> | |||
| <xsd:attribute name="alias" type="xsd:string" /> | |||
| <xsd:attribute name="name" type="xsd:string" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| <xsd:element name="data"> | |||
| <xsd:complexType> | |||
| <xsd:sequence> | |||
| <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||
| <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | |||
| </xsd:sequence> | |||
| <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | |||
| <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | |||
| <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | |||
| <xsd:attribute ref="xml:space" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| <xsd:element name="resheader"> | |||
| <xsd:complexType> | |||
| <xsd:sequence> | |||
| <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||
| </xsd:sequence> | |||
| <xsd:attribute name="name" type="xsd:string" use="required" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| </xsd:choice> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| </xsd:schema> | |||
| <resheader name="resmimetype"> | |||
| <value>text/microsoft-resx</value> | |||
| </resheader> | |||
| <resheader name="version"> | |||
| <value>2.0</value> | |||
| </resheader> | |||
| <resheader name="reader"> | |||
| <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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
| </resheader> | |||
| <metadata name="serialPort.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> | |||
| <value>17, 17</value> | |||
| </metadata> | |||
| <metadata name="statusTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> | |||
| <value>235, 17</value> | |||
| </metadata> | |||
| <metadata name="statusBar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> | |||
| <value>130, 15</value> | |||
| </metadata> | |||
| <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> | |||
| <data name="reconnectBtn.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | |||
| <value> | |||
| iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 | |||
| YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADoSURBVEhL7ZTRDcIwDAUzAiMwAiOwISMwAiMwAiMwAiOA | |||
| T+qTrBesJPDbk+4jr8ZNW+K28w+H8BI+wmd4DY+hcwvfm3eCGWj+CvVDSeY38Zop2C3F7P4UnkN2R8Y1 | |||
| kRtnh/BKKKSxYOdkPIXITbNDqkLPtXaHVIWea+0OqQo95xspk/yrhqjYWc1LVhtVeclqoyovWW1U5R35 | |||
| 2Mt8/JU5Vd6hQlf4WlR5hwpd4WtR5R0qdIVGSB54zCqyPEJKctOs0BDku3ATZpWyqQMGuTFmGON+Hdk9 | |||
| TzJFPv7fdsVNtGsa62l2fqG1D2Ivnq0sTuHgAAAAAElFTkSuQmCC | |||
| </value> | |||
| </data> | |||
| <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||
| <value>77</value> | |||
| </metadata> | |||
| <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | |||
| <value> | |||
| AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAmpYAPZyW | |||
| ALqclwDznJcA85uXALmdmQA8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ2X | |||
| AF6blgD8nJcA/5yXAP+clwD/nJcA/5uWAPydlwBeAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AACamgAhnJcA+JyXAP+clwD/nJcA/5yXAP+clwD/nJcA/5yXAPiflwAgAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAJuXAICclwD/nJcA/5yXAP+clwD/nJcA/5yXAP+clwD/nJcA/5uXAH4AAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAnJcApZyXAP+clwD/nJcA/5yXAP+clwD/nJcA/5yXAP+clwD/nJcApQAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACclwCqnJcA/5yXAP+clwD/nJcA/5yXAP+clwD/nJcA/5yX | |||
| AP+clwCqAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJyXAKqclwD/nJcA/5yXAP+clwD/nJcA/5yX | |||
| AP+clwD/nJcA/5yXAKoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAnJcAqpyXAP+clwD/nJcA/5yX | |||
| AP+clwD/nJcA/5yXAP+clwD/nJcAqgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACclwCqnJcA/5yX | |||
| AP+clwD/nJcA/5yXAP+clwD/nJcA/5yXAP+clwCqAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJyX | |||
| AKqclwD/nJcA/5yXAP+clwD/nJcA/5yXAP+clwD/nJcA/5yXAKoAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAnJcAqpyXAP+clwD/nJcA/5yXAP+clwD/nJcA/5yXAP+clwD/nJcAqgAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAACclwCqnJcA/5yXAP+clwD/nJcA/5yXAP+clwD/nJcA/5yXAP+clwCqAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAJyXAKqclwD/nJcA/5yXAPublgDDm5YAw5yXAPuclwD/nJcA/5yX | |||
| AKoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAnJcAqpyXAP+blgDym5cANgAAAAAAAAAAm5cANpyX | |||
| APOclwD/nJcAqgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACclwCqnJcA/5uXAIMAAAAAAAAAAAAA | |||
| AAAAAAAAnJYAhJyXAP+clwCqAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJyWAKaclwD/nJYAYgAA | |||
| AAAAAAAAAAAAAAAAAACdlwBjnJcA/5yWAKYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAm5cAhZyX | |||
| AP+blwCnAAAAAAAAAAAAAAAAAAAAAJyWAKiclwD/m5cAgwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AACZmQAonJcA+5yXAP+clgCGn5QAGJ+UABiclwCHnJcA/5yXAPuclgAnAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAACcmABtm5YA/pyXAP+clwD/nJcA/5yXAP+blgD+m5cAbAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACbmABNnJcAzJyXAP+clwD/m5YAy5qWAEwAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAqqoABqqqAAYAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACcmAA5m5cArJubABIAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAACbmwASnJYArZyYADkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAmpYAOJuXAPGclwD/m5cA7JyW | |||
| AH+alAAwoqIAC6KiAAuclgAxnJYAf5yWAO2clwD/m5cA8ZqWADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACglwAbm5YAy5yX | |||
| AP+clwD/nJcA/5yXAP+clwD/nJcA/5yXAP+clwD/nJcA/5yXAP+blgDQnJQAHwAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACiogALAAAAAAAA | |||
| AACpjQAJm5YAeJuXAO+clwD/nJcA/5yXAP+clwD/nJcA/5yXAP+blwDvnJUAd5+fAAgAAAAAAAAAAKKi | |||
| AAsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAmpYAOJyW | |||
| AOuclwBgAAAAAAAAAAAAAAAAn58ACJqWAEyblwCFm5YAn5uWAJ+blwCFmpYATJ+fAAgAAAAAAAAAAAAA | |||
| AACblQBhnJYA65qWADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJyT | |||
| ABqclgDwnJcA/5yXAP+blgCan5QAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AACflAAYnJcAm5yXAP+clwD/nJYA8JyTABoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAJyWAGKclgD6nJcA/5yXAP+clwDznJYAjpuXADt/fwACAAAAAAAAAAAAAAAAAAAAAKqq | |||
| AAOdmQA8nJYAjpyXAPOclwD/nJcA/5yWAPqclgBiAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAJqWAEKclgDcnJcA/5yXAP+clwD/nJcA/5yWAO2blgDQnJYAtZyW | |||
| ALWblgDQnJYA7ZyXAP+clwD/nJcA/5yXAP+clgDcnJUAQQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKqqAAaclwBvm5cA6pyXAP+clwD/nJcA/5yX | |||
| AP+clwD/nJcA/5yXAP+clwD/nJcA/5yXAP+blwDqnJcAb6qqAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACqqgAGmpcAT5uW | |||
| AJWblgDDm5YA2puWAPSblgD0m5YA2puWAMOclwCUmpcAT6qqAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |||
| AAAAAAAAAAAAAAAAAAAAAAAA//gf///wD///4Af//+AH///gB///4Af//+AH///gB///4Af//+AH///g | |||
| B///4Af//+AH///hh///48f//+PH///jx///4Af///AP///4H////n/////////H4///gAH//4AB//7A | |||
| A3/8cA4/+B/4H/wDwD/+AAB//wAA///AA/8= | |||
| </value> | |||
| </data> | |||
| </root> | |||
| @@ -0,0 +1,35 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using System.Threading.Tasks; | |||
| namespace FSRemotePowerSwitch { | |||
| // JSON für FSRemotePowerSwitch | |||
| // { | |||
| // "sender": "FSRemotePowerSwitch_PC" or "FSRemotePowerSwitch_AN", | |||
| // "cmd": "Version" or "Status_Relay" or "Power_Relay" or "Status_Cam" or "Power_Cam" or "Azimut_Cam" or "Zero_Cam", | |||
| // "val": "V0.0.1" or "On"/"Off" or "0" | |||
| // } | |||
| class Message { | |||
| public static string CMD_SENDER_PC = "FSRemotePowerSwitch_PC"; | |||
| public static string CMD_SENDER_AN = "FSRemotePowerSwitch_AN"; | |||
| public static string CMD_VER = "Version"; | |||
| public static string CMD_STATUS_RELAY = "Status_Relay"; | |||
| public static string CMD_POWER_RELAY = "Power_Relay"; | |||
| public static string CMD_STATUS_CAM = "Status_Cam"; | |||
| public static string CMD_POWER_CAM = "Power_Cam"; | |||
| public static string CMD_AZIMUT_CAM = "Azimut_Cam"; | |||
| public static string CMD_ZERO_CAM = "Zero_Cam"; | |||
| public static string CMD_VAL_ON = "On"; | |||
| public static string CMD_VAL_OFF = "Off"; | |||
| public string Sender { get; set; } | |||
| public string Cmd { get; set; } | |||
| public string Val { get; set; } | |||
| } | |||
| } | |||
| @@ -0,0 +1,19 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Threading.Tasks; | |||
| using System.Windows.Forms; | |||
| namespace FSRemotePowerSwitch { | |||
| static class Program { | |||
| /// <summary> | |||
| /// Der Haupteinstiegspunkt für die Anwendung. | |||
| /// </summary> | |||
| [STAThread] | |||
| static void Main() { | |||
| Application.EnableVisualStyles(); | |||
| Application.SetCompatibleTextRenderingDefault(false); | |||
| Application.Run(new MainForm()); | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,87 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using System.Threading.Tasks; | |||
| namespace FSRemotePowerSwitch { | |||
| public class PropertiesHandler { | |||
| private Dictionary<String, String> list; | |||
| private String filename; | |||
| public PropertiesHandler(String file) { | |||
| reload(file); | |||
| } | |||
| public String get(String field, String defValue) { | |||
| return (get(field) == null) ? (defValue) : (get(field)); | |||
| } | |||
| public String get(String field) { | |||
| return (list.ContainsKey(field)) ? (list[field]) : (null); | |||
| } | |||
| public void set(String field, Object value) { | |||
| if (!list.ContainsKey(field)) | |||
| list.Add(field, value.ToString()); | |||
| else | |||
| list[field] = value.ToString(); | |||
| } | |||
| public void Save() { | |||
| Save(this.filename); | |||
| } | |||
| public void Save(String filename) { | |||
| this.filename = filename; | |||
| if (!System.IO.File.Exists(filename)) | |||
| System.IO.File.Create(filename); | |||
| System.IO.StreamWriter file = new System.IO.StreamWriter(filename); | |||
| foreach (String prop in list.Keys.ToArray()) | |||
| if (!String.IsNullOrWhiteSpace(list[prop])) | |||
| file.WriteLine(prop + "=" + list[prop]); | |||
| file.Close(); | |||
| } | |||
| public void reload() { | |||
| reload(this.filename); | |||
| } | |||
| public void reload(String filename) { | |||
| this.filename = filename; | |||
| list = new Dictionary<String, String>(); | |||
| if (System.IO.File.Exists(filename)) | |||
| loadFromFile(filename); | |||
| else | |||
| System.IO.File.Create(filename); | |||
| } | |||
| private void loadFromFile(String file) { | |||
| foreach (String line in System.IO.File.ReadAllLines(file)) { | |||
| if ((!String.IsNullOrEmpty(line)) && | |||
| (!line.StartsWith(";")) && | |||
| (!line.StartsWith("#")) && | |||
| (!line.StartsWith("'")) && | |||
| (line.Contains('='))) { | |||
| int index = line.IndexOf('='); | |||
| String key = line.Substring(0, index).Trim(); | |||
| String value = line.Substring(index + 1).Trim(); | |||
| if ((value.StartsWith("\"") && value.EndsWith("\"")) || | |||
| (value.StartsWith("'") && value.EndsWith("'"))) { | |||
| value = value.Substring(1, value.Length - 2); | |||
| } | |||
| try { | |||
| //ignore dublicates | |||
| list.Add(key, value); | |||
| } catch { } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,36 @@ | |||
| using System.Reflection; | |||
| using System.Runtime.CompilerServices; | |||
| using System.Runtime.InteropServices; | |||
| // Allgemeine Informationen über eine Assembly werden über die folgenden | |||
| // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, | |||
| // die einer Assembly zugeordnet sind. | |||
| [assembly: AssemblyTitle("FSRemotePowerSwitch")] | |||
| [assembly: AssemblyDescription("")] | |||
| [assembly: AssemblyConfiguration("")] | |||
| [assembly: AssemblyCompany("")] | |||
| [assembly: AssemblyProduct("FSRemotePowerSwitch")] | |||
| [assembly: AssemblyCopyright("Copyright © 2024")] | |||
| [assembly: AssemblyTrademark("")] | |||
| [assembly: AssemblyCulture("")] | |||
| // Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly | |||
| // für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von | |||
| // COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. | |||
| [assembly: ComVisible(false)] | |||
| // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird | |||
| [assembly: Guid("6e722770-d2db-40aa-bcf4-0443519ccc0c")] | |||
| // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: | |||
| // | |||
| // Hauptversion | |||
| // Nebenversion | |||
| // Buildnummer | |||
| // Revision | |||
| // | |||
| // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, | |||
| // indem Sie "*" wie unten gezeigt eingeben: | |||
| // [assembly: AssemblyVersion("1.0.*")] | |||
| [assembly: AssemblyVersion("1.0.0.0")] | |||
| [assembly: AssemblyFileVersion("1.0.0.0")] | |||
| @@ -0,0 +1,113 @@ | |||
| //------------------------------------------------------------------------------ | |||
| // <auto-generated> | |||
| // Dieser Code wurde von einem Tool generiert. | |||
| // Laufzeitversion:4.0.30319.42000 | |||
| // | |||
| // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn | |||
| // der Code erneut generiert wird. | |||
| // </auto-generated> | |||
| //------------------------------------------------------------------------------ | |||
| namespace FSRemotePowerSwitch.Properties { | |||
| using System; | |||
| /// <summary> | |||
| /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. | |||
| /// </summary> | |||
| // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert | |||
| // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. | |||
| // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen | |||
| // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. | |||
| [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] | |||
| [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] | |||
| [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] | |||
| internal class Resources { | |||
| private static global::System.Resources.ResourceManager resourceMan; | |||
| private static global::System.Globalization.CultureInfo resourceCulture; | |||
| [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] | |||
| internal Resources() { | |||
| } | |||
| /// <summary> | |||
| /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. | |||
| /// </summary> | |||
| [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | |||
| internal static global::System.Resources.ResourceManager ResourceManager { | |||
| get { | |||
| if (object.ReferenceEquals(resourceMan, null)) { | |||
| global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("FSRemotePowerSwitch.Properties.Resources", typeof(Resources).Assembly); | |||
| resourceMan = temp; | |||
| } | |||
| return resourceMan; | |||
| } | |||
| } | |||
| /// <summary> | |||
| /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle | |||
| /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. | |||
| /// </summary> | |||
| [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] | |||
| internal static global::System.Globalization.CultureInfo Culture { | |||
| get { | |||
| return resourceCulture; | |||
| } | |||
| set { | |||
| resourceCulture = value; | |||
| } | |||
| } | |||
| /// <summary> | |||
| /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. | |||
| /// </summary> | |||
| internal static System.Drawing.Bitmap Arduino_Logo { | |||
| get { | |||
| object obj = ResourceManager.GetObject("Arduino_Logo", resourceCulture); | |||
| return ((System.Drawing.Bitmap)(obj)); | |||
| } | |||
| } | |||
| /// <summary> | |||
| /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. | |||
| /// </summary> | |||
| internal static System.Drawing.Bitmap blue_led_off { | |||
| get { | |||
| object obj = ResourceManager.GetObject("blue_led_off", resourceCulture); | |||
| return ((System.Drawing.Bitmap)(obj)); | |||
| } | |||
| } | |||
| /// <summary> | |||
| /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. | |||
| /// </summary> | |||
| internal static System.Drawing.Bitmap blue_led_on { | |||
| get { | |||
| object obj = ResourceManager.GetObject("blue_led_on", resourceCulture); | |||
| return ((System.Drawing.Bitmap)(obj)); | |||
| } | |||
| } | |||
| /// <summary> | |||
| /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. | |||
| /// </summary> | |||
| internal static System.Drawing.Bitmap status_offline_1 { | |||
| get { | |||
| object obj = ResourceManager.GetObject("status_offline_1", resourceCulture); | |||
| return ((System.Drawing.Bitmap)(obj)); | |||
| } | |||
| } | |||
| /// <summary> | |||
| /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. | |||
| /// </summary> | |||
| internal static System.Drawing.Bitmap status_online_1 { | |||
| get { | |||
| object obj = ResourceManager.GetObject("status_online_1", resourceCulture); | |||
| return ((System.Drawing.Bitmap)(obj)); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,136 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <root> | |||
| <!-- | |||
| Microsoft ResX Schema | |||
| Version 2.0 | |||
| The primary goals of this format is to allow a simple XML format | |||
| that is mostly human readable. The generation and parsing of the | |||
| various data types are done through the TypeConverter classes | |||
| associated with the data types. | |||
| Example: | |||
| ... ado.net/XML headers & schema ... | |||
| <resheader name="resmimetype">text/microsoft-resx</resheader> | |||
| <resheader name="version">2.0</resheader> | |||
| <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | |||
| <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | |||
| <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | |||
| <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | |||
| <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | |||
| <value>[base64 mime encoded serialized .NET Framework object]</value> | |||
| </data> | |||
| <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | |||
| <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | |||
| <comment>This is a comment</comment> | |||
| </data> | |||
| There are any number of "resheader" rows that contain simple | |||
| name/value pairs. | |||
| Each data row contains a name, and value. The row also contains a | |||
| type or mimetype. Type corresponds to a .NET class that support | |||
| text/value conversion through the TypeConverter architecture. | |||
| Classes that don't support this are serialized and stored with the | |||
| mimetype set. | |||
| The mimetype is used for serialized objects, and tells the | |||
| ResXResourceReader how to depersist the object. This is currently not | |||
| extensible. For a given mimetype the value must be set accordingly: | |||
| Note - application/x-microsoft.net.object.binary.base64 is the format | |||
| that the ResXResourceWriter will generate, however the reader can | |||
| read any of the formats listed below. | |||
| mimetype: application/x-microsoft.net.object.binary.base64 | |||
| value : The object must be serialized with | |||
| : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | |||
| : and then encoded with base64 encoding. | |||
| mimetype: application/x-microsoft.net.object.soap.base64 | |||
| value : The object must be serialized with | |||
| : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | |||
| : and then encoded with base64 encoding. | |||
| mimetype: application/x-microsoft.net.object.bytearray.base64 | |||
| value : The object must be serialized into a byte array | |||
| : using a System.ComponentModel.TypeConverter | |||
| : and then encoded with base64 encoding. | |||
| --> | |||
| <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | |||
| <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | |||
| <xsd:element name="root" msdata:IsDataSet="true"> | |||
| <xsd:complexType> | |||
| <xsd:choice maxOccurs="unbounded"> | |||
| <xsd:element name="metadata"> | |||
| <xsd:complexType> | |||
| <xsd:sequence> | |||
| <xsd:element name="value" type="xsd:string" minOccurs="0" /> | |||
| </xsd:sequence> | |||
| <xsd:attribute name="name" use="required" type="xsd:string" /> | |||
| <xsd:attribute name="type" type="xsd:string" /> | |||
| <xsd:attribute name="mimetype" type="xsd:string" /> | |||
| <xsd:attribute ref="xml:space" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| <xsd:element name="assembly"> | |||
| <xsd:complexType> | |||
| <xsd:attribute name="alias" type="xsd:string" /> | |||
| <xsd:attribute name="name" type="xsd:string" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| <xsd:element name="data"> | |||
| <xsd:complexType> | |||
| <xsd:sequence> | |||
| <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||
| <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | |||
| </xsd:sequence> | |||
| <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | |||
| <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | |||
| <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | |||
| <xsd:attribute ref="xml:space" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| <xsd:element name="resheader"> | |||
| <xsd:complexType> | |||
| <xsd:sequence> | |||
| <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |||
| </xsd:sequence> | |||
| <xsd:attribute name="name" type="xsd:string" use="required" /> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| </xsd:choice> | |||
| </xsd:complexType> | |||
| </xsd:element> | |||
| </xsd:schema> | |||
| <resheader name="resmimetype"> | |||
| <value>text/microsoft-resx</value> | |||
| </resheader> | |||
| <resheader name="version"> | |||
| <value>2.0</value> | |||
| </resheader> | |||
| <resheader name="reader"> | |||
| <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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |||
| </resheader> | |||
| <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> | |||
| <data name="blue_led_on" type="System.Resources.ResXFileRef, System.Windows.Forms"> | |||
| <value>..\Resources\blue_led_on.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> | |||
| </data> | |||
| <data name="Arduino_Logo" type="System.Resources.ResXFileRef, System.Windows.Forms"> | |||
| <value>..\Resources\Arduino_Logo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> | |||
| </data> | |||
| <data name="status_online_1" type="System.Resources.ResXFileRef, System.Windows.Forms"> | |||
| <value>..\Resources\status_online_1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> | |||
| </data> | |||
| <data name="status_offline_1" type="System.Resources.ResXFileRef, System.Windows.Forms"> | |||
| <value>..\Resources\status_offline_1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> | |||
| </data> | |||
| <data name="blue_led_off" type="System.Resources.ResXFileRef, System.Windows.Forms"> | |||
| <value>..\Resources\blue_led_off.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> | |||
| </data> | |||
| </root> | |||
| @@ -0,0 +1,25 @@ | |||
| //------------------------------------------------------------------------------ | |||
| // <auto-generated> | |||
| // This code was generated by a tool. | |||
| // Runtime Version:4.0.30319.42000 | |||
| // | |||
| // Changes to this file may cause incorrect behavior and will be lost if | |||
| // the code is regenerated. | |||
| // </auto-generated> | |||
| //------------------------------------------------------------------------------ | |||
| namespace FSRemotePowerSwitch.Properties { | |||
| [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] | |||
| [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] | |||
| internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { | |||
| private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); | |||
| public static Settings Default { | |||
| get { | |||
| return defaultInstance; | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,7 @@ | |||
| <?xml version='1.0' encoding='utf-8'?> | |||
| <SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"> | |||
| <Profiles> | |||
| <Profile Name="(Default)" /> | |||
| </Profiles> | |||
| <Settings /> | |||
| </SettingsFile> | |||
| @@ -0,0 +1,42 @@ | |||
| <?xml version="1.0" encoding="UTF-8" standalone="no"?> | |||
| <svg | |||
| height="32" | |||
| viewBox="0 -960 1280 1280" | |||
| width="32" | |||
| version="1.1" | |||
| id="svg4" | |||
| sodipodi:docname="Application_Logo.svg" | |||
| inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)" | |||
| inkscape:export-filename="Application_Logo.png" | |||
| inkscape:export-xdpi="96" | |||
| inkscape:export-ydpi="96" | |||
| xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | |||
| xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | |||
| xmlns="http://www.w3.org/2000/svg" | |||
| xmlns:svg="http://www.w3.org/2000/svg"> | |||
| <defs | |||
| id="defs8" /> | |||
| <sodipodi:namedview | |||
| id="namedview6" | |||
| pagecolor="#ffffff" | |||
| bordercolor="#666666" | |||
| borderopacity="1.0" | |||
| inkscape:showpageshadow="2" | |||
| inkscape:pageopacity="0.0" | |||
| inkscape:pagecheckerboard="0" | |||
| inkscape:deskcolor="#d1d1d1" | |||
| showgrid="false" | |||
| inkscape:zoom="9.8333333" | |||
| inkscape:cx="3.9661017" | |||
| inkscape:cy="28.169492" | |||
| inkscape:window-width="1920" | |||
| inkscape:window-height="1009" | |||
| inkscape:window-x="-8" | |||
| inkscape:window-y="-8" | |||
| inkscape:window-maximized="1" | |||
| inkscape:current-layer="svg4" /> | |||
| <path | |||
| d="m 301.33283,-712 -74.66643,-74.66667 q 78.66642,-82.66666 184.66607,-128 Q 517.33213,-960 639.99843,-960 q 122.66622,0 228.66586,45.33333 105.9996,45.33334 184.66611,128 L 978.66398,-712 q -63.99981,-66.66667 -151.33283,-104 -87.33305,-37.33334 -187.33272,-37.33334 -99.99971,0 -187.33276,37.33334 -87.33304,37.33333 -151.33284,104 z m 149.33285,149.33333 -74.66643,-74.66667 Q 426.66576,-688 493.99887,-717.33333 q 67.33312,-29.33334 145.99956,-29.33334 78.66638,0 145.99946,29.33334 67.33314,29.33333 117.99973,79.99999 l -74.66652,74.66667 q -35.9998,-36 -84.66635,-56.66667 -48.66655,-20.66667 -104.66632,-20.66667 -55.99984,0 -104.66636,20.66667 -48.66651,20.66667 -84.66639,56.66667 z m 189.33275,882.66666 q -75.99978,0 -131.33293,-55.33334 -55.33317,-55.33333 -55.33317,-131.33333 v -429.33333 q 0,-76 55.33317,-131.33333 55.33315,-55.33334 131.33293,-55.33334 75.99974,0 131.33282,55.33334 55.33327,55.33333 55.33327,131.33333 v 429.33333 q 0,76 -55.33327,131.33333 -55.33308,55.33334 -131.33282,55.33334 z m 0,-506.66667 q 43.99984,0 75.33305,-31.33333 31.33322,-31.33333 31.33322,-75.33333 0,-44 -31.33322,-75.33334 -31.33321,-31.33333 -75.33305,-31.33333 -43.99989,0 -75.33311,31.33333 -31.33324,31.33334 -31.33324,75.33334 0,44 31.33324,75.33333 31.33322,31.33333 75.33311,31.33333 z" | |||
| id="path2" | |||
| style="fill:#00979c;fill-opacity:1;stroke-width:1.33334" /> | |||
| </svg> | |||
| @@ -0,0 +1,157 @@ | |||
| <?xml version="1.0" encoding="UTF-8" standalone="no"?> | |||
| <svg | |||
| width="50.000019" | |||
| height="49.999962" | |||
| version="1.1" | |||
| id="svg33" | |||
| sodipodi:docname="blue_led_on.svg" | |||
| inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)" | |||
| xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | |||
| xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | |||
| xmlns:xlink="http://www.w3.org/1999/xlink" | |||
| xmlns="http://www.w3.org/2000/svg" | |||
| xmlns:svg="http://www.w3.org/2000/svg"> | |||
| <sodipodi:namedview | |||
| id="namedview35" | |||
| pagecolor="#ffffff" | |||
| bordercolor="#666666" | |||
| borderopacity="1.0" | |||
| inkscape:showpageshadow="2" | |||
| inkscape:pageopacity="0.0" | |||
| inkscape:pagecheckerboard="0" | |||
| inkscape:deskcolor="#d1d1d1" | |||
| showgrid="false" | |||
| inkscape:zoom="2.32" | |||
| inkscape:cx="150.21552" | |||
| inkscape:cy="43.534483" | |||
| inkscape:window-width="1920" | |||
| inkscape:window-height="1009" | |||
| inkscape:window-x="-8" | |||
| inkscape:window-y="-8" | |||
| inkscape:window-maximized="1" | |||
| inkscape:current-layer="svg33" /> | |||
| <title | |||
| id="title2">blue LED on</title> | |||
| <defs | |||
| id="defs21"> | |||
| <linearGradient | |||
| y2="12.376289" | |||
| y1="22.301244" | |||
| xlink:href="#linearGradient6506" | |||
| x2="16.491376" | |||
| x1="16.598271" | |||
| id="linearGradient6650" | |||
| gradientTransform="matrix(1.0871068,0,0,0.91987283,-1.1e-4,0.26091)" | |||
| gradientUnits="userSpaceOnUse" /> | |||
| <linearGradient | |||
| y2="38.709305" | |||
| y1="6.8783388" | |||
| xlink:href="#linearGradient5756" | |||
| x2="29.401097" | |||
| x1="26.323115" | |||
| id="linearGradient6646" | |||
| gradientTransform="matrix(1.0000045,0,0,1.0000045,-1.1e-4,0.26091)" | |||
| gradientUnits="userSpaceOnUse" /> | |||
| <linearGradient | |||
| y2="49.739081" | |||
| y1="0.70058971" | |||
| xlink:href="#linearGradient5742" | |||
| x2="25.024606" | |||
| x1="24.809105" | |||
| id="linearGradient6644" | |||
| gradientUnits="userSpaceOnUse" | |||
| gradientTransform="translate(-1.1e-4,0.26091)" /> | |||
| <linearGradient | |||
| id="linearGradient6506"> | |||
| <stop | |||
| stop-color="#ffffff" | |||
| stop-opacity="0" | |||
| offset="0" | |||
| id="stop6508" /> | |||
| <stop | |||
| stop-color="#ffffff" | |||
| stop-opacity="0.87451" | |||
| offset="1" | |||
| id="stop6510" /> | |||
| </linearGradient> | |||
| <linearGradient | |||
| id="linearGradient5756"> | |||
| <stop | |||
| stop-color="#828282" | |||
| offset="0" | |||
| id="stop5758" /> | |||
| <stop | |||
| stop-color="#929292" | |||
| stop-opacity="0.35294" | |||
| offset="1" | |||
| id="stop5760" /> | |||
| </linearGradient> | |||
| <linearGradient | |||
| id="linearGradient5742"> | |||
| <stop | |||
| stop-color="#adadad" | |||
| offset="0" | |||
| id="stop5744" /> | |||
| <stop | |||
| stop-color="#f0f0f0" | |||
| offset="1" | |||
| id="stop5746" /> | |||
| </linearGradient> | |||
| <linearGradient | |||
| y2="26.681922" | |||
| x2="29.802152" | |||
| y1="42.801127" | |||
| x1="43.061791" | |||
| id="svg_1" | |||
| gradientTransform="matrix(1.0000042,0,0,1.0000042,-1.1e-4,0.26091)" | |||
| gradientUnits="userSpaceOnUse"> | |||
| <stop | |||
| offset="0" | |||
| stop-opacity="0.98438" | |||
| stop-color="#1608A0" | |||
| id="stop16" /> | |||
| <stop | |||
| offset="0.98449999" | |||
| stop-opacity="0.98047" | |||
| stop-color="#1A03FF" | |||
| id="stop18" | |||
| style="stop-color:#048bff;stop-opacity:0.98046994;" /> | |||
| </linearGradient> | |||
| </defs> | |||
| <path | |||
| fill="url(#linearGradient6644)" | |||
| stroke-width="0.8" | |||
| stroke-linecap="round" | |||
| stroke-linejoin="round" | |||
| stroke-miterlimit="4" | |||
| id="path6596" | |||
| d="m 50.00002,24.999981 c 0,13.80003 -11.200008,24.999981 -25.00004,24.999981 C 11.200021,49.999962 0,38.800011 0,24.999981 0,11.19996 11.20001,0 24.99998,0 38.800012,0 50.00002,11.19995 50.00002,24.999981 Z" | |||
| style="fill:url(#linearGradient6644)" /> | |||
| <path | |||
| fill="url(#linearGradient6646)" | |||
| stroke-width="0.8" | |||
| stroke-linecap="round" | |||
| stroke-linejoin="round" | |||
| stroke-miterlimit="4" | |||
| id="path6598" | |||
| d="m 45.172822,24.994381 c 0,11.13689 -9.038754,20.175579 -20.175642,20.175579 -11.136889,0 -20.17564,-9.038689 -20.17564,-20.175579 0,-11.136891 9.03875,-20.175341 20.17564,-20.175341 11.136889,0 20.175642,9.03845 20.175642,20.175341 z" | |||
| style="fill:url(#linearGradient6646)" /> | |||
| <path | |||
| fill="url(#svg_1)" | |||
| stroke-width="0.8" | |||
| stroke-linecap="round" | |||
| stroke-linejoin="round" | |||
| stroke-miterlimit="4" | |||
| id="path6600" | |||
| d="m 43.06186,24.99963 c 0,9.97031 -8.091568,18.062229 -18.06188,18.062229 -9.970309,0 -18.06217,-8.09193 -18.06217,-18.062229 0,-9.96995 8.09187,-18.06152 18.06217,-18.06152 9.970312,0 18.06188,8.09157 18.06188,18.06152 z" | |||
| style="fill:url(#svg_1)" /> | |||
| <path | |||
| fill="url(#linearGradient6650)" | |||
| stroke-width="0.8" | |||
| stroke-linecap="round" | |||
| stroke-linejoin="round" | |||
| stroke-miterlimit="4" | |||
| id="path6602" | |||
| d="m 22.228989,11.40021 c 1.161501,1.7006 -0.1481,4.6185 -2.923199,6.513999 -2.774801,1.895201 -5.969501,2.053701 -7.131001,0.353201 -1.161201,-1.7001 0.148499,-4.618401 2.9234,-6.5136 2.7751,-1.89548 5.969701,-2.05364 7.130799,-0.3536 v 0 z" | |||
| style="fill:url(#linearGradient6650)" /> | |||
| </svg> | |||
| @@ -0,0 +1,165 @@ | |||
| using System.Windows.Forms; | |||
| using System.Drawing; | |||
| using System.Drawing.Drawing2D; | |||
| using System.ComponentModel; | |||
| namespace FSRemotePowerSwitch { | |||
| public class SButton : CheckBox | |||
| { | |||
| //Fields | |||
| private Color onBackColor = Color.MediumSlateBlue; | |||
| private Color onToggleColor = Color.WhiteSmoke; | |||
| private Color offBackColor = Color.Gray; | |||
| private Color offToggleColor = Color.Gainsboro; | |||
| private bool solidStyle = true; | |||
| //Properties | |||
| public Color OnBackColor | |||
| { | |||
| get { return onBackColor; } | |||
| set | |||
| { | |||
| onBackColor = value; | |||
| this.Invalidate(); | |||
| } | |||
| } | |||
| public Color OnToggleColor | |||
| { | |||
| get { return onToggleColor; } | |||
| set | |||
| { | |||
| onToggleColor = value; | |||
| this.Invalidate(); | |||
| } | |||
| } | |||
| public Color OffBackColor | |||
| { | |||
| get { return offBackColor; } | |||
| set | |||
| { | |||
| offBackColor = value; | |||
| this.Invalidate(); | |||
| } | |||
| } | |||
| public Color OffToggleColor | |||
| { | |||
| get { return offToggleColor; } | |||
| set | |||
| { | |||
| offToggleColor = value; | |||
| this.Invalidate(); | |||
| } | |||
| } | |||
| [Browsable(false)] | |||
| public override string Text | |||
| { | |||
| get { return base.Text; } | |||
| set { } | |||
| } | |||
| [DefaultValue(true)] | |||
| public bool SolidStyle | |||
| { | |||
| get { return solidStyle; } | |||
| set | |||
| { | |||
| solidStyle = value; | |||
| this.Invalidate(); | |||
| } | |||
| } | |||
| //Constructor | |||
| public SButton() | |||
| { | |||
| this.MinimumSize = new Size(45, 22); | |||
| } | |||
| //Methods | |||
| private GraphicsPath GetFigurePath() | |||
| { | |||
| int arcSize = this.Height - 1; | |||
| Rectangle leftArc = new Rectangle(0, 0, arcSize, arcSize); | |||
| Rectangle rightArc = new Rectangle(this.Width - arcSize - 2, 0, arcSize, arcSize); | |||
| GraphicsPath path = new GraphicsPath(); | |||
| path.StartFigure(); | |||
| path.AddArc(leftArc, 90, 180); | |||
| path.AddArc(rightArc, 270, 180); | |||
| path.CloseFigure(); | |||
| return path; | |||
| } | |||
| protected override void OnPaint(PaintEventArgs pevent) | |||
| { | |||
| int toggleSize = this.Height - 5; | |||
| pevent.Graphics.SmoothingMode = SmoothingMode.AntiAlias; | |||
| pevent.Graphics.Clear(this.Parent.BackColor); | |||
| if (this.Checked) //ON | |||
| { | |||
| //Draw the control surface | |||
| if (solidStyle) | |||
| pevent.Graphics.FillPath(new SolidBrush(onBackColor), GetFigurePath()); | |||
| else pevent.Graphics.DrawPath(new Pen(onBackColor, 2), GetFigurePath()); | |||
| //Draw the toggle | |||
| pevent.Graphics.FillEllipse(new SolidBrush(onToggleColor), | |||
| new Rectangle(this.Width - this.Height + 1, 2, toggleSize, toggleSize)); | |||
| } | |||
| else //OFF | |||
| { | |||
| //Draw the control surface | |||
| if (solidStyle) | |||
| pevent.Graphics.FillPath(new SolidBrush(offBackColor), GetFigurePath()); | |||
| else pevent.Graphics.DrawPath(new Pen(offBackColor, 2), GetFigurePath()); | |||
| //Draw the toggle | |||
| pevent.Graphics.FillEllipse(new SolidBrush(offToggleColor), | |||
| new Rectangle(2, 2, toggleSize, toggleSize)); | |||
| } | |||
| } | |||
| private void InitializeComponent() { | |||
| this.SuspendLayout(); | |||
| this.ResumeLayout(false); | |||
| } | |||
| } | |||
| public class RoundedButton : Button { | |||
| public RoundedButton() { | |||
| this.BackColor = Color.OrangeRed; | |||
| this.FlatStyle = System.Windows.Forms.FlatStyle.Flat; | |||
| this.FlatAppearance.BorderColor = Color.Black; | |||
| this.FlatAppearance.BorderSize = 1; | |||
| this.Width = 140; | |||
| this.Height = 45; | |||
| } | |||
| public int rdus = 30; | |||
| System.Drawing.Drawing2D.GraphicsPath GetRoundPath(RectangleF Rect, int radius) { | |||
| float r2 = radius / 2f; | |||
| System.Drawing.Drawing2D.GraphicsPath GraphPath = new System.Drawing.Drawing2D.GraphicsPath(); | |||
| GraphPath.AddArc(Rect.X, Rect.Y, radius, radius, 180, 90); | |||
| GraphPath.AddLine(Rect.X + r2, Rect.Y, Rect.Width - r2, Rect.Y); | |||
| GraphPath.AddArc(Rect.X + Rect.Width - radius, Rect.Y, radius, radius, 270, 90); | |||
| GraphPath.AddLine(Rect.Width, Rect.Y + r2, Rect.Width, Rect.Height - r2); | |||
| GraphPath.AddArc(Rect.X + Rect.Width - radius, | |||
| Rect.Y + Rect.Height - radius, radius, radius, 0, 90); | |||
| GraphPath.AddLine(Rect.Width - r2, Rect.Height, Rect.X + r2, Rect.Height); | |||
| GraphPath.AddArc(Rect.X, Rect.Y + Rect.Height - radius, radius, radius, 90, 90); | |||
| GraphPath.AddLine(Rect.X, Rect.Height - r2, Rect.X, Rect.Y + r2); | |||
| GraphPath.CloseFigure(); | |||
| return GraphPath; | |||
| } | |||
| protected override void OnPaint(PaintEventArgs e) { | |||
| base.OnPaint(e); | |||
| RectangleF Rect = new RectangleF(0, 0, this.Width, this.Height); | |||
| using (System.Drawing.Drawing2D.GraphicsPath GraphPath = GetRoundPath(Rect, rdus)) { | |||
| this.Region = new Region(GraphPath); | |||
| using (Pen pen = new Pen(Color.CadetBlue, 1.75f)) { | |||
| pen.Alignment = System.Drawing.Drawing2D.PenAlignment.Inset; | |||
| e.Graphics.DrawPath(pen, GraphPath); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,116 @@ | |||
| #region License | |||
| /* Copyright (c) 2017 Fabrice Lacharme | |||
| * This code was originally written by Jigar Desai | |||
| * http://www.c-sharpcorner.com/article/knob-control-using-windows-forms-and-gdi/ | |||
| * Note that another implementation exists in vb.net by Blong | |||
| * https://www.codeproject.com/Articles/2563/VB-NET-Knob-Control-using-Windows-Forms-and-GDI?msg=1884770#xx1884770xx | |||
| * | |||
| * 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. | |||
| */ | |||
| #endregion | |||
| #region Contact | |||
| /* | |||
| * Fabrice Lacharme | |||
| * Email: fabrice.lacharme@gmail.com | |||
| */ | |||
| #endregion | |||
| using System; | |||
| using System.Drawing; | |||
| namespace KnobControl | |||
| { | |||
| /// <summary> | |||
| /// Summary description for Utility. | |||
| /// </summary> | |||
| public class Utility | |||
| { | |||
| public static float GetRadian(float val) | |||
| { | |||
| return (float)(val * Math.PI / 180); | |||
| } | |||
| public static Color GetDarkColor(Color c,byte d) | |||
| { | |||
| byte r = 0 ; | |||
| byte g = 0; | |||
| byte b = 0 ; | |||
| if (c.R > d) r = (byte)(c.R - d); | |||
| if (c.G > d) g = (byte)(c.G - d); | |||
| if (c.B > d) b = (byte)(c.B - d); | |||
| Color c1 = Color.FromArgb(r,g,b); | |||
| return c1; | |||
| } | |||
| public static Color GetLightColor(Color c,byte d) | |||
| { | |||
| byte r = 255 ; | |||
| byte g = 255 ; | |||
| byte b = 255 ; | |||
| if (c.R + d < 255) r = (byte)(c.R + d); | |||
| if (c.G + d < 255) g = (byte)(c.G + d); | |||
| if (c.B + d < 255) b = (byte)(c.B + d); | |||
| Color c2 = Color.FromArgb(r,g,b); | |||
| return c2; | |||
| } | |||
| /// <summary> | |||
| /// Method which checks is particular point is in rectangle | |||
| /// </summary> | |||
| /// <param name="p">Point to be Chaecked</param> | |||
| /// <param name="r">Rectangle</param> | |||
| /// <returns>true is Point is in rectangle, else false</returns> | |||
| public static bool IsPointinRectangle(Point p ,Rectangle r) | |||
| { | |||
| bool flag = false; | |||
| if (p.X > r.X && p.X < r.X + r.Width && p.Y > r.Y && p.Y < r.Y + r.Height) | |||
| { | |||
| flag = true; | |||
| } | |||
| return flag; | |||
| } | |||
| public static void DrawInsetCircle(ref Graphics g,Rectangle r,Pen p) | |||
| { | |||
| Pen p1 = new Pen(GetDarkColor(p.Color,50)); | |||
| Pen p2 = new Pen(GetLightColor(p.Color,50)); | |||
| for (int i=0;i<p.Width;i++) | |||
| { | |||
| Rectangle r1 = new Rectangle(r.X +i,r.Y +i,r.Width-i*2,r.Height-i*2); | |||
| g.DrawArc(p2,r1,-45,180); | |||
| g.DrawArc(p1,r1,135,180); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,6 @@ | |||
| <?xml version="1.0" encoding="utf-8" ?> | |||
| <configuration> | |||
| <startup> | |||
| <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> | |||
| </startup> | |||
| </configuration> | |||
| @@ -0,0 +1,2 @@ | |||
| LastSerialPort=COM4 | |||
| ExpectedFirmwareVersion=V1.0.0 | |||
| @@ -0,0 +1,6 @@ | |||
| <?xml version="1.0" encoding="utf-8" ?> | |||
| <configuration> | |||
| <startup> | |||
| <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> | |||
| </startup> | |||
| </configuration> | |||
| @@ -0,0 +1,2 @@ | |||
| LastSerialPort=COM3 | |||
| ExpectedFirmwareVersion=V1.0.0 | |||
| @@ -0,0 +1,4 @@ | |||
| // <autogenerated /> | |||
| using System; | |||
| using System.Reflection; | |||
| [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] | |||
| @@ -0,0 +1 @@ | |||
| d7ccb24289d51dfd184f4fe78af4fc180f02824f | |||
| @@ -0,0 +1,30 @@ | |||
| D:\Work\FSRemotePowerSwitch\obj\Debug\FSRemotePowerSwitch.MainForm.resources | |||
| D:\Work\FSRemotePowerSwitch\obj\Debug\FSRemotePowerSwitch.Properties.Resources.resources | |||
| D:\Work\FSRemotePowerSwitch\obj\Debug\FSRemotePowerSwitch.csproj.GenerateResource.cache | |||
| D:\Work\FSRemotePowerSwitch\obj\Debug\FSRemotePowerSwitch.csproj.CoreCompileInputs.cache | |||
| D:\Work\FSRemotePowerSwitch\bin\Debug\FSRemotePowerSwitch.exe.config | |||
| D:\Work\FSRemotePowerSwitch\bin\Debug\FSRemotePowerSwitch.exe | |||
| D:\Work\FSRemotePowerSwitch\bin\Debug\FSRemotePowerSwitch.pdb | |||
| D:\Work\FSRemotePowerSwitch\bin\Debug\Newtonsoft.Json.dll | |||
| D:\Work\FSRemotePowerSwitch\bin\Debug\Newtonsoft.Json.xml | |||
| D:\Work\FSRemotePowerSwitch\obj\Debug\FSRemotePowerSwitch.csproj.CopyComplete | |||
| D:\Work\FSRemotePowerSwitch\obj\Debug\FSRemotePowerSwitch.exe | |||
| D:\Work\FSRemotePowerSwitch\obj\Debug\FSRemotePowerSwitch.pdb | |||
| D:\Work\FSRemotePowerSwitch\obj\Debug\FSRemotePowerSwitch.csproj.AssemblyReference.cache | |||
| C:\dev\FSRemotePowerSwitch\bin\Debug\FSRemotePowerSwitch.exe.config | |||
| C:\dev\FSRemotePowerSwitch\bin\Debug\FSRemotePowerSwitch.exe | |||
| C:\dev\FSRemotePowerSwitch\bin\Debug\FSRemotePowerSwitch.pdb | |||
| C:\dev\FSRemotePowerSwitch\bin\Debug\KnobControl.dll | |||
| C:\dev\FSRemotePowerSwitch\bin\Debug\Newtonsoft.Json.dll | |||
| C:\dev\FSRemotePowerSwitch\bin\Debug\KnobControl.pdb | |||
| C:\dev\FSRemotePowerSwitch\bin\Debug\Newtonsoft.Json.xml | |||
| C:\dev\FSRemotePowerSwitch\obj\Debug\FSRemotePowerSwitch.csproj.AssemblyReference.cache | |||
| C:\dev\FSRemotePowerSwitch\obj\Debug\FSRemotePowerSwitch.MainForm.resources | |||
| C:\dev\FSRemotePowerSwitch\obj\Debug\FSRemotePowerSwitch.Properties.Resources.resources | |||
| C:\dev\FSRemotePowerSwitch\obj\Debug\FSRemotePowerSwitch.csproj.GenerateResource.cache | |||
| C:\dev\FSRemotePowerSwitch\obj\Debug\FSRemotePowerSwitch.csproj.CoreCompileInputs.cache | |||
| C:\dev\FSRemotePowerSwitch\obj\Debug\FSRemotePowerSwitch.csproj.CopyComplete | |||
| C:\dev\FSRemotePowerSwitch\obj\Debug\FSRemotePowerSwitch.exe | |||
| C:\dev\FSRemotePowerSwitch\obj\Debug\FSRemotePowerSwitch.pdb | |||
| D:\Work\FSRemotePowerSwitch\bin\Debug\KnobControl.dll | |||
| D:\Work\FSRemotePowerSwitch\bin\Debug\KnobControl.pdb | |||
| @@ -0,0 +1,4 @@ | |||
| // <autogenerated /> | |||
| using System; | |||
| using System.Reflection; | |||
| [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] | |||
| @@ -0,0 +1 @@ | |||
| 0d8ec82c7ae4004db9ca468fddc70add637354fe | |||
| @@ -0,0 +1,12 @@ | |||
| D:\Work\FSRemotePowerSwitch\bin\Release\FSRemotePowerSwitch.exe.config | |||
| D:\Work\FSRemotePowerSwitch\bin\Release\FSRemotePowerSwitch.exe | |||
| D:\Work\FSRemotePowerSwitch\bin\Release\FSRemotePowerSwitch.pdb | |||
| D:\Work\FSRemotePowerSwitch\bin\Release\Newtonsoft.Json.dll | |||
| D:\Work\FSRemotePowerSwitch\bin\Release\Newtonsoft.Json.xml | |||
| D:\Work\FSRemotePowerSwitch\obj\Release\FSRemotePowerSwitch.MainForm.resources | |||
| D:\Work\FSRemotePowerSwitch\obj\Release\FSRemotePowerSwitch.Properties.Resources.resources | |||
| D:\Work\FSRemotePowerSwitch\obj\Release\FSRemotePowerSwitch.csproj.GenerateResource.cache | |||
| D:\Work\FSRemotePowerSwitch\obj\Release\FSRemotePowerSwitch.csproj.CoreCompileInputs.cache | |||
| D:\Work\FSRemotePowerSwitch\obj\Release\FSRemotePowerSwitch.csproj.CopyComplete | |||
| D:\Work\FSRemotePowerSwitch\obj\Release\FSRemotePowerSwitch.exe | |||
| D:\Work\FSRemotePowerSwitch\obj\Release\FSRemotePowerSwitch.pdb | |||
| @@ -0,0 +1,4 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <packages> | |||
| <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net472" /> | |||
| </packages> | |||
| @@ -0,0 +1,116 @@ | |||
| param($installPath, $toolsPath, $package, $project) | |||
| # open json.net splash page on package install | |||
| # don't open if json.net is installed as a dependency | |||
| try | |||
| { | |||
| $url = "http://www.newtonsoft.com/json/install?version=" + $package.Version | |||
| $dte2 = Get-Interface $dte ([EnvDTE80.DTE2]) | |||
| if ($dte2.ActiveWindow.Caption -eq "Package Manager Console") | |||
| { | |||
| # user is installing from VS NuGet console | |||
| # get reference to the window, the console host and the input history | |||
| # show webpage if "install-package newtonsoft.json" was last input | |||
| $consoleWindow = $(Get-VSComponentModel).GetService([NuGetConsole.IPowerConsoleWindow]) | |||
| $props = $consoleWindow.GetType().GetProperties([System.Reflection.BindingFlags]::Instance -bor ` | |||
| [System.Reflection.BindingFlags]::NonPublic) | |||
| $prop = $props | ? { $_.Name -eq "ActiveHostInfo" } | select -first 1 | |||
| if ($prop -eq $null) { return } | |||
| $hostInfo = $prop.GetValue($consoleWindow) | |||
| if ($hostInfo -eq $null) { return } | |||
| $history = $hostInfo.WpfConsole.InputHistory.History | |||
| $lastCommand = $history | select -last 1 | |||
| if ($lastCommand) | |||
| { | |||
| $lastCommand = $lastCommand.Trim().ToLower() | |||
| if ($lastCommand.StartsWith("install-package") -and $lastCommand.Contains("newtonsoft.json")) | |||
| { | |||
| $dte2.ItemOperations.Navigate($url) | Out-Null | |||
| } | |||
| } | |||
| } | |||
| else | |||
| { | |||
| # user is installing from VS NuGet dialog | |||
| # get reference to the window, then smart output console provider | |||
| # show webpage if messages in buffered console contains "installing...newtonsoft.json" in last operation | |||
| $instanceField = [NuGet.Dialog.PackageManagerWindow].GetField("CurrentInstance", [System.Reflection.BindingFlags]::Static -bor ` | |||
| [System.Reflection.BindingFlags]::NonPublic) | |||
| $consoleField = [NuGet.Dialog.PackageManagerWindow].GetField("_smartOutputConsoleProvider", [System.Reflection.BindingFlags]::Instance -bor ` | |||
| [System.Reflection.BindingFlags]::NonPublic) | |||
| if ($instanceField -eq $null -or $consoleField -eq $null) { return } | |||
| $instance = $instanceField.GetValue($null) | |||
| if ($instance -eq $null) { return } | |||
| $consoleProvider = $consoleField.GetValue($instance) | |||
| if ($consoleProvider -eq $null) { return } | |||
| $console = $consoleProvider.CreateOutputConsole($false) | |||
| $messagesField = $console.GetType().GetField("_messages", [System.Reflection.BindingFlags]::Instance -bor ` | |||
| [System.Reflection.BindingFlags]::NonPublic) | |||
| if ($messagesField -eq $null) { return } | |||
| $messages = $messagesField.GetValue($console) | |||
| if ($messages -eq $null) { return } | |||
| $operations = $messages -split "==============================" | |||
| $lastOperation = $operations | select -last 1 | |||
| if ($lastOperation) | |||
| { | |||
| $lastOperation = $lastOperation.ToLower() | |||
| $lines = $lastOperation -split "`r`n" | |||
| $installMatch = $lines | ? { $_.StartsWith("------- installing...newtonsoft.json ") } | select -first 1 | |||
| if ($installMatch) | |||
| { | |||
| $dte2.ItemOperations.Navigate($url) | Out-Null | |||
| } | |||
| } | |||
| } | |||
| } | |||
| catch | |||
| { | |||
| try | |||
| { | |||
| $pmPane = $dte2.ToolWindows.OutputWindow.OutputWindowPanes.Item("Package Manager") | |||
| $selection = $pmPane.TextDocument.Selection | |||
| $selection.StartOfDocument($false) | |||
| $selection.EndOfDocument($true) | |||
| if ($selection.Text.StartsWith("Attempting to gather dependencies information for package 'Newtonsoft.Json." + $package.Version + "'")) | |||
| { | |||
| # don't show on upgrade | |||
| if (!$selection.Text.Contains("Removed package")) | |||
| { | |||
| $dte2.ItemOperations.Navigate($url) | Out-Null | |||
| } | |||
| } | |||
| } | |||
| catch | |||
| { | |||
| # stop potential errors from bubbling up | |||
| # worst case the splash page won't open | |||
| } | |||
| } | |||
| # still yolo | |||