From 029cc5d368121cf5e76cf2851440ddb896a78954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tommy=20=C3=96man?= Date: Wed, 9 Dec 2020 22:10:02 +0100 Subject: [PATCH] Add project files. --- WindowsFormsApp.sln | 31 + WindowsFormsCore/Domain/Connect.cs | 14 + WindowsFormsCore/Domain/LottoNum.cs | 14 + WindowsFormsCore/Form1.Designer.cs | 781 ++++++++++++++++++++ WindowsFormsCore/Form1.cs | 217 ++++++ WindowsFormsCore/Form1.resx | 231 ++++++ WindowsFormsCore/Operations/CryptoRandom.cs | 63 ++ WindowsFormsCore/Operations/Lotto.cs | 207 ++++++ WindowsFormsCore/Program.cs | 23 + WindowsFormsCore/WindowsFormsCore.csproj | 10 + WpfDemo/App.xaml | 9 + WpfDemo/App.xaml.cs | 17 + WpfDemo/AssemblyInfo.cs | 10 + WpfDemo/MainWindow.xaml | 31 + WpfDemo/MainWindow.xaml.cs | 28 + WpfDemo/Properties/launchSettings.json | 8 + WpfDemo/WpfDemo.csproj | 14 + 17 files changed, 1708 insertions(+) create mode 100644 WindowsFormsApp.sln create mode 100644 WindowsFormsCore/Domain/Connect.cs create mode 100644 WindowsFormsCore/Domain/LottoNum.cs create mode 100644 WindowsFormsCore/Form1.Designer.cs create mode 100644 WindowsFormsCore/Form1.cs create mode 100644 WindowsFormsCore/Form1.resx create mode 100644 WindowsFormsCore/Operations/CryptoRandom.cs create mode 100644 WindowsFormsCore/Operations/Lotto.cs create mode 100644 WindowsFormsCore/Program.cs create mode 100644 WindowsFormsCore/WindowsFormsCore.csproj create mode 100644 WpfDemo/App.xaml create mode 100644 WpfDemo/App.xaml.cs create mode 100644 WpfDemo/AssemblyInfo.cs create mode 100644 WpfDemo/MainWindow.xaml create mode 100644 WpfDemo/MainWindow.xaml.cs create mode 100644 WpfDemo/Properties/launchSettings.json create mode 100644 WpfDemo/WpfDemo.csproj diff --git a/WindowsFormsApp.sln b/WindowsFormsApp.sln new file mode 100644 index 0000000..821427e --- /dev/null +++ b/WindowsFormsApp.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30711.63 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WindowsFormsCore", "WindowsFormsCore\WindowsFormsCore.csproj", "{C7BE79EE-3712-4ED2-9250-E0AB484EF4DA}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfDemo", "WpfDemo\WpfDemo.csproj", "{D88DD430-19ED-469E-9351-F4BCD2F53AC9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C7BE79EE-3712-4ED2-9250-E0AB484EF4DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C7BE79EE-3712-4ED2-9250-E0AB484EF4DA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C7BE79EE-3712-4ED2-9250-E0AB484EF4DA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C7BE79EE-3712-4ED2-9250-E0AB484EF4DA}.Release|Any CPU.Build.0 = Release|Any CPU + {D88DD430-19ED-469E-9351-F4BCD2F53AC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D88DD430-19ED-469E-9351-F4BCD2F53AC9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D88DD430-19ED-469E-9351-F4BCD2F53AC9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D88DD430-19ED-469E-9351-F4BCD2F53AC9}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {0944E934-37A9-4888-B37B-8981D9785181} + EndGlobalSection +EndGlobal diff --git a/WindowsFormsCore/Domain/Connect.cs b/WindowsFormsCore/Domain/Connect.cs new file mode 100644 index 0000000..5e61117 --- /dev/null +++ b/WindowsFormsCore/Domain/Connect.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WindowsFormsCore.Domain +{ + public class Connect + { + public int PrimeNr { get; set; } + public int ActLottoNr { get; set; } + } +} diff --git a/WindowsFormsCore/Domain/LottoNum.cs b/WindowsFormsCore/Domain/LottoNum.cs new file mode 100644 index 0000000..aeacbdc --- /dev/null +++ b/WindowsFormsCore/Domain/LottoNum.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WindowsFormsCore.Domain +{ + public class LottoNum + { + public int ChoseNumber { get; set; } + public bool Valid { get; set; } + } +} diff --git a/WindowsFormsCore/Form1.Designer.cs b/WindowsFormsCore/Form1.Designer.cs new file mode 100644 index 0000000..32be8b9 --- /dev/null +++ b/WindowsFormsCore/Form1.Designer.cs @@ -0,0 +1,781 @@ + +namespace WindowsFormsCore +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.btnGenMotNr = new System.Windows.Forms.Button(); + this.btnGenerate = new System.Windows.Forms.Button(); + this.txtNr1 = new System.Windows.Forms.TextBox(); + this.txtNr2 = new System.Windows.Forms.TextBox(); + this.txtNr3 = new System.Windows.Forms.TextBox(); + this.txtNr4 = new System.Windows.Forms.TextBox(); + this.txtNr5 = new System.Windows.Forms.TextBox(); + this.txtNr6 = new System.Windows.Forms.TextBox(); + this.txtNr7 = new System.Windows.Forms.TextBox(); + this.txtNr27 = new System.Windows.Forms.TextBox(); + this.txtNr26 = new System.Windows.Forms.TextBox(); + this.txtNr25 = new System.Windows.Forms.TextBox(); + this.txtNr24 = new System.Windows.Forms.TextBox(); + this.txtNr23 = new System.Windows.Forms.TextBox(); + this.txtNr22 = new System.Windows.Forms.TextBox(); + this.txtNr21 = new System.Windows.Forms.TextBox(); + this.btnTest = new System.Windows.Forms.Button(); + this.txtTestIn = new System.Windows.Forms.TextBox(); + this.txtTestOut = new System.Windows.Forms.TextBox(); + this.lblIndicator = new System.Windows.Forms.Label(); + this.gpbInmata = new System.Windows.Forms.GroupBox(); + this.chk35 = new System.Windows.Forms.CheckBox(); + this.chk34 = new System.Windows.Forms.CheckBox(); + this.chk33 = new System.Windows.Forms.CheckBox(); + this.chk32 = new System.Windows.Forms.CheckBox(); + this.chk31 = new System.Windows.Forms.CheckBox(); + this.chk30 = new System.Windows.Forms.CheckBox(); + this.chk29 = new System.Windows.Forms.CheckBox(); + this.chk28 = new System.Windows.Forms.CheckBox(); + this.chk27 = new System.Windows.Forms.CheckBox(); + this.chk26 = new System.Windows.Forms.CheckBox(); + this.chk25 = new System.Windows.Forms.CheckBox(); + this.chk24 = new System.Windows.Forms.CheckBox(); + this.chk23 = new System.Windows.Forms.CheckBox(); + this.chk22 = new System.Windows.Forms.CheckBox(); + this.chk21 = new System.Windows.Forms.CheckBox(); + this.chk20 = new System.Windows.Forms.CheckBox(); + this.chk19 = new System.Windows.Forms.CheckBox(); + this.chk18 = new System.Windows.Forms.CheckBox(); + this.chk17 = new System.Windows.Forms.CheckBox(); + this.chk16 = new System.Windows.Forms.CheckBox(); + this.chk15 = new System.Windows.Forms.CheckBox(); + this.chk14 = new System.Windows.Forms.CheckBox(); + this.chk13 = new System.Windows.Forms.CheckBox(); + this.chk12 = new System.Windows.Forms.CheckBox(); + this.chk11 = new System.Windows.Forms.CheckBox(); + this.chk10 = new System.Windows.Forms.CheckBox(); + this.chk09 = new System.Windows.Forms.CheckBox(); + this.chk08 = new System.Windows.Forms.CheckBox(); + this.chk07 = new System.Windows.Forms.CheckBox(); + this.chk06 = new System.Windows.Forms.CheckBox(); + this.chk05 = new System.Windows.Forms.CheckBox(); + this.chk04 = new System.Windows.Forms.CheckBox(); + this.chk03 = new System.Windows.Forms.CheckBox(); + this.chk02 = new System.Windows.Forms.CheckBox(); + this.chk01 = new System.Windows.Forms.CheckBox(); + this.btnClear = new System.Windows.Forms.Button(); + this.gpbInmata.SuspendLayout(); + this.SuspendLayout(); + // + // btnGenMotNr + // + this.btnGenMotNr.Location = new System.Drawing.Point(46, 69); + this.btnGenMotNr.Name = "btnGenMotNr"; + this.btnGenMotNr.Size = new System.Drawing.Size(89, 23); + this.btnGenMotNr.TabIndex = 0; + this.btnGenMotNr.Text = "Gen_mot_Nr"; + this.btnGenMotNr.UseVisualStyleBackColor = true; + this.btnGenMotNr.Click += new System.EventHandler(this.btnGenMotNr_Click); + // + // btnGenerate + // + this.btnGenerate.Location = new System.Drawing.Point(46, 40); + this.btnGenerate.Name = "btnGenerate"; + this.btnGenerate.Size = new System.Drawing.Size(89, 23); + this.btnGenerate.TabIndex = 1; + this.btnGenerate.Text = "Gen_Number"; + this.btnGenerate.UseVisualStyleBackColor = true; + this.btnGenerate.Click += new System.EventHandler(this.btnGenerate_Click); + // + // txtNr1 + // + this.txtNr1.Location = new System.Drawing.Point(189, 41); + this.txtNr1.Name = "txtNr1"; + this.txtNr1.Size = new System.Drawing.Size(39, 23); + this.txtNr1.TabIndex = 2; + // + // txtNr2 + // + this.txtNr2.Location = new System.Drawing.Point(234, 41); + this.txtNr2.Name = "txtNr2"; + this.txtNr2.Size = new System.Drawing.Size(39, 23); + this.txtNr2.TabIndex = 3; + // + // txtNr3 + // + this.txtNr3.Location = new System.Drawing.Point(279, 41); + this.txtNr3.Name = "txtNr3"; + this.txtNr3.Size = new System.Drawing.Size(39, 23); + this.txtNr3.TabIndex = 4; + // + // txtNr4 + // + this.txtNr4.Location = new System.Drawing.Point(324, 41); + this.txtNr4.Name = "txtNr4"; + this.txtNr4.Size = new System.Drawing.Size(39, 23); + this.txtNr4.TabIndex = 5; + // + // txtNr5 + // + this.txtNr5.Location = new System.Drawing.Point(369, 40); + this.txtNr5.Name = "txtNr5"; + this.txtNr5.Size = new System.Drawing.Size(39, 23); + this.txtNr5.TabIndex = 6; + // + // txtNr6 + // + this.txtNr6.Location = new System.Drawing.Point(414, 41); + this.txtNr6.Name = "txtNr6"; + this.txtNr6.Size = new System.Drawing.Size(39, 23); + this.txtNr6.TabIndex = 7; + // + // txtNr7 + // + this.txtNr7.Location = new System.Drawing.Point(459, 40); + this.txtNr7.Name = "txtNr7"; + this.txtNr7.Size = new System.Drawing.Size(39, 23); + this.txtNr7.TabIndex = 8; + // + // txtNr27 + // + this.txtNr27.Location = new System.Drawing.Point(459, 69); + this.txtNr27.Name = "txtNr27"; + this.txtNr27.Size = new System.Drawing.Size(39, 23); + this.txtNr27.TabIndex = 15; + // + // txtNr26 + // + this.txtNr26.Location = new System.Drawing.Point(414, 70); + this.txtNr26.Name = "txtNr26"; + this.txtNr26.Size = new System.Drawing.Size(39, 23); + this.txtNr26.TabIndex = 14; + // + // txtNr25 + // + this.txtNr25.Location = new System.Drawing.Point(369, 69); + this.txtNr25.Name = "txtNr25"; + this.txtNr25.Size = new System.Drawing.Size(39, 23); + this.txtNr25.TabIndex = 13; + // + // txtNr24 + // + this.txtNr24.Location = new System.Drawing.Point(324, 70); + this.txtNr24.Name = "txtNr24"; + this.txtNr24.Size = new System.Drawing.Size(39, 23); + this.txtNr24.TabIndex = 12; + // + // txtNr23 + // + this.txtNr23.Location = new System.Drawing.Point(279, 70); + this.txtNr23.Name = "txtNr23"; + this.txtNr23.Size = new System.Drawing.Size(39, 23); + this.txtNr23.TabIndex = 11; + // + // txtNr22 + // + this.txtNr22.Location = new System.Drawing.Point(234, 70); + this.txtNr22.Name = "txtNr22"; + this.txtNr22.Size = new System.Drawing.Size(39, 23); + this.txtNr22.TabIndex = 10; + // + // txtNr21 + // + this.txtNr21.Location = new System.Drawing.Point(189, 70); + this.txtNr21.Name = "txtNr21"; + this.txtNr21.Size = new System.Drawing.Size(39, 23); + this.txtNr21.TabIndex = 9; + // + // btnTest + // + this.btnTest.Location = new System.Drawing.Point(12, 415); + this.btnTest.Name = "btnTest"; + this.btnTest.Size = new System.Drawing.Size(75, 23); + this.btnTest.TabIndex = 17; + this.btnTest.Text = "Test"; + this.btnTest.UseVisualStyleBackColor = true; + this.btnTest.Click += new System.EventHandler(this.btnTest_Click); + // + // txtTestIn + // + this.txtTestIn.Location = new System.Drawing.Point(13, 386); + this.txtTestIn.Name = "txtTestIn"; + this.txtTestIn.Size = new System.Drawing.Size(74, 23); + this.txtTestIn.TabIndex = 18; + // + // txtTestOut + // + this.txtTestOut.Location = new System.Drawing.Point(94, 415); + this.txtTestOut.Name = "txtTestOut"; + this.txtTestOut.Size = new System.Drawing.Size(528, 23); + this.txtTestOut.TabIndex = 19; + // + // lblIndicator + // + this.lblIndicator.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.lblIndicator.Location = new System.Drawing.Point(504, 69); + this.lblIndicator.Margin = new System.Windows.Forms.Padding(3, 4, 3, 0); + this.lblIndicator.Name = "lblIndicator"; + this.lblIndicator.Size = new System.Drawing.Size(39, 23); + this.lblIndicator.TabIndex = 20; + this.lblIndicator.Text = " "; + // + // gpbInmata + // + this.gpbInmata.Controls.Add(this.chk35); + this.gpbInmata.Controls.Add(this.chk34); + this.gpbInmata.Controls.Add(this.chk33); + this.gpbInmata.Controls.Add(this.chk32); + this.gpbInmata.Controls.Add(this.chk31); + this.gpbInmata.Controls.Add(this.chk30); + this.gpbInmata.Controls.Add(this.chk29); + this.gpbInmata.Controls.Add(this.chk28); + this.gpbInmata.Controls.Add(this.chk27); + this.gpbInmata.Controls.Add(this.chk26); + this.gpbInmata.Controls.Add(this.chk25); + this.gpbInmata.Controls.Add(this.chk24); + this.gpbInmata.Controls.Add(this.chk23); + this.gpbInmata.Controls.Add(this.chk22); + this.gpbInmata.Controls.Add(this.chk21); + this.gpbInmata.Controls.Add(this.chk20); + this.gpbInmata.Controls.Add(this.chk19); + this.gpbInmata.Controls.Add(this.chk18); + this.gpbInmata.Controls.Add(this.chk17); + this.gpbInmata.Controls.Add(this.chk16); + this.gpbInmata.Controls.Add(this.chk15); + this.gpbInmata.Controls.Add(this.chk14); + this.gpbInmata.Controls.Add(this.chk13); + this.gpbInmata.Controls.Add(this.chk12); + this.gpbInmata.Controls.Add(this.chk11); + this.gpbInmata.Controls.Add(this.chk10); + this.gpbInmata.Controls.Add(this.chk09); + this.gpbInmata.Controls.Add(this.chk08); + this.gpbInmata.Controls.Add(this.chk07); + this.gpbInmata.Controls.Add(this.chk06); + this.gpbInmata.Controls.Add(this.chk05); + this.gpbInmata.Controls.Add(this.chk04); + this.gpbInmata.Controls.Add(this.chk03); + this.gpbInmata.Controls.Add(this.chk02); + this.gpbInmata.Controls.Add(this.chk01); + this.gpbInmata.Location = new System.Drawing.Point(549, 26); + this.gpbInmata.Name = "gpbInmata"; + this.gpbInmata.Size = new System.Drawing.Size(196, 185); + this.gpbInmata.TabIndex = 21; + this.gpbInmata.TabStop = false; + this.gpbInmata.Text = "Inmatning"; + // + // chk35 + // + this.chk35.AutoSize = true; + this.chk35.Location = new System.Drawing.Point(155, 156); + this.chk35.Name = "chk35"; + this.chk35.Size = new System.Drawing.Size(38, 19); + this.chk35.TabIndex = 34; + this.chk35.Text = "35"; + this.chk35.UseVisualStyleBackColor = true; + this.chk35.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk34 + // + this.chk34.AutoSize = true; + this.chk34.Location = new System.Drawing.Point(117, 155); + this.chk34.Name = "chk34"; + this.chk34.Size = new System.Drawing.Size(38, 19); + this.chk34.TabIndex = 33; + this.chk34.Text = "34"; + this.chk34.UseVisualStyleBackColor = true; + this.chk34.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk33 + // + this.chk33.AutoSize = true; + this.chk33.Location = new System.Drawing.Point(79, 155); + this.chk33.Name = "chk33"; + this.chk33.Size = new System.Drawing.Size(38, 19); + this.chk33.TabIndex = 32; + this.chk33.Text = "33"; + this.chk33.UseVisualStyleBackColor = true; + this.chk33.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk32 + // + this.chk32.AutoSize = true; + this.chk32.Location = new System.Drawing.Point(41, 155); + this.chk32.Name = "chk32"; + this.chk32.Size = new System.Drawing.Size(38, 19); + this.chk32.TabIndex = 31; + this.chk32.Text = "32"; + this.chk32.UseVisualStyleBackColor = true; + this.chk32.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk31 + // + this.chk31.AutoSize = true; + this.chk31.Location = new System.Drawing.Point(6, 156); + this.chk31.Name = "chk31"; + this.chk31.Size = new System.Drawing.Size(38, 19); + this.chk31.TabIndex = 30; + this.chk31.Text = "31"; + this.chk31.UseVisualStyleBackColor = true; + this.chk31.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk30 + // + this.chk30.AutoSize = true; + this.chk30.Location = new System.Drawing.Point(155, 132); + this.chk30.Name = "chk30"; + this.chk30.Size = new System.Drawing.Size(38, 19); + this.chk30.TabIndex = 29; + this.chk30.Text = "30"; + this.chk30.UseVisualStyleBackColor = true; + this.chk30.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk29 + // + this.chk29.AutoSize = true; + this.chk29.Location = new System.Drawing.Point(117, 131); + this.chk29.Name = "chk29"; + this.chk29.Size = new System.Drawing.Size(38, 19); + this.chk29.TabIndex = 28; + this.chk29.Text = "29"; + this.chk29.UseVisualStyleBackColor = true; + this.chk29.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk28 + // + this.chk28.AutoSize = true; + this.chk28.Location = new System.Drawing.Point(79, 131); + this.chk28.Name = "chk28"; + this.chk28.Size = new System.Drawing.Size(38, 19); + this.chk28.TabIndex = 27; + this.chk28.Text = "28"; + this.chk28.UseVisualStyleBackColor = true; + this.chk28.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk27 + // + this.chk27.AutoSize = true; + this.chk27.Location = new System.Drawing.Point(41, 131); + this.chk27.Name = "chk27"; + this.chk27.Size = new System.Drawing.Size(38, 19); + this.chk27.TabIndex = 26; + this.chk27.Text = "27"; + this.chk27.UseVisualStyleBackColor = true; + this.chk27.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk26 + // + this.chk26.AutoSize = true; + this.chk26.Location = new System.Drawing.Point(6, 132); + this.chk26.Name = "chk26"; + this.chk26.Size = new System.Drawing.Size(38, 19); + this.chk26.TabIndex = 25; + this.chk26.Text = "26"; + this.chk26.UseVisualStyleBackColor = true; + this.chk26.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk25 + // + this.chk25.AutoSize = true; + this.chk25.Location = new System.Drawing.Point(155, 108); + this.chk25.Name = "chk25"; + this.chk25.Size = new System.Drawing.Size(38, 19); + this.chk25.TabIndex = 24; + this.chk25.Text = "25"; + this.chk25.UseVisualStyleBackColor = true; + this.chk25.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk24 + // + this.chk24.AutoSize = true; + this.chk24.Location = new System.Drawing.Point(117, 107); + this.chk24.Name = "chk24"; + this.chk24.Size = new System.Drawing.Size(38, 19); + this.chk24.TabIndex = 23; + this.chk24.Text = "24"; + this.chk24.UseVisualStyleBackColor = true; + this.chk24.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk23 + // + this.chk23.AutoSize = true; + this.chk23.Location = new System.Drawing.Point(79, 107); + this.chk23.Name = "chk23"; + this.chk23.Size = new System.Drawing.Size(38, 19); + this.chk23.TabIndex = 22; + this.chk23.Text = "23"; + this.chk23.UseVisualStyleBackColor = true; + this.chk23.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk22 + // + this.chk22.AutoSize = true; + this.chk22.Location = new System.Drawing.Point(41, 107); + this.chk22.Name = "chk22"; + this.chk22.Size = new System.Drawing.Size(38, 19); + this.chk22.TabIndex = 21; + this.chk22.Text = "22"; + this.chk22.UseVisualStyleBackColor = true; + this.chk22.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk21 + // + this.chk21.AutoSize = true; + this.chk21.Location = new System.Drawing.Point(6, 108); + this.chk21.Name = "chk21"; + this.chk21.Size = new System.Drawing.Size(38, 19); + this.chk21.TabIndex = 20; + this.chk21.Text = "21"; + this.chk21.UseVisualStyleBackColor = true; + this.chk21.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk20 + // + this.chk20.AutoSize = true; + this.chk20.Location = new System.Drawing.Point(155, 87); + this.chk20.Name = "chk20"; + this.chk20.Size = new System.Drawing.Size(38, 19); + this.chk20.TabIndex = 19; + this.chk20.Text = "20"; + this.chk20.UseVisualStyleBackColor = true; + this.chk20.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk19 + // + this.chk19.AutoSize = true; + this.chk19.Location = new System.Drawing.Point(117, 86); + this.chk19.Name = "chk19"; + this.chk19.Size = new System.Drawing.Size(38, 19); + this.chk19.TabIndex = 18; + this.chk19.Text = "19"; + this.chk19.UseVisualStyleBackColor = true; + this.chk19.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk18 + // + this.chk18.AutoSize = true; + this.chk18.Location = new System.Drawing.Point(79, 86); + this.chk18.Name = "chk18"; + this.chk18.Size = new System.Drawing.Size(38, 19); + this.chk18.TabIndex = 17; + this.chk18.Text = "18"; + this.chk18.UseVisualStyleBackColor = true; + this.chk18.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk17 + // + this.chk17.AutoSize = true; + this.chk17.Location = new System.Drawing.Point(41, 86); + this.chk17.Name = "chk17"; + this.chk17.Size = new System.Drawing.Size(38, 19); + this.chk17.TabIndex = 16; + this.chk17.Text = "17"; + this.chk17.UseVisualStyleBackColor = true; + this.chk17.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk16 + // + this.chk16.AutoSize = true; + this.chk16.Location = new System.Drawing.Point(6, 87); + this.chk16.Name = "chk16"; + this.chk16.Size = new System.Drawing.Size(38, 19); + this.chk16.TabIndex = 15; + this.chk16.Text = "16"; + this.chk16.UseVisualStyleBackColor = true; + this.chk16.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk15 + // + this.chk15.AutoSize = true; + this.chk15.Location = new System.Drawing.Point(155, 63); + this.chk15.Name = "chk15"; + this.chk15.Size = new System.Drawing.Size(38, 19); + this.chk15.TabIndex = 14; + this.chk15.Text = "15"; + this.chk15.UseVisualStyleBackColor = true; + this.chk15.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk14 + // + this.chk14.AutoSize = true; + this.chk14.Location = new System.Drawing.Point(117, 62); + this.chk14.Name = "chk14"; + this.chk14.Size = new System.Drawing.Size(38, 19); + this.chk14.TabIndex = 13; + this.chk14.Text = "14"; + this.chk14.UseVisualStyleBackColor = true; + this.chk14.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk13 + // + this.chk13.AutoSize = true; + this.chk13.Location = new System.Drawing.Point(79, 62); + this.chk13.Name = "chk13"; + this.chk13.Size = new System.Drawing.Size(38, 19); + this.chk13.TabIndex = 12; + this.chk13.Text = "13"; + this.chk13.UseVisualStyleBackColor = true; + this.chk13.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk12 + // + this.chk12.AutoSize = true; + this.chk12.Location = new System.Drawing.Point(41, 62); + this.chk12.Name = "chk12"; + this.chk12.Size = new System.Drawing.Size(38, 19); + this.chk12.TabIndex = 11; + this.chk12.Text = "12"; + this.chk12.UseVisualStyleBackColor = true; + this.chk12.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk11 + // + this.chk11.AutoSize = true; + this.chk11.Location = new System.Drawing.Point(6, 63); + this.chk11.Name = "chk11"; + this.chk11.Size = new System.Drawing.Size(38, 19); + this.chk11.TabIndex = 10; + this.chk11.Text = "11"; + this.chk11.UseVisualStyleBackColor = true; + this.chk11.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk10 + // + this.chk10.AutoSize = true; + this.chk10.Location = new System.Drawing.Point(155, 39); + this.chk10.Name = "chk10"; + this.chk10.Size = new System.Drawing.Size(38, 19); + this.chk10.TabIndex = 9; + this.chk10.Text = "10"; + this.chk10.UseVisualStyleBackColor = true; + this.chk10.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk09 + // + this.chk09.AutoSize = true; + this.chk09.Location = new System.Drawing.Point(117, 38); + this.chk09.Name = "chk09"; + this.chk09.Size = new System.Drawing.Size(32, 19); + this.chk09.TabIndex = 8; + this.chk09.Text = "9"; + this.chk09.UseVisualStyleBackColor = true; + this.chk09.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk08 + // + this.chk08.AutoSize = true; + this.chk08.Location = new System.Drawing.Point(79, 38); + this.chk08.Name = "chk08"; + this.chk08.Size = new System.Drawing.Size(32, 19); + this.chk08.TabIndex = 7; + this.chk08.Text = "8"; + this.chk08.UseVisualStyleBackColor = true; + this.chk08.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk07 + // + this.chk07.AutoSize = true; + this.chk07.Location = new System.Drawing.Point(41, 38); + this.chk07.Name = "chk07"; + this.chk07.Size = new System.Drawing.Size(32, 19); + this.chk07.TabIndex = 6; + this.chk07.Text = "7"; + this.chk07.UseVisualStyleBackColor = true; + this.chk07.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk06 + // + this.chk06.AutoSize = true; + this.chk06.Location = new System.Drawing.Point(6, 39); + this.chk06.Name = "chk06"; + this.chk06.Size = new System.Drawing.Size(32, 19); + this.chk06.TabIndex = 5; + this.chk06.Text = "6"; + this.chk06.UseVisualStyleBackColor = true; + this.chk06.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk05 + // + this.chk05.AutoSize = true; + this.chk05.Location = new System.Drawing.Point(155, 15); + this.chk05.Name = "chk05"; + this.chk05.Size = new System.Drawing.Size(32, 19); + this.chk05.TabIndex = 4; + this.chk05.Text = "5"; + this.chk05.UseVisualStyleBackColor = true; + this.chk05.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk04 + // + this.chk04.AutoSize = true; + this.chk04.Location = new System.Drawing.Point(117, 14); + this.chk04.Name = "chk04"; + this.chk04.Size = new System.Drawing.Size(32, 19); + this.chk04.TabIndex = 3; + this.chk04.Text = "4"; + this.chk04.UseVisualStyleBackColor = true; + this.chk04.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk03 + // + this.chk03.AutoSize = true; + this.chk03.Location = new System.Drawing.Point(79, 14); + this.chk03.Name = "chk03"; + this.chk03.Size = new System.Drawing.Size(32, 19); + this.chk03.TabIndex = 2; + this.chk03.Text = "3"; + this.chk03.UseVisualStyleBackColor = true; + this.chk03.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk02 + // + this.chk02.AutoSize = true; + this.chk02.Location = new System.Drawing.Point(41, 14); + this.chk02.Name = "chk02"; + this.chk02.Size = new System.Drawing.Size(32, 19); + this.chk02.TabIndex = 1; + this.chk02.Text = "2"; + this.chk02.UseVisualStyleBackColor = true; + this.chk02.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // chk01 + // + this.chk01.AutoSize = true; + this.chk01.Location = new System.Drawing.Point(6, 15); + this.chk01.Name = "chk01"; + this.chk01.Size = new System.Drawing.Size(32, 19); + this.chk01.TabIndex = 0; + this.chk01.Text = "1"; + this.chk01.UseVisualStyleBackColor = true; + this.chk01.CheckedChanged += new System.EventHandler(this.chk_CheckedChanged); + // + // btnClear + // + this.btnClear.Location = new System.Drawing.Point(555, 218); + this.btnClear.Name = "btnClear"; + this.btnClear.Size = new System.Drawing.Size(75, 23); + this.btnClear.TabIndex = 22; + this.btnClear.Text = "Rensa"; + this.btnClear.UseVisualStyleBackColor = true; + this.btnClear.Click += new System.EventHandler(this.btnClear_Click); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.btnClear); + this.Controls.Add(this.gpbInmata); + this.Controls.Add(this.lblIndicator); + this.Controls.Add(this.txtTestOut); + this.Controls.Add(this.txtTestIn); + this.Controls.Add(this.btnTest); + this.Controls.Add(this.txtNr27); + this.Controls.Add(this.txtNr26); + this.Controls.Add(this.txtNr25); + this.Controls.Add(this.txtNr24); + this.Controls.Add(this.txtNr23); + this.Controls.Add(this.txtNr22); + this.Controls.Add(this.txtNr21); + this.Controls.Add(this.txtNr7); + this.Controls.Add(this.txtNr6); + this.Controls.Add(this.txtNr5); + this.Controls.Add(this.txtNr4); + this.Controls.Add(this.txtNr3); + this.Controls.Add(this.txtNr2); + this.Controls.Add(this.txtNr1); + this.Controls.Add(this.btnGenerate); + this.Controls.Add(this.btnGenMotNr); + this.Name = "Form1"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Form1"; + this.gpbInmata.ResumeLayout(false); + this.gpbInmata.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button btnGenMotNr; + private System.Windows.Forms.Button btnGenerate; + private System.Windows.Forms.TextBox txtNr1; + private System.Windows.Forms.TextBox txtNr2; + private System.Windows.Forms.TextBox txtNr3; + private System.Windows.Forms.TextBox txtNr4; + private System.Windows.Forms.TextBox txtNr5; + private System.Windows.Forms.TextBox txtNr6; + private System.Windows.Forms.TextBox txtNr7; + private System.Windows.Forms.TextBox txtNr27; + private System.Windows.Forms.TextBox txtNr26; + private System.Windows.Forms.TextBox txtNr25; + private System.Windows.Forms.TextBox txtNr24; + private System.Windows.Forms.TextBox txtNr23; + private System.Windows.Forms.TextBox txtNr22; + private System.Windows.Forms.TextBox txtNr21; + private System.Windows.Forms.Button btnTest; + private System.Windows.Forms.TextBox txtTestIn; + private System.Windows.Forms.TextBox txtTestOut; + private System.Windows.Forms.Label lblIndicator; + private System.Windows.Forms.GroupBox gpbInmata; + private System.Windows.Forms.CheckBox chk35; + private System.Windows.Forms.CheckBox chk34; + private System.Windows.Forms.CheckBox chk33; + private System.Windows.Forms.CheckBox chk32; + private System.Windows.Forms.CheckBox chk31; + private System.Windows.Forms.CheckBox chk30; + private System.Windows.Forms.CheckBox chk29; + private System.Windows.Forms.CheckBox chk28; + private System.Windows.Forms.CheckBox chk27; + private System.Windows.Forms.CheckBox chk26; + private System.Windows.Forms.CheckBox chk25; + private System.Windows.Forms.CheckBox chk24; + private System.Windows.Forms.CheckBox chk23; + private System.Windows.Forms.CheckBox chk22; + private System.Windows.Forms.CheckBox chk21; + private System.Windows.Forms.CheckBox chk20; + private System.Windows.Forms.CheckBox chk19; + private System.Windows.Forms.CheckBox chk18; + private System.Windows.Forms.CheckBox chk17; + private System.Windows.Forms.CheckBox chk16; + private System.Windows.Forms.CheckBox chk15; + private System.Windows.Forms.CheckBox chk14; + private System.Windows.Forms.CheckBox chk13; + private System.Windows.Forms.CheckBox chk12; + private System.Windows.Forms.CheckBox chk11; + private System.Windows.Forms.CheckBox chk10; + private System.Windows.Forms.CheckBox chk09; + private System.Windows.Forms.CheckBox chk08; + private System.Windows.Forms.CheckBox chk07; + private System.Windows.Forms.CheckBox chk06; + private System.Windows.Forms.CheckBox chk05; + private System.Windows.Forms.CheckBox chk04; + private System.Windows.Forms.CheckBox chk03; + private System.Windows.Forms.CheckBox chk02; + private System.Windows.Forms.CheckBox chk01; + private System.Windows.Forms.Button btnClear; + } +} + diff --git a/WindowsFormsCore/Form1.cs b/WindowsFormsCore/Form1.cs new file mode 100644 index 0000000..bef7404 --- /dev/null +++ b/WindowsFormsCore/Form1.cs @@ -0,0 +1,217 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Diagnostics; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using WindowsFormsCore.Operations; + +namespace WindowsFormsCore +{ + public enum LNum + { + x1 = 1, + x2 = 2, + x3 = 3, + x4 = 4, + x5 = 5, + x6 = 6, + x7 = 7, + x8 = 8, + x9 = 9, + x10 = 10, + x11 = 11, + x12 = 12, + x13 = 13, + x14 = 14, + x15 = 15, + x16 = 16, + x17 = 17, + x18 = 18, + x19 = 19, + x20 = 20, + x21 = 21, + x22 = 22, + x23 = 23, + x24 = 24, + x25 = 25, + x26 = 26, + x27 = 27, + x28 = 28, + x29 = 29, + x30 = 30, + x31 = 31, + x32 = 32, + x33 = 33, + x34 = 34, + x35 = 35 + } + public partial class Form1 : Form + { + + Random rnd = new CryptoRandom(DateTime.Now.DayOfYear); + private Lotto lotto; + private List clicked; + private byte numClicks = 0; + private bool clearing; + + public Form1() + { + InitializeComponent(); + lotto = new Lotto(rnd); + ClearChks(); + } + + private void btnGenerate_Click(object sender, EventArgs e) + { + + var ansver = lotto.RandomRad(); + txtNr1.Text = ansver[0]; + txtNr2.Text = ansver[1]; + txtNr3.Text = ansver[2]; + txtNr4.Text = ansver[3]; + txtNr5.Text = ansver[4]; + txtNr6.Text = ansver[5]; + txtNr7.Text = ansver[6]; + } + + private string randomNum() + { + return Enum.GetName(typeof(LNum), rnd.Next((int)LNum.x1, (int)LNum.x35)); + } + + private void btnGenMotNr_Click(object sender, EventArgs e) + { + lblIndicator.BackColor = SystemColors.Control; + lblIndicator.Text = " "; + List jmfList = new List(); + txtNr21.Text = string.IsNullOrEmpty(txtNr1.Text) ? "" : lotto.AntiCircularValue(int.Parse(txtNr1.Text)).ToString(); + jmfList.Add(txtNr21.Text); + txtNr22.Text = string.IsNullOrEmpty(txtNr2.Text) ? "" : lotto.AntiCircularValue(int.Parse(txtNr2.Text)).ToString(); + jmfList.Add(txtNr22.Text); + txtNr23.Text = string.IsNullOrEmpty(txtNr3.Text) ? "" : lotto.AntiCircularValue(int.Parse(txtNr3.Text)).ToString(); + jmfList.Add(txtNr23.Text); + txtNr24.Text = string.IsNullOrEmpty(txtNr4.Text) ? "" : lotto.AntiCircularValue(int.Parse(txtNr4.Text)).ToString(); + jmfList.Add(txtNr24.Text); + txtNr25.Text = string.IsNullOrEmpty(txtNr5.Text) ? "" : lotto.AntiCircularValue(int.Parse(txtNr5.Text)).ToString(); + jmfList.Add(txtNr25.Text); + txtNr26.Text = string.IsNullOrEmpty(txtNr6.Text) ? "" : lotto.AntiCircularValue(int.Parse(txtNr6.Text)).ToString(); + jmfList.Add(txtNr26.Text); + txtNr27.Text = string.IsNullOrEmpty(txtNr7.Text) ? "" : lotto.AntiCircularValue(int.Parse(txtNr7.Text)).ToString(); + jmfList.Add(txtNr27.Text); + + jmfList.Sort(); + var prev = string.Empty; + foreach (var str in jmfList) + { + if (str == prev) + { + lblIndicator.BackColor = Color.Red; + lblIndicator.Text = str; + break; + } + prev = str; + } + + } + + private void btnTest_Click(object sender, EventArgs e) + { + var tstIn = decimal.Parse(txtTestIn.Text); + txtTestOut.Text = $"number for angle {tstIn} = {lotto.GetNumberByAngle(tstIn)}"; + } + + private void chk_CheckedChanged(object sender, EventArgs e) + { + if (!clearing) + { + var clickTxt = ((CheckBox)sender).Text; + + if (clicked.Any(c => c == clickTxt)) + { + + clicked.Remove(clickTxt); + clicked.ToList().ForEach(x => Debug.Write($"{x},")); + Debug.WriteLine(""); + } + else + { + clicked.Add(clickTxt); + } + + if (clicked.Count() > 6) + { + + + for (int i = 0; i < 7; i++) + { + switch (i + 1) + { + case 1: + { + txtNr1.Text = clicked[i]; + break; + } + case 2: + { + txtNr2.Text = clicked[i]; + break; + } + case 3: + { + txtNr3.Text = clicked[i]; + break; + } + case 4: + { + txtNr4.Text = clicked[i]; + break; + } + case 5: + { + txtNr5.Text = clicked[i]; + break; + } + case 6: + { + txtNr6.Text = clicked[i]; + break; + } + case 7: + { + txtNr7.Text = clicked[i]; + break; + } + } + } + ClearChks(); + } + } + } + + private void ClearChks() + { + clearing = true; + foreach (var chk in gpbInmata.Controls) + { + if (chk.GetType() == typeof(CheckBox)) + { + ((CheckBox)chk).Checked = false; + } + } + clicked = new List(); + numClicks = 0; + clearing = false; + } + + private void btnClear_Click(object sender, EventArgs e) + { + ClearChks(); + gpbInmata.Refresh(); + } + } +} diff --git a/WindowsFormsCore/Form1.resx b/WindowsFormsCore/Form1.resx new file mode 100644 index 0000000..8b80193 --- /dev/null +++ b/WindowsFormsCore/Form1.resx @@ -0,0 +1,231 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/WindowsFormsCore/Operations/CryptoRandom.cs b/WindowsFormsCore/Operations/CryptoRandom.cs new file mode 100644 index 0000000..40c931c --- /dev/null +++ b/WindowsFormsCore/Operations/CryptoRandom.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography; +using System.Text; +using System.Threading.Tasks; + +namespace WindowsFormsCore.Operations +{ + public class CryptoRandom : Random + { + private RNGCryptoServiceProvider _rng = new RNGCryptoServiceProvider(); + private byte[] _uint32Buffer = new byte[4]; + + public CryptoRandom() { } + public CryptoRandom(Int32 ignoredSeed) { } + + public override Int32 Next() + { + _rng.GetBytes(_uint32Buffer); + return BitConverter.ToInt32(_uint32Buffer, 0) & 0x7FFFFFFF; + } + + public override Int32 Next(Int32 maxValue) + { + if (maxValue < 0) throw new ArgumentOutOfRangeException("maxValue"); + return Next(0, maxValue); + } + + public override Int32 Next(Int32 minValue, Int32 maxValue) + { + if (minValue > maxValue) throw new ArgumentOutOfRangeException("minValue"); + if (minValue == maxValue) return minValue; + Int64 diff = maxValue - minValue; + + while (true) + { + _rng.GetBytes(_uint32Buffer); + UInt32 rand = BitConverter.ToUInt32(_uint32Buffer, 0); + + Int64 max = (1 + (Int64)UInt32.MaxValue); + Int64 remainder = max % diff; + if (rand < max - remainder) + { + return (Int32)(minValue + (rand % diff)); + } + } + } + + public override double NextDouble() + { + _rng.GetBytes(_uint32Buffer); + UInt32 rand = BitConverter.ToUInt32(_uint32Buffer, 0); + return rand / (1.0 + UInt32.MaxValue); + } + + public override void NextBytes(byte[] buffer) + { + if (buffer == null) throw new ArgumentNullException("buffer"); + _rng.GetBytes(buffer); + } + } +} diff --git a/WindowsFormsCore/Operations/Lotto.cs b/WindowsFormsCore/Operations/Lotto.cs new file mode 100644 index 0000000..5bf9fda --- /dev/null +++ b/WindowsFormsCore/Operations/Lotto.cs @@ -0,0 +1,207 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Security.Cryptography; +using System.Text; +using System.Threading.Tasks; +using WindowsFormsCore.Domain; + +namespace WindowsFormsCore +{ + public class Lotto + { + + private List numberBack; + private List numberDraw; + + #region Constants + const decimal l00 = 0M; + const decimal l01 = 10.286M; + const decimal l02 = 20.572M; + const decimal l03 = 30.858M; + const decimal l04 = 41.144M; + const decimal l05 = 51.430M; + const decimal l06 = 61.716M; + const decimal l07 = 72.002M; + const decimal l08 = 82.288M; + const decimal l09 = 92.574M; + const decimal l10 = 102.860M; + const decimal l11 = 113.146M; + const decimal l12 = 123.432M; + const decimal l13 = 133.718M; + const decimal l14 = 144.004M; + const decimal l15 = 154.290M; + const decimal l16 = 164.576M; + const decimal l17 = 174.862M; + const decimal l18 = 185.148M; + const decimal l19 = 195.434M; + const decimal l20 = 205.720M; + const decimal l21 = 216.006M; + const decimal l22 = 226.292M; + const decimal l23 = 236.578M; + const decimal l24 = 246.864M; + const decimal l25 = 257.150M; + const decimal l26 = 267.436M; + const decimal l27 = 277.722M; + const decimal l28 = 288.008M; + const decimal l29 = 298.294M; + const decimal l30 = 308.580M; + const decimal l31 = 318.866M; + const decimal l32 = 329.152M; + const decimal l33 = 339.432M; + const decimal l34 = 349.721M; + const decimal l35 = 360.000M; + #endregion + + public Lotto(Random rnd) + { + InitLottoTables(); + Rnd = rnd; + + } + + private Random Rnd; + + public string[] RandomRad() + { + if (numberDraw.Count < numberBack.Count) + { + InitLottoTables(); + } + + var numberTable = new string[7]; + for (int i = 0; i < 7; i++) + { + numberTable[i] = DrawNewNumber(); + } + + return numberTable; + + } + + private string DrawNewNumber() + { + var number = RndFix(numberDraw.Min(x => x.PrimeNr), numberDraw.Max(x => x.PrimeNr)); + var drawn = numberDraw.Find(n => n.PrimeNr == number).ActLottoNr; + numberBack.Find(b => b.ChoseNumber == drawn).Valid = false; + var remobj = numberDraw.Find(n => n.PrimeNr == number); + numberDraw.Remove(remobj); + var newNr = 1; + for (int x = 0; x < numberDraw.Count; x++) + { + numberDraw[x].PrimeNr = newNr++; + } + return drawn.ToString(); + } + + private int RndFix(int min, int max) + { + return Rnd.Next(min, max); + } + + private void InitLottoTables() + { + numberBack = GenerateBaseTable(); + numberDraw = GenerateDrawTable(); + } + + private List GenerateBaseTable() + { + var lottos = new List(); + for (int i = 0; i < 35; i++) + { + lottos.Add(new LottoNum { ChoseNumber = i + 1, Valid = true }); + } + return lottos; + } + + private List GenerateDrawTable() + { + var lottos = new List(); + for (int i = 0; i < 35; i++) + { + lottos.Add(new Connect { PrimeNr = i + 1, ActLottoNr = i + 1 }); + } + return lottos; + } + + public int AntiCircularValue( int actValue) + { + var output = 0; + + decimal angleValue = GetNumberAngle(actValue); + + + output = GetNumberByAngle(angleValue + 180M); + + return output; + } + + public int GetNumberByAngle(decimal angle) + { + var result = 0; + decimal lAngle = angle; + + while (result <= 0 || result == 99) + { + result = lAngle switch + { + < l00 => -1, + >= l00 and <= l01 => 1, + > l01 and <= l02 => 2, + > l02 and <= l03 => 3, + > l03 and <= l04 => 4, + > l04 and <= l05 => 5, + > l05 and <= l06 => 6, + > l06 and <= l07 => 7, + > l07 and <= l08 => 8, + > l08 and <= l09 => 9, + > l09 and <= l10 => 10, + > l10 and <= l11 => 11, + > l11 and <= l12 => 12, + > l12 and <= l13 => 13, + > l13 and <= l14 => 14, + > l14 and <= l15 => 15, + > l15 and <= l16 => 16, + > l16 and <= l17 => 17, + > l17 and <= l18 => 18, + > l18 and <= l19 => 19, + > l19 and <= l20 => 20, + > l20 and <= l21 => 21, + > l21 and <= l22 => 22, + > l22 and <= l23 => 23, + > l23 and <= l24 => 24, + > l24 and <= l25 => 25, + > l25 and <= l26 => 26, + > l26 and <= l27 => 27, + > l27 and <= l28 => 28, + > l28 and <= l29 => 29, + > l29 and <= l30 => 30, + > l30 and <= l31 => 31, + > l31 and <= l32 => 32, + > l32 and <= l33 => 33, + > l33 and <= l34 => 34, + > l34 and <= l35 => 35, + _ => 99 + }; + if (result == -1) lAngle += 360; + if (result == 99) lAngle -= 360; + }; + + return result; + } + + public decimal GetNumberAngle(int LtNumber) + { + decimal res = 0; + + double nrSect = 360d / 35d; + double angle = 2 + (LtNumber - 1) * nrSect; + res = (decimal)angle; + return res; + } + + } + +} diff --git a/WindowsFormsCore/Program.cs b/WindowsFormsCore/Program.cs new file mode 100644 index 0000000..ac60464 --- /dev/null +++ b/WindowsFormsCore/Program.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WindowsFormsCore +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.SetHighDpiMode(HighDpiMode.SystemAware); + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/WindowsFormsCore/WindowsFormsCore.csproj b/WindowsFormsCore/WindowsFormsCore.csproj new file mode 100644 index 0000000..b4b5236 --- /dev/null +++ b/WindowsFormsCore/WindowsFormsCore.csproj @@ -0,0 +1,10 @@ + + + + WinExe + net5.0-windows + true + WindowsFormsCore.Program + + + \ No newline at end of file diff --git a/WpfDemo/App.xaml b/WpfDemo/App.xaml new file mode 100644 index 0000000..612c5a3 --- /dev/null +++ b/WpfDemo/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/WpfDemo/App.xaml.cs b/WpfDemo/App.xaml.cs new file mode 100644 index 0000000..e6fbebf --- /dev/null +++ b/WpfDemo/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace WpfDemo +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/WpfDemo/AssemblyInfo.cs b/WpfDemo/AssemblyInfo.cs new file mode 100644 index 0000000..8b5504e --- /dev/null +++ b/WpfDemo/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/WpfDemo/MainWindow.xaml b/WpfDemo/MainWindow.xaml new file mode 100644 index 0000000..374d373 --- /dev/null +++ b/WpfDemo/MainWindow.xaml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WpfDemo/MainWindow.xaml.cs b/WpfDemo/MainWindow.xaml.cs new file mode 100644 index 0000000..8c9438f --- /dev/null +++ b/WpfDemo/MainWindow.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace WpfDemo +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + } + } +} diff --git a/WpfDemo/Properties/launchSettings.json b/WpfDemo/Properties/launchSettings.json new file mode 100644 index 0000000..2d3a4a0 --- /dev/null +++ b/WpfDemo/Properties/launchSettings.json @@ -0,0 +1,8 @@ +{ + "profiles": { + "WpfDemo": { + "commandName": "Project", + "remoteDebugEnabled": false + } + } +} \ No newline at end of file diff --git a/WpfDemo/WpfDemo.csproj b/WpfDemo/WpfDemo.csproj new file mode 100644 index 0000000..562e7c3 --- /dev/null +++ b/WpfDemo/WpfDemo.csproj @@ -0,0 +1,14 @@ + + + + WinExe + net5.0-windows + true + + + + false + false + + +