events in WFA01

This commit is contained in:
test 2019-04-06 13:34:30 +02:00
parent d430e851b4
commit 1a44661209
20 changed files with 314 additions and 51 deletions

View File

@ -38,6 +38,9 @@
this.button3 = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.button4 = new System.Windows.Forms.Button();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();
@ -142,6 +145,34 @@
this.label3.TabIndex = 9;
this.label3.Text = "label3";
//
// button4
//
this.button4.Location = new System.Drawing.Point(356, 57);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(75, 23);
this.button4.TabIndex = 10;
this.button4.Text = "button4";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.Button4_Click);
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(592, 66);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(35, 13);
this.label4.TabIndex = 11;
this.label4.Text = "label4";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(700, 88);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(35, 13);
this.label5.TabIndex = 12;
this.label5.Text = "label5";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -149,6 +180,9 @@
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.button4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.button3);
@ -184,6 +218,9 @@
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
}
}

View File

@ -52,6 +52,8 @@ namespace WindowsFormsApp01
{
InitializeComponent();
label1.Text = " ";
calc.CalcFinished += CalcFinished;
}
private void Button1_Click(object sender, EventArgs e)
@ -72,18 +74,6 @@ namespace WindowsFormsApp01
}
private void Panel1_Paint(object sender, PaintEventArgs e)
{
Graphics graphics = e.Graphics;
@ -92,29 +82,27 @@ namespace WindowsFormsApp01
using (var p = _pen)
{
//y axis
graphics.DrawLine(p, 10, 10, 10, 246);
//y axis
graphics.DrawLine(p, 10, 10, 10, 246);
//x axis
graphics.DrawLine(p, 10, 246, 502, 246);
//x axis
graphics.DrawLine(p, 10, 246, 502, 246);
//arrow y axis
graphics.DrawLine(p, 5, 15, 10, 10);
graphics.DrawLine(p, 15, 15, 10, 10);
//arrow y axis
graphics.DrawLine(p, 5, 15, 10, 10);
graphics.DrawLine(p, 15, 15, 10, 10);
//arrow x axis
graphics.DrawLine(p, 498, 241, 502, 246);
graphics.DrawLine(p, 498, 251, 502, 246);
//arrow x axis
graphics.DrawLine(p, 498, 241, 502, 246);
graphics.DrawLine(p, 498, 251, 502, 246);
}
Brush aBrush = (Brush) Brushes.Red;
for (int i = 10; i < (502 ); i++)
for (int i = 10; i < (502); i++)
{
int y = (int)( 246 - (((Math.Log(i) * 10) - 23) *_scale ) );
int y = (int) (246 - (((Math.Log(i) * 10) - 23) * _scale));
graphics.FillRectangle(aBrush, i, y, 2, 2);
}
@ -129,7 +117,6 @@ namespace WindowsFormsApp01
private void TrackBar1_Scroll(object sender, EventArgs e)
{
_scale = (int) trackBar1.Value;
panel1.Refresh();
@ -137,14 +124,10 @@ namespace WindowsFormsApp01
private void Panel1_AutoSizeChanged(object sender, EventArgs e)
{
}
private void Form1_Resize(object sender, EventArgs e)
{
_x = panel1.Width;
_y = panel1.Height;
panel1.Invalidate();
@ -158,24 +141,22 @@ namespace WindowsFormsApp01
string s3 = String.Empty;
Stopwatch sw = new Stopwatch();
Stopwatch sw = new Stopwatch();
sw.Start();
sw.Start();
for (int i = 0; i < 50000; i++)
{
s3 = s3 + s1 + s2;
s3 = s3 + s1 + s2;
}
sw.Stop();
label3.Text = sw.ElapsedMilliseconds.ToString();
}
private void Button3_Click(object sender, EventArgs e)
{
string s1 = "hello";
string s2 = "Offenburg";
@ -199,5 +180,48 @@ namespace WindowsFormsApp01
label2.Text = sw.ElapsedMilliseconds.ToString();
}
private void Button4_Click(object sender, EventArgs e)
{
calc.CalcIt();
}
public void CalcFinished(CalcEventArgs e)
{
label4.Text = e.Result.ToString();
}
}
public class CalcEventArgs
{
public CalcEventArgs(int result)
{
Result = result;
}
public int Result { get; private set; }
}
public static class calc
{
public delegate void CalcEventHandler(CalcEventArgs e);
public static event CalcEventHandler CalcFinished;
public static void CalcIt()
{
int res = DateTime.Now.Second;
var e = new CalcEventArgs(res);
//trigger handler
if (CalcFinished != null)
{
CalcFinished(e);
}
}
}
}

8
winVCR/SMTape.cs Normal file
View File

@ -0,0 +1,8 @@
using System;
public class Class1
{
public Class1()
{
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("VCRlogic")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("VCRlogic")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("74f418c8-f030-41c7-ba8d-8a9b57253e45")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

26
winVCR/VCRlogic/SMtape.cs Normal file
View File

@ -0,0 +1,26 @@
using System;
using System.Runtime.CompilerServices;
public class SMtape
{
private SMtape _concreteState;
public SMtape()
{
}
}
public class SMtapeNoTapeIn : SMtape
{
}
public class SMtapeTapeInNotEnd : SMtape
{
}
public class SMtapeTapeInEnd : SMtape
{
}

42
winVCR/VCRlogic/SMvcr.cs Normal file
View File

@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class SMvcr
{
private string _labelText;
private SMvcr _concreteState;
public string getLabelText()
{
return _labelText;
}
}
public class SMvcrStandBy : SMvcr
{
}
public class SMvcrPlay : SMvcr
{
}
public class SMvcrRewind : SMvcr
{
}
public class SMvcrFastForward : SMvcr
{
}
public class SMvcrRecord : SMvcr
{
}

View File

@ -0,0 +1,49 @@
<?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>{74F418C8-F030-41C7-BA8D-8A9B57253E45}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>VCRlogic</RootNamespace>
<AssemblyName>VCRlogic</AssemblyName>
<TargetFrameworkVersion>v4.7.2</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.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="SMtape.cs" />
<Compile Include="SMvcr.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -1,3 +1,18 @@
Public Class Class1
Public Class SMvcr{
0
End Class

View File

@ -5,7 +5,7 @@ VisualStudioVersion = 16.0.28729.10
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "winVCR", "winVCR\winVCR.csproj", "{AAA7DB8B-955C-4B17-8C2B-764CFC3702FF}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "VRClogic", "VRClogic\VRClogic.vbproj", "{8BE90BB5-540B-429E-85CE-7BD395F665FA}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VCRlogic", "VCRlogic\VCRlogic.csproj", "{74F418C8-F030-41C7-BA8D-8A9B57253E45}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -17,10 +17,10 @@ Global
{AAA7DB8B-955C-4B17-8C2B-764CFC3702FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AAA7DB8B-955C-4B17-8C2B-764CFC3702FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AAA7DB8B-955C-4B17-8C2B-764CFC3702FF}.Release|Any CPU.Build.0 = Release|Any CPU
{8BE90BB5-540B-429E-85CE-7BD395F665FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8BE90BB5-540B-429E-85CE-7BD395F665FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8BE90BB5-540B-429E-85CE-7BD395F665FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8BE90BB5-540B-429E-85CE-7BD395F665FA}.Release|Any CPU.Build.0 = Release|Any CPU
{74F418C8-F030-41C7-BA8D-8A9B57253E45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{74F418C8-F030-41C7-BA8D-8A9B57253E45}.Debug|Any CPU.Build.0 = Debug|Any CPU
{74F418C8-F030-41C7-BA8D-8A9B57253E45}.Release|Any CPU.ActiveCfg = Release|Any CPU
{74F418C8-F030-41C7-BA8D-8A9B57253E45}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -35,6 +35,8 @@
this.Rewind = new System.Windows.Forms.Button();
this.btnRecord = new System.Windows.Forms.Button();
this.statusLabel = new System.Windows.Forms.Label();
this.btnInsertTape = new System.Windows.Forms.Button();
this.btnEjectTape = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
@ -100,11 +102,33 @@
this.statusLabel.TabIndex = 5;
this.statusLabel.Text = "Status Label";
//
// btnInsertTape
//
this.btnInsertTape.Location = new System.Drawing.Point(201, 117);
this.btnInsertTape.Name = "btnInsertTape";
this.btnInsertTape.Size = new System.Drawing.Size(99, 44);
this.btnInsertTape.TabIndex = 6;
this.btnInsertTape.Text = "Insert Tape";
this.btnInsertTape.UseVisualStyleBackColor = true;
this.btnInsertTape.Click += new System.EventHandler(this.BtnInsertTape_Click);
//
// btnEjectTape
//
this.btnEjectTape.Location = new System.Drawing.Point(451, 117);
this.btnEjectTape.Name = "btnEjectTape";
this.btnEjectTape.Size = new System.Drawing.Size(99, 44);
this.btnEjectTape.TabIndex = 7;
this.btnEjectTape.Text = "Eject Tape";
this.btnEjectTape.UseVisualStyleBackColor = true;
this.btnEjectTape.Click += new System.EventHandler(this.BtnEjectTape_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.btnEjectTape);
this.Controls.Add(this.btnInsertTape);
this.Controls.Add(this.statusLabel);
this.Controls.Add(this.btnRecord);
this.Controls.Add(this.Rewind);
@ -128,6 +152,8 @@
private System.Windows.Forms.Button Rewind;
private System.Windows.Forms.Button btnRecord;
private System.Windows.Forms.Label statusLabel;
private System.Windows.Forms.Button btnInsertTape;
private System.Windows.Forms.Button btnEjectTape;
}
}

View File

@ -19,22 +19,28 @@ namespace winVCR
private void BtnPlay_Click(object sender, EventArgs e)
{
}
private void Rewind_Click(object sender, EventArgs e)
{
}
private void BtnRecord_Click(object sender, EventArgs e)
{
}
private void Power_Click(object sender, EventArgs e)
{
}
private void BtnInsertTape_Click(object sender, EventArgs e)
{
}
private void BtnEjectTape_Click(object sender, EventArgs e)
{
}
}
}
}

View File

@ -79,11 +79,5 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VRClogic\VRClogic.vbproj">
<Project>{8be90bb5-540b-429e-85ce-7bd395f665fa}</Project>
<Name>VRClogic</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>