Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 0 additions & 133 deletions keybon companion/KeybonCompanion.csproj

This file was deleted.

51 changes: 42 additions & 9 deletions keybon companion/MainWindow.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
Expand All @@ -16,9 +16,10 @@

namespace keybon
{
public partial class MainWindow : Form
{
private NotifyIcon notifyIcon; // Hinzugefügt: NotifyIcon für Systemtray
String portName = "COM14";
public SerialPort _serialPort;
public ScreenLayout[] Layouts = new ScreenLayout[8];
Expand Down Expand Up @@ -75,7 +76,7 @@ public int CurrentLayout
public String CurrentApp
{
get { return currentApp; }
set //respond to change of currentApp
set // respond to change of currentApp
{
if (!value.Equals(currentApp) && !value.Equals("keybon companion"))
{
Expand All @@ -93,7 +94,8 @@ public String CurrentApp
}
}
}
public void addAppSelection(String newApp) //for passing data from AppSelect

public void addAppSelection(String newApp) // for passing data from AppSelect
{
Layouts[CurrentLayout].Apps.Add(newApp);
listBox1.DataSource = null;
Expand All @@ -103,6 +105,22 @@ public void addAppSelection(String newApp) //for passing data from AppSelect
public MainWindow()
{
InitializeComponent();

// Verhindert Anzeige in der Taskleiste
this.ShowInTaskbar = false;

// Systemtray-Icon initialisieren
notifyIcon = new NotifyIcon
{
Icon = new Icon("path-to-icon.ico"), // Pfad zu deinem Icon
Visible = true,
Text = "Keybon Companion"
};
notifyIcon.MouseDoubleClick += NotifyIcon_MouseDoubleClick;

// Minimierungsereignis registrieren
this.Resize += MainWindow_Resize;

pictureBox01.AllowDrop = true;
pictureBox02.AllowDrop = true;
pictureBox03.AllowDrop = true;
Expand All @@ -111,7 +129,7 @@ public MainWindow()
pictureBox06.AllowDrop = true;
pictureBox07.AllowDrop = true;
pictureBox08.AllowDrop = true;
pictureBox09.AllowDrop = true;
pictureBox09.AllowDrop = true;

for (int i = 0; i < Layouts.Length; i++)
{
Expand All @@ -133,19 +151,34 @@ public MainWindow()
comboBox2.DataSource = ports;
if (ports.Contains(portName))
{
comboBox2.SelectedItem = portName;
comboBox2.SelectedItem = portName;
try
{
_serialPort.Open();
}
catch { }
}
}
_serialPort.DataReceived += portDataReceived;


Timer timer1 = new Timer{ Interval = 250 };
Timer timer1 = new Timer { Interval = 250 };
timer1.Enabled = true;
timer1.Tick += new System.EventHandler(OnTimerEvent);
timer1.Tick += new EventHandler(OnTimerEvent);
}

private void MainWindow_Resize(object sender, EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
this.Hide(); // Fenster ausblenden
notifyIcon.ShowBalloonTip(1000, "Keybon Companion", "Das Programm wurde in den Hintergrund verschoben.", ToolTipIcon.Info);
}
}

private void NotifyIcon_MouseDoubleClick(object sender, MouseEventArgs e)
{
this.Show();
this.WindowState = FormWindowState.Normal;
}

private void portDataReceived(object sender, EventArgs args)
Expand Down
130 changes: 12 additions & 118 deletions keybon companion/keybon companion.csproj
Original file line number Diff line number Diff line change
@@ -1,127 +1,21 @@
<?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')" />
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F6A8448D-F8E4-45A1-9616-4F1DE79CB94E}</ProjectGuid>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<RootNamespace>keybon</RootNamespace>
<AssemblyName>keybon companion</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<ApplicationIcon>favicon.ico</ApplicationIcon>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</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' ">
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<SupportedOSPlatform>Windows</SupportedOSPlatform>
<NoWarn>CA1416</NoWarn>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>favicon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<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="AppSelect.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="AppSelect.Designer.cs">
<DependentUpon>AppSelect.cs</DependentUpon>
</Compile>
<Compile Include="MainWindow.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainWindow.Designer.cs">
<DependentUpon>MainWindow.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="AppSelect.resx">
<DependentUpon>AppSelect.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainWindow.resx">
<DependentUpon>MainWindow.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>PublicResXFileCodeGenerator</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="Properties\DataSources\WindowsFormsApp1.MainWindow.datasource" />
<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>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 und x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>

<ItemGroup>
<Content Include="favicon.ico" />
<PackageReference Include="System.IO.Ports" Version="6.0.0" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

</Project>
Loading