Initial checkin
This commit is contained in:
parent
7894f77b30
commit
3ba8e1b177
|
@ -0,0 +1,25 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio 15
|
||||||
|
VisualStudioVersion = 15.0.28307.438
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mk0.GUI.Banner", "Mk0.GUI.Banner\Mk0.GUI.Banner.csproj", "{4B628B83-433B-47C8-AF97-D4BC288168BB}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{4B628B83-433B-47C8-AF97-D4BC288168BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{4B628B83-433B-47C8-AF97-D4BC288168BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{4B628B83-433B-47C8-AF97-D4BC288168BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{4B628B83-433B-47C8-AF97-D4BC288168BB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {A1D6866B-6D2E-401B-BEF7-A00488F69584}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
|
@ -0,0 +1,164 @@
|
||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace Mk0.GUI.Banner
|
||||||
|
{
|
||||||
|
public class Banner
|
||||||
|
{
|
||||||
|
private readonly Settings settings;
|
||||||
|
private readonly Queue queue;
|
||||||
|
private readonly Timer timerEinblenden;
|
||||||
|
private readonly Timer timerAnzeigen;
|
||||||
|
private readonly Timer timerAusblenden;
|
||||||
|
private readonly Panel bannerPanel;
|
||||||
|
private bool messagesRunning = false;
|
||||||
|
private PictureBox pb1;
|
||||||
|
private PictureBox pb2;
|
||||||
|
private Label l1;
|
||||||
|
private Label l2;
|
||||||
|
|
||||||
|
public Banner(IContainer container, Panel bannerPanel, PictureBox pb1, PictureBox pb2, Label l1, Label l2)
|
||||||
|
{
|
||||||
|
settings = new Settings();
|
||||||
|
queue = new Queue();
|
||||||
|
this.bannerPanel = bannerPanel;
|
||||||
|
this.pb1 = pb1;
|
||||||
|
this.pb2 = pb2;
|
||||||
|
this.l1 = l1;
|
||||||
|
this.l2 = l2;
|
||||||
|
|
||||||
|
timerEinblenden = new Timer(container)
|
||||||
|
{
|
||||||
|
Interval = settings.TimerEinblendenIntervall
|
||||||
|
};
|
||||||
|
timerEinblenden.Tick += new EventHandler(TimerEinblenden_Tick);
|
||||||
|
timerAnzeigen = new Timer(container)
|
||||||
|
{
|
||||||
|
Interval = settings.TimerAnzeigenIntervall
|
||||||
|
};
|
||||||
|
timerAnzeigen.Tick += new EventHandler(TimerAnzeigen_Tick);
|
||||||
|
timerAusblenden = new Timer(container)
|
||||||
|
{
|
||||||
|
Interval = settings.TimerAusblendenIntervall
|
||||||
|
};
|
||||||
|
timerAusblenden.Tick += new EventHandler(TimerAusblenden_Tick);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TimerEinblenden_Tick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
//einblenden
|
||||||
|
if (bannerPanel.Location != new Point(0, 0))
|
||||||
|
{
|
||||||
|
bannerPanel.Location = new Point(bannerPanel.Location.X, bannerPanel.Location.Y + 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
timerEinblenden.Stop();
|
||||||
|
if (queue.bol.Count < 2)
|
||||||
|
{
|
||||||
|
timerAnzeigen.Interval = 1500;
|
||||||
|
}
|
||||||
|
else if (queue.bol.Count < 5)
|
||||||
|
{
|
||||||
|
timerAnzeigen.Interval = 1000;
|
||||||
|
}
|
||||||
|
else if (queue.bol.Count < 10)
|
||||||
|
{
|
||||||
|
timerAnzeigen.Interval = 750;
|
||||||
|
}
|
||||||
|
else if (queue.bol.Count < 15)
|
||||||
|
{
|
||||||
|
timerAnzeigen.Interval = 500;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
timerAnzeigen.Interval = 250;
|
||||||
|
}
|
||||||
|
timerAnzeigen.Start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TimerAnzeigen_Tick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
//anzeigen
|
||||||
|
timerAnzeigen.Stop();
|
||||||
|
timerAusblenden.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TimerAusblenden_Tick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
//ausblenden
|
||||||
|
if (bannerPanel.Location != new Point(0, -(bannerPanel.Height + 2)))
|
||||||
|
{
|
||||||
|
bannerPanel.Location = new Point(bannerPanel.Location.X, bannerPanel.Location.Y - 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
timerAusblenden.Stop();
|
||||||
|
if (queue.bol.Count > 0)
|
||||||
|
{
|
||||||
|
ShowMessages(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
messagesRunning = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Enqueue(string label1Text, string label2Text, string pb1ImageLocation, Image pb2Image)
|
||||||
|
{
|
||||||
|
BannerObject bo = new BannerObject(label1Text, label2Text, pb1ImageLocation, pb2Image);
|
||||||
|
queue.bol.Enqueue(bo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Enqueue(string label1Text, string label2Text, Image pb1Image, Image pb2Image)
|
||||||
|
{
|
||||||
|
BannerObject bo = new BannerObject(label1Text, label2Text, pb1Image, pb2Image);
|
||||||
|
queue.bol.Enqueue(bo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetTimerEinblendenIntervall(int intervall)
|
||||||
|
{
|
||||||
|
settings.TimerEinblendenIntervall = intervall;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetTimerAnzeigenIntervall(int intervall)
|
||||||
|
{
|
||||||
|
settings.TimerAnzeigenIntervall = intervall;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetTimerAusblendenIntervall(int intervall)
|
||||||
|
{
|
||||||
|
settings.TimerAusblendenIntervall = intervall;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowMessages(bool doit = false)
|
||||||
|
{
|
||||||
|
if (!messagesRunning || doit)
|
||||||
|
{
|
||||||
|
messagesRunning = true;
|
||||||
|
|
||||||
|
if (queue.bol.Count > 0)
|
||||||
|
{
|
||||||
|
BannerObject bo = queue.bol.Dequeue();
|
||||||
|
if (bo.Pb1ImageLocation != null)
|
||||||
|
{
|
||||||
|
pb1.ImageLocation = bo.Pb1ImageLocation;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pb1.Image = bo.Pb1Image;
|
||||||
|
}
|
||||||
|
pb2.Image = bo.Pb2Image;
|
||||||
|
l1.Text = bo.Label1Text;
|
||||||
|
l2.Text = bo.Label2Text;
|
||||||
|
bannerPanel.Location = new Point(bannerPanel.Location.X, bannerPanel.Location.Y - (bannerPanel.Height + 2));
|
||||||
|
timerEinblenden.Start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
|
namespace Mk0.GUI.Banner
|
||||||
|
{
|
||||||
|
internal class BannerObject
|
||||||
|
{
|
||||||
|
internal string Label1Text { get; }
|
||||||
|
internal string Label2Text { get; }
|
||||||
|
internal string Pb1ImageLocation { get; }
|
||||||
|
internal Image Pb1Image { get; }
|
||||||
|
internal Image Pb2Image { get; }
|
||||||
|
|
||||||
|
internal BannerObject(string label1Text, string label2Text, string pb1ImageLocation, Image pb2Image)
|
||||||
|
{
|
||||||
|
Label1Text = label1Text;
|
||||||
|
Label2Text = label2Text;
|
||||||
|
Pb1ImageLocation = pb1ImageLocation;
|
||||||
|
Pb2Image = pb2Image;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal BannerObject(string label1Text, string label2Text, Image pb1Image, Image pb2Image)
|
||||||
|
{
|
||||||
|
Label1Text = label1Text;
|
||||||
|
Label2Text = label2Text;
|
||||||
|
Pb1Image = pb1Image;
|
||||||
|
Pb2Image = pb2Image;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?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>{4B628B83-433B-47C8-AF97-D4BC288168BB}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Mk0.GUI.Banner</RootNamespace>
|
||||||
|
<AssemblyName>Mk0.GUI.Banner</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<Deterministic>true</Deterministic>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<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' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Windows.Forms" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Banner.cs" />
|
||||||
|
<Compile Include="BannerObject.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Queue.cs" />
|
||||||
|
<Compile Include="Settings.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
</Project>
|
|
@ -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("Mk0.GUI.Banner")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("Mk0.GUI.Banner")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2019 mk0.at")]
|
||||||
|
[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("4b628b83-433b-47c8-af97-d4bc288168bb")]
|
||||||
|
|
||||||
|
// 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,14 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Mk0.GUI.Banner
|
||||||
|
{
|
||||||
|
public class Queue
|
||||||
|
{
|
||||||
|
internal readonly Queue<BannerObject> bol;
|
||||||
|
|
||||||
|
internal Queue()
|
||||||
|
{
|
||||||
|
bol = new Queue<BannerObject>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
namespace Mk0.GUI.Banner
|
||||||
|
{
|
||||||
|
public class Settings
|
||||||
|
{
|
||||||
|
internal int TimerEinblendenIntervall { get; set; }
|
||||||
|
internal int TimerAnzeigenIntervall { get; set; }
|
||||||
|
internal int TimerAusblendenIntervall { get; set; }
|
||||||
|
|
||||||
|
internal Settings()
|
||||||
|
{
|
||||||
|
TimerEinblendenIntervall = 10;
|
||||||
|
TimerAnzeigenIntervall = 1500;
|
||||||
|
TimerAusblendenIntervall = 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue