From 222e4d956f485174e9ed87aae5d2d3dd4e4a5973 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Fri, 19 Feb 2021 20:50:49 +0200 Subject: Added the two most recent VB.Net projects - MaxMin and catalog --- Visual Basic Projects/MaxMin/MaxMin.sln | 25 +++ .../MaxMin/MaxMin/ApplicationEvents.vb | 22 +++ .../MaxMin/MaxMin/Form1.Designer.vb | 177 +++++++++++++++++++++ Visual Basic Projects/MaxMin/MaxMin/Form1.resx | 60 +++++++ Visual Basic Projects/MaxMin/MaxMin/Form1.vb | 59 +++++++ Visual Basic Projects/MaxMin/MaxMin/MaxMin.vbproj | 33 ++++ .../MaxMin/MaxMin/MaxMin.vbproj.user | 8 + .../My Project/Application.Designer.HighDpi.vb | 69 ++++++++ .../MaxMin/My Project/Application.Designer.vb | 38 +++++ .../MaxMin/MaxMin/My Project/Application.myapp | 10 ++ Visual Basic Projects/catalog/catalog.sln | 25 +++ .../catalog/catalog/ApplicationEvents.vb | 22 +++ .../catalog/catalog/Form1.Designer.vb | 146 +++++++++++++++++ Visual Basic Projects/catalog/catalog/Form1.resx | 60 +++++++ Visual Basic Projects/catalog/catalog/Form1.vb | 65 ++++++++ .../My Project/Application.Designer.HighDpi.vb | 69 ++++++++ .../catalog/My Project/Application.Designer.vb | 38 +++++ .../catalog/catalog/My Project/Application.myapp | 10 ++ .../catalog/catalog/catalog.vbproj | 33 ++++ .../catalog/catalog/catalog.vbproj.user | 8 + 20 files changed, 977 insertions(+) create mode 100644 Visual Basic Projects/MaxMin/MaxMin.sln create mode 100644 Visual Basic Projects/MaxMin/MaxMin/ApplicationEvents.vb create mode 100644 Visual Basic Projects/MaxMin/MaxMin/Form1.Designer.vb create mode 100644 Visual Basic Projects/MaxMin/MaxMin/Form1.resx create mode 100644 Visual Basic Projects/MaxMin/MaxMin/Form1.vb create mode 100644 Visual Basic Projects/MaxMin/MaxMin/MaxMin.vbproj create mode 100644 Visual Basic Projects/MaxMin/MaxMin/MaxMin.vbproj.user create mode 100644 Visual Basic Projects/MaxMin/MaxMin/My Project/Application.Designer.HighDpi.vb create mode 100644 Visual Basic Projects/MaxMin/MaxMin/My Project/Application.Designer.vb create mode 100644 Visual Basic Projects/MaxMin/MaxMin/My Project/Application.myapp create mode 100644 Visual Basic Projects/catalog/catalog.sln create mode 100644 Visual Basic Projects/catalog/catalog/ApplicationEvents.vb create mode 100644 Visual Basic Projects/catalog/catalog/Form1.Designer.vb create mode 100644 Visual Basic Projects/catalog/catalog/Form1.resx create mode 100644 Visual Basic Projects/catalog/catalog/Form1.vb create mode 100644 Visual Basic Projects/catalog/catalog/My Project/Application.Designer.HighDpi.vb create mode 100644 Visual Basic Projects/catalog/catalog/My Project/Application.Designer.vb create mode 100644 Visual Basic Projects/catalog/catalog/My Project/Application.myapp create mode 100644 Visual Basic Projects/catalog/catalog/catalog.vbproj create mode 100644 Visual Basic Projects/catalog/catalog/catalog.vbproj.user diff --git a/Visual Basic Projects/MaxMin/MaxMin.sln b/Visual Basic Projects/MaxMin/MaxMin.sln new file mode 100644 index 0000000..ea19ec3 --- /dev/null +++ b/Visual Basic Projects/MaxMin/MaxMin.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31005.135 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "MaxMin", "MaxMin\MaxMin.vbproj", "{1570AFEB-28D9-4713-BDC7-02ABEB6A1D30}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1570AFEB-28D9-4713-BDC7-02ABEB6A1D30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1570AFEB-28D9-4713-BDC7-02ABEB6A1D30}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1570AFEB-28D9-4713-BDC7-02ABEB6A1D30}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1570AFEB-28D9-4713-BDC7-02ABEB6A1D30}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {08ABFB58-FFEA-4FC3-9C39-1023385CA647} + EndGlobalSection +EndGlobal diff --git a/Visual Basic Projects/MaxMin/MaxMin/ApplicationEvents.vb b/Visual Basic Projects/MaxMin/MaxMin/ApplicationEvents.vb new file mode 100644 index 0000000..b892537 --- /dev/null +++ b/Visual Basic Projects/MaxMin/MaxMin/ApplicationEvents.vb @@ -0,0 +1,22 @@ +Imports Microsoft.VisualBasic.ApplicationServices + +Namespace My + ' The following events are available for MyApplication: + ' Startup: Raised when the application starts, before the startup form is created. + ' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally. + ' UnhandledException: Raised if the application encounters an unhandled exception. + ' StartupNextInstance: Raised when launching a single-instance application and the application is already active. + ' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected. + + ' **NEW** ApplyHighDpiMode: Raised when the application queries the HighDpiMode to set it for the application. + + ' Example: + + ' Private Sub MyApplication_ApplyHighDpiMode(sender As Object, e As ApplyHighDpiModeEventArgs) Handles Me.ApplyHighDpiMode + ' e.HighDpiMode = HighDpiMode.PerMonitorV2 + ' End Sub + + Partial Friend Class MyApplication + + End Class +End Namespace diff --git a/Visual Basic Projects/MaxMin/MaxMin/Form1.Designer.vb b/Visual Basic Projects/MaxMin/MaxMin/Form1.Designer.vb new file mode 100644 index 0000000..e7c4ed3 --- /dev/null +++ b/Visual Basic Projects/MaxMin/MaxMin/Form1.Designer.vb @@ -0,0 +1,177 @@ + _ +Partial Class Form1 + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + + Private Sub InitializeComponent() + Me.Label1 = New System.Windows.Forms.Label() + Me.lblNumbers = New System.Windows.Forms.Label() + Me.Label3 = New System.Windows.Forms.Label() + Me.Label4 = New System.Windows.Forms.Label() + Me.Label5 = New System.Windows.Forms.Label() + Me.lblMin = New System.Windows.Forms.Label() + Me.lblMax = New System.Windows.Forms.Label() + Me.txtMin = New System.Windows.Forms.TextBox() + Me.txtMax = New System.Windows.Forms.TextBox() + Me.btnNew = New System.Windows.Forms.Button() + Me.btnCheck = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.Location = New System.Drawing.Point(11, 20) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(112, 15) + Me.Label1.TabIndex = 0 + Me.Label1.Text = "За следните числа:" + ' + 'lblNumbers + ' + Me.lblNumbers.AutoSize = True + Me.lblNumbers.ForeColor = System.Drawing.Color.Red + Me.lblNumbers.Location = New System.Drawing.Point(12, 54) + Me.lblNumbers.Name = "lblNumbers" + Me.lblNumbers.Size = New System.Drawing.Size(27, 15) + Me.lblNumbers.TabIndex = 1 + Me.lblNumbers.Text = "ERR" + ' + 'Label3 + ' + Me.Label3.AutoSize = True + Me.Label3.Location = New System.Drawing.Point(12, 82) + Me.Label3.Name = "Label3" + Me.Label3.Size = New System.Drawing.Size(70, 15) + Me.Label3.TabIndex = 2 + Me.Label3.Text = "определете" + ' + 'Label4 + ' + Me.Label4.AutoSize = True + Me.Label4.ForeColor = System.Drawing.Color.Navy + Me.Label4.Location = New System.Drawing.Point(11, 119) + Me.Label4.Name = "Label4" + Me.Label4.Size = New System.Drawing.Size(79, 15) + Me.Label4.TabIndex = 3 + Me.Label4.Text = "най-малкото" + ' + 'Label5 + ' + Me.Label5.AutoSize = True + Me.Label5.ForeColor = System.Drawing.Color.Navy + Me.Label5.Location = New System.Drawing.Point(11, 153) + Me.Label5.Name = "Label5" + Me.Label5.Size = New System.Drawing.Size(85, 15) + Me.Label5.TabIndex = 4 + Me.Label5.Text = "най-голямото" + ' + 'lblMin + ' + Me.lblMin.AutoSize = True + Me.lblMin.ForeColor = System.Drawing.Color.Red + Me.lblMin.Location = New System.Drawing.Point(203, 122) + Me.lblMin.Name = "lblMin" + Me.lblMin.Size = New System.Drawing.Size(27, 15) + Me.lblMin.TabIndex = 5 + Me.lblMin.Text = "ERR" + ' + 'lblMax + ' + Me.lblMax.AutoSize = True + Me.lblMax.ForeColor = System.Drawing.Color.Red + Me.lblMax.Location = New System.Drawing.Point(203, 153) + Me.lblMax.Name = "lblMax" + Me.lblMax.Size = New System.Drawing.Size(27, 15) + Me.lblMax.TabIndex = 6 + Me.lblMax.Text = "ERR" + ' + 'txtMin + ' + Me.txtMin.Location = New System.Drawing.Point(111, 119) + Me.txtMin.Name = "txtMin" + Me.txtMin.Size = New System.Drawing.Size(86, 23) + Me.txtMin.TabIndex = 7 + ' + 'txtMax + ' + Me.txtMax.Location = New System.Drawing.Point(111, 150) + Me.txtMax.Name = "txtMax" + Me.txtMax.Size = New System.Drawing.Size(86, 23) + Me.txtMax.TabIndex = 8 + ' + 'btnNew + ' + Me.btnNew.Enabled = False + Me.btnNew.ForeColor = System.Drawing.Color.Black + Me.btnNew.Location = New System.Drawing.Point(12, 196) + Me.btnNew.Name = "btnNew" + Me.btnNew.Size = New System.Drawing.Size(112, 58) + Me.btnNew.TabIndex = 9 + Me.btnNew.Text = "Нови числа" + Me.btnNew.UseVisualStyleBackColor = True + ' + 'btnCheck + ' + Me.btnCheck.Enabled = False + Me.btnCheck.Location = New System.Drawing.Point(143, 196) + Me.btnCheck.Name = "btnCheck" + Me.btnCheck.Size = New System.Drawing.Size(111, 58) + Me.btnCheck.TabIndex = 10 + Me.btnCheck.Text = "Провери" + Me.btnCheck.UseVisualStyleBackColor = True + ' + 'Form1 + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 15.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(266, 266) + Me.Controls.Add(Me.btnCheck) + Me.Controls.Add(Me.btnNew) + Me.Controls.Add(Me.txtMax) + Me.Controls.Add(Me.txtMin) + Me.Controls.Add(Me.lblMax) + Me.Controls.Add(Me.lblMin) + Me.Controls.Add(Me.Label5) + Me.Controls.Add(Me.Label4) + Me.Controls.Add(Me.Label3) + Me.Controls.Add(Me.lblNumbers) + Me.Controls.Add(Me.Label1) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog + Me.MaximizeBox = False + Me.Name = "Form1" + Me.Text = "Кой е най...?" + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents Label1 As Label + Friend WithEvents lblNumbers As Label + Friend WithEvents Label3 As Label + Friend WithEvents Label4 As Label + Friend WithEvents Label5 As Label + Friend WithEvents lblMin As Label + Friend WithEvents lblMax As Label + Friend WithEvents txtMin As TextBox + Friend WithEvents txtMax As TextBox + Friend WithEvents btnNew As Button + Friend WithEvents btnCheck As Button +End Class diff --git a/Visual Basic Projects/MaxMin/MaxMin/Form1.resx b/Visual Basic Projects/MaxMin/MaxMin/Form1.resx new file mode 100644 index 0000000..b5ae26c --- /dev/null +++ b/Visual Basic Projects/MaxMin/MaxMin/Form1.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/Visual Basic Projects/MaxMin/MaxMin/Form1.vb b/Visual Basic Projects/MaxMin/MaxMin/Form1.vb new file mode 100644 index 0000000..7c054c4 --- /dev/null +++ b/Visual Basic Projects/MaxMin/MaxMin/Form1.vb @@ -0,0 +1,59 @@ +Public Class Form1 + Const numberCount = 10, minimumPossible = 1, maxiumPossible = 100 + + Dim numbers(numberCount) As Integer + Dim rng As Random = New Random + + Private Sub btnNew_Click(sender As Object, e As EventArgs) Handles btnNew.Click, MyBase.Load + ClearAnswer() + + RefreshNumbers() + lblNumbers.Text = String.Join(" ", numbers) + End Sub + + Private Sub btnCheck_Click(sender As Object, e As EventArgs) Handles btnCheck.Click + UpdateCorrectness(lblMin, txtMin.Text.Trim() = numbers.Min()) ' Somehow it handles this comparison + UpdateCorrectness(lblMax, txtMax.Text.Trim() = numbers.Max()) ' Somehow it handles this comparison + + btnNew.Enabled = True + btnCheck.Enabled = False + txtMax.Enabled = False + txtMin.Enabled = False + + lblNumbers.Text = String.Join(" ", numbers.OrderBy(Function(x) x)) + End Sub + + Private Sub txtMinOrtxtMax_TextChanged(sender As Object, e As EventArgs) Handles txtMin.TextChanged, txtMax.TextChanged + ' If both text inputs aren't empty, enable the "Check" button + btnCheck.Enabled = Not String.IsNullOrEmpty(txtMin.Text) And Not String.IsNullOrEmpty(txtMax.Text) + End Sub + + Private Sub RefreshNumbers() + For index = 0 To numberCount Step 1 + numbers(index) = rng.Next(minimumPossible, maxiumPossible + 1) ' Exclusive upper bound + index -= numbers.Count(Function(x) x = numbers(index)) - 1 ' numbers.Count(...) is always between 1 and 2 + Next + End Sub + + Private Sub ClearAnswer() + lblMin.Text = String.Empty + txtMin.Text = String.Empty + txtMin.Enabled = True + + lblMax.Text = String.Empty + txtMax.Text = String.Empty + txtMax.Enabled = True + + btnNew.Enabled = False + End Sub + + Private Sub UpdateCorrectness(control As Control, isCorrect As Boolean) + If isCorrect Then + control.Text = "OK" + control.ForeColor = Color.Green + Else + control.Text = "X" + control.ForeColor = Color.Red + End If + End Sub +End Class \ No newline at end of file diff --git a/Visual Basic Projects/MaxMin/MaxMin/MaxMin.vbproj b/Visual Basic Projects/MaxMin/MaxMin/MaxMin.vbproj new file mode 100644 index 0000000..2b0e1ca --- /dev/null +++ b/Visual Basic Projects/MaxMin/MaxMin/MaxMin.vbproj @@ -0,0 +1,33 @@ + + + + WinExe + net5.0-windows + MaxMin + Sub Main + true + WindowsForms + + + + + + + + + + + True + True + Application.myapp + + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + + \ No newline at end of file diff --git a/Visual Basic Projects/MaxMin/MaxMin/MaxMin.vbproj.user b/Visual Basic Projects/MaxMin/MaxMin/MaxMin.vbproj.user new file mode 100644 index 0000000..c392cf0 --- /dev/null +++ b/Visual Basic Projects/MaxMin/MaxMin/MaxMin.vbproj.user @@ -0,0 +1,8 @@ + + + + + Form + + + diff --git a/Visual Basic Projects/MaxMin/MaxMin/My Project/Application.Designer.HighDpi.vb b/Visual Basic Projects/MaxMin/MaxMin/My Project/Application.Designer.HighDpi.vb new file mode 100644 index 0000000..a3576c4 --- /dev/null +++ b/Visual Basic Projects/MaxMin/MaxMin/My Project/Application.Designer.HighDpi.vb @@ -0,0 +1,69 @@ +Option Strict On +Option Explicit On + +'This constant indicates whether the Application Framework is in use. +#Const APPLICATION_FRAMEWORK = True + +#If APPLICATION_FRAMEWORK Then + +#If NET5_0 And Not NET6_0 Then + +Imports System.Collections.ObjectModel + +Namespace My + + Partial Friend Class MyApplication + + Public Event ApplyHighDpiMode(sender As Object, e As ApplyHighDpiModeEventArgs) + + Private _highDpiMode As HighDpiMode? + + Friend Shadows Property HighDpiMode As HighDpiMode + Get + Return If( + _highDpiMode Is Nothing, + Application.HighDpiMode, + _highDpiMode.Value) + End Get + Set(value As HighDpiMode) + _highDpiMode = value + End Set + End Property + + ' IMPORTANT: + ' If this method causes an compilation error after you've unchecked 'Application Framework' + ' in the project properties, go to the top of this file and change the value to 'False' in this line: + ' #Const APPLICATION_FRAMEWORK = False + + ' For more about using WinForms without the Application Framework + ' see: https://aka.ms/visualbasic-appframework-net5 + Protected Overrides Function OnInitialize(commandLineArgs As ReadOnlyCollection(Of String)) As Boolean + Dim eventArgs = New ApplyHighDpiModeEventArgs( + If( + _highDpiMode Is Nothing, + HighDpiMode.SystemAware, + _highDpiMode.Value)) + + RaiseEvent ApplyHighDpiMode(Me, eventArgs) + + Windows.Forms.Application.SetHighDpiMode(eventArgs.HighDpiMode) + + Return MyBase.OnInitialize(commandLineArgs) + End Function + End Class + + Public Class ApplyHighDpiModeEventArgs + Inherits EventArgs + + Public Sub New(highDpiMode As HighDpiMode) + Me.HighDpiMode = highDpiMode + End Sub + + Public Property HighDpiMode As HighDpiMode + + End Class + +End Namespace + +#End If ' #If NET5_0 And Not NET6_0 +#End If ' #If APPLICATION_FRAMEWORK diff --git a/Visual Basic Projects/MaxMin/MaxMin/My Project/Application.Designer.vb b/Visual Basic Projects/MaxMin/MaxMin/My Project/Application.Designer.vb new file mode 100644 index 0000000..8b8d4fc --- /dev/null +++ b/Visual Basic Projects/MaxMin/MaxMin/My Project/Application.Designer.vb @@ -0,0 +1,38 @@ +'------------------------------------------------------------------------------ +' +' 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. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + 'NOTE: This file is auto-generated; do not modify it directly. To make changes, + ' or if you encounter build errors in this file, go to the Project Designer + ' (go to Project Properties or double-click the My Project node in + ' Solution Explorer), and make changes on the Application tab. + ' + Partial Friend Class MyApplication + + + Public Sub New() + MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows) + Me.IsSingleInstance = False + Me.EnableVisualStyles = True + Me.SaveMySettingsOnExit = True + Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses + End Sub + + + Protected Overrides Sub OnCreateMainForm() + Me.MainForm = Form1 + End Sub + End Class +End Namespace diff --git a/Visual Basic Projects/MaxMin/MaxMin/My Project/Application.myapp b/Visual Basic Projects/MaxMin/MaxMin/My Project/Application.myapp new file mode 100644 index 0000000..fbb5858 --- /dev/null +++ b/Visual Basic Projects/MaxMin/MaxMin/My Project/Application.myapp @@ -0,0 +1,10 @@ + + + true + Form1 + false + 0 + true + 0 + true + \ No newline at end of file diff --git a/Visual Basic Projects/catalog/catalog.sln b/Visual Basic Projects/catalog/catalog.sln new file mode 100644 index 0000000..d0fa698 --- /dev/null +++ b/Visual Basic Projects/catalog/catalog.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31005.135 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "catalog", "catalog\catalog.vbproj", "{FA219779-9B80-45C5-9614-7DE9493ABF12}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FA219779-9B80-45C5-9614-7DE9493ABF12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA219779-9B80-45C5-9614-7DE9493ABF12}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA219779-9B80-45C5-9614-7DE9493ABF12}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA219779-9B80-45C5-9614-7DE9493ABF12}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {47CF79BF-BA4A-4B4A-9574-FD06C0060079} + EndGlobalSection +EndGlobal diff --git a/Visual Basic Projects/catalog/catalog/ApplicationEvents.vb b/Visual Basic Projects/catalog/catalog/ApplicationEvents.vb new file mode 100644 index 0000000..b892537 --- /dev/null +++ b/Visual Basic Projects/catalog/catalog/ApplicationEvents.vb @@ -0,0 +1,22 @@ +Imports Microsoft.VisualBasic.ApplicationServices + +Namespace My + ' The following events are available for MyApplication: + ' Startup: Raised when the application starts, before the startup form is created. + ' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally. + ' UnhandledException: Raised if the application encounters an unhandled exception. + ' StartupNextInstance: Raised when launching a single-instance application and the application is already active. + ' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected. + + ' **NEW** ApplyHighDpiMode: Raised when the application queries the HighDpiMode to set it for the application. + + ' Example: + + ' Private Sub MyApplication_ApplyHighDpiMode(sender As Object, e As ApplyHighDpiModeEventArgs) Handles Me.ApplyHighDpiMode + ' e.HighDpiMode = HighDpiMode.PerMonitorV2 + ' End Sub + + Partial Friend Class MyApplication + + End Class +End Namespace diff --git a/Visual Basic Projects/catalog/catalog/Form1.Designer.vb b/Visual Basic Projects/catalog/catalog/Form1.Designer.vb new file mode 100644 index 0000000..7337d03 --- /dev/null +++ b/Visual Basic Projects/catalog/catalog/Form1.Designer.vb @@ -0,0 +1,146 @@ + +Partial Class Form1 + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + + Private Sub InitializeComponent() + Me.cbProducts = New System.Windows.Forms.ComboBox() + Me.lblProducts = New System.Windows.Forms.Label() + Me.lblProductPriceLabel = New System.Windows.Forms.Label() + Me.lblProductPrice = New System.Windows.Forms.Label() + Me.btnAddProduct = New System.Windows.Forms.Button() + Me.btnRemoveProduct = New System.Windows.Forms.Button() + Me.lbChosenProducts = New System.Windows.Forms.ListBox() + Me.lblSumLabel = New System.Windows.Forms.Label() + Me.lblSum = New System.Windows.Forms.Label() + Me.SuspendLayout() + ' + 'cbProducts + ' + Me.cbProducts.FormattingEnabled = True + Me.cbProducts.Location = New System.Drawing.Point(17, 53) + Me.cbProducts.Name = "cbProducts" + Me.cbProducts.Size = New System.Drawing.Size(289, 23) + Me.cbProducts.TabIndex = 0 + ' + 'lblProducts + ' + Me.lblProducts.AutoSize = True + Me.lblProducts.Location = New System.Drawing.Point(17, 22) + Me.lblProducts.Name = "lblProducts" + Me.lblProducts.Size = New System.Drawing.Size(98, 15) + Me.lblProducts.TabIndex = 1 + Me.lblProducts.Text = "Избери продукт:" + ' + 'lblProductPriceLabel + ' + Me.lblProductPriceLabel.AutoSize = True + Me.lblProductPriceLabel.Location = New System.Drawing.Point(28, 94) + Me.lblProductPriceLabel.Name = "lblProductPriceLabel" + Me.lblProductPriceLabel.Size = New System.Drawing.Size(107, 15) + Me.lblProductPriceLabel.TabIndex = 2 + Me.lblProductPriceLabel.Text = "Цена на продукта:" + ' + 'lblProductPrice + ' + Me.lblProductPrice.AutoSize = True + Me.lblProductPrice.Location = New System.Drawing.Point(210, 94) + Me.lblProductPrice.Name = "lblProductPrice" + Me.lblProductPrice.Size = New System.Drawing.Size(32, 15) + Me.lblProductPrice.TabIndex = 3 + Me.lblProductPrice.Text = "0 лв." + ' + 'btnAddProduct + ' + Me.btnAddProduct.Location = New System.Drawing.Point(17, 134) + Me.btnAddProduct.Name = "btnAddProduct" + Me.btnAddProduct.Size = New System.Drawing.Size(118, 39) + Me.btnAddProduct.TabIndex = 4 + Me.btnAddProduct.Text = "Добави" + Me.btnAddProduct.UseVisualStyleBackColor = True + ' + 'btnRemoveProduct + ' + Me.btnRemoveProduct.Location = New System.Drawing.Point(17, 179) + Me.btnRemoveProduct.Name = "btnRemoveProduct" + Me.btnRemoveProduct.Size = New System.Drawing.Size(118, 36) + Me.btnRemoveProduct.TabIndex = 5 + Me.btnRemoveProduct.Text = "Премахни" + Me.btnRemoveProduct.UseVisualStyleBackColor = True + ' + 'lbChosenProducts + ' + Me.lbChosenProducts.FormattingEnabled = True + Me.lbChosenProducts.ItemHeight = 15 + Me.lbChosenProducts.Location = New System.Drawing.Point(141, 120) + Me.lbChosenProducts.Name = "lbChosenProducts" + Me.lbChosenProducts.Size = New System.Drawing.Size(165, 109) + Me.lbChosenProducts.TabIndex = 6 + ' + 'lblSumLabel + ' + Me.lblSumLabel.AutoSize = True + Me.lblSumLabel.Location = New System.Drawing.Point(94, 245) + Me.lblSumLabel.Name = "lblSumLabel" + Me.lblSumLabel.Size = New System.Drawing.Size(41, 15) + Me.lblSumLabel.TabIndex = 7 + Me.lblSumLabel.Text = "СУМА" + ' + 'lblSum + ' + Me.lblSum.AutoSize = True + Me.lblSum.Location = New System.Drawing.Point(141, 245) + Me.lblSum.Name = "lblSum" + Me.lblSum.Size = New System.Drawing.Size(32, 15) + Me.lblSum.TabIndex = 8 + Me.lblSum.Text = "0 лв." + ' + 'Form1 + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 15.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(324, 275) + Me.Controls.Add(Me.lblSum) + Me.Controls.Add(Me.lblSumLabel) + Me.Controls.Add(Me.lbChosenProducts) + Me.Controls.Add(Me.btnRemoveProduct) + Me.Controls.Add(Me.btnAddProduct) + Me.Controls.Add(Me.lblProductPrice) + Me.Controls.Add(Me.lblProductPriceLabel) + Me.Controls.Add(Me.lblProducts) + Me.Controls.Add(Me.cbProducts) + Me.Name = "Form1" + Me.Text = "Пазаруване по каталог" + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents cbProducts As ComboBox + Friend WithEvents lblProducts As Label + Friend WithEvents lblProductPriceLabel As Label + Friend WithEvents lblProductPrice As Label + Friend WithEvents btnAddProduct As Button + Friend WithEvents btnRemoveProduct As Button + Friend WithEvents lbChosenProducts As ListBox + Friend WithEvents lblSumLabel As Label + Friend WithEvents lblSum As Label +End Class \ No newline at end of file diff --git a/Visual Basic Projects/catalog/catalog/Form1.resx b/Visual Basic Projects/catalog/catalog/Form1.resx new file mode 100644 index 0000000..b5ae26c --- /dev/null +++ b/Visual Basic Projects/catalog/catalog/Form1.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/Visual Basic Projects/catalog/catalog/Form1.vb b/Visual Basic Projects/catalog/catalog/Form1.vb new file mode 100644 index 0000000..71af62b --- /dev/null +++ b/Visual Basic Projects/catalog/catalog/Form1.vb @@ -0,0 +1,65 @@ +Public Class Form1 + Dim Sum As Double + Dim Products As String() = { + "Магнитни наколенки", + "Магнитен колан", + "Магни Иър", + "Масажираща седалка", + "Сауна за лице", + "Електрическо одеяло", + "Инфраред масажор за тяло", + "Гривна за баланс", + "Цитрус джусер", + "Апарат за кръвно налягане" + } + Dim Prices As Single() = { + 59.9, + 39.9, + 39.9, + 59.9, + 49.9, + 56.9, + 147.0, + 54.9, + 49.9, + 109.8 + } + + Private Function ToCurrency(Optional value As Double = 0) As String + Return FormatCurrency(value, 2) + End Function + + Private Sub Form_Load(sender As Object, e As EventArgs) Handles MyBase.Load + cbProducts.Items.AddRange(Products) + lblSum.Text = ToCurrency() + lblProductPrice.Text = ToCurrency() + End Sub + + Private Sub cbProducts_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbProducts.SelectedIndexChanged + lblProductPrice.Text = ToCurrency(Prices(cbProducts.SelectedIndex)) + End Sub + + Private Sub btnAddProduct_Click(sender As Object, e As EventArgs) Handles btnAddProduct.Click + If String.IsNullOrEmpty(cbProducts.Text) Then + Return + End If + + lbChosenProducts.Items.Add(cbProducts.Text) + Sum += Prices(cbProducts.SelectedIndex) + lblSum.Text = ToCurrency(Sum) + End Sub + + Private Sub btnRemoveProduct_Click(sender As Object, e As EventArgs) Handles btnRemoveProduct.Click + If String.IsNullOrEmpty(cbProducts.Text) Then + Return + End If + + If Not lbChosenProducts.Items.Contains(cbProducts.SelectedItem) Then + Return + End If + + lbChosenProducts.Items.Remove(cbProducts.SelectedItem) + Sum -= Prices(cbProducts.SelectedIndex) + lblSum.Text = ToCurrency(Sum) + End Sub +End Class \ No newline at end of file diff --git a/Visual Basic Projects/catalog/catalog/My Project/Application.Designer.HighDpi.vb b/Visual Basic Projects/catalog/catalog/My Project/Application.Designer.HighDpi.vb new file mode 100644 index 0000000..a3576c4 --- /dev/null +++ b/Visual Basic Projects/catalog/catalog/My Project/Application.Designer.HighDpi.vb @@ -0,0 +1,69 @@ +Option Strict On +Option Explicit On + +'This constant indicates whether the Application Framework is in use. +#Const APPLICATION_FRAMEWORK = True + +#If APPLICATION_FRAMEWORK Then + +#If NET5_0 And Not NET6_0 Then + +Imports System.Collections.ObjectModel + +Namespace My + + Partial Friend Class MyApplication + + Public Event ApplyHighDpiMode(sender As Object, e As ApplyHighDpiModeEventArgs) + + Private _highDpiMode As HighDpiMode? + + Friend Shadows Property HighDpiMode As HighDpiMode + Get + Return If( + _highDpiMode Is Nothing, + Application.HighDpiMode, + _highDpiMode.Value) + End Get + Set(value As HighDpiMode) + _highDpiMode = value + End Set + End Property + + ' IMPORTANT: + ' If this method causes an compilation error after you've unchecked 'Application Framework' + ' in the project properties, go to the top of this file and change the value to 'False' in this line: + ' #Const APPLICATION_FRAMEWORK = False + + ' For more about using WinForms without the Application Framework + ' see: https://aka.ms/visualbasic-appframework-net5 + Protected Overrides Function OnInitialize(commandLineArgs As ReadOnlyCollection(Of String)) As Boolean + Dim eventArgs = New ApplyHighDpiModeEventArgs( + If( + _highDpiMode Is Nothing, + HighDpiMode.SystemAware, + _highDpiMode.Value)) + + RaiseEvent ApplyHighDpiMode(Me, eventArgs) + + Windows.Forms.Application.SetHighDpiMode(eventArgs.HighDpiMode) + + Return MyBase.OnInitialize(commandLineArgs) + End Function + End Class + + Public Class ApplyHighDpiModeEventArgs + Inherits EventArgs + + Public Sub New(highDpiMode As HighDpiMode) + Me.HighDpiMode = highDpiMode + End Sub + + Public Property HighDpiMode As HighDpiMode + + End Class + +End Namespace + +#End If ' #If NET5_0 And Not NET6_0 +#End If ' #If APPLICATION_FRAMEWORK diff --git a/Visual Basic Projects/catalog/catalog/My Project/Application.Designer.vb b/Visual Basic Projects/catalog/catalog/My Project/Application.Designer.vb new file mode 100644 index 0000000..8b8d4fc --- /dev/null +++ b/Visual Basic Projects/catalog/catalog/My Project/Application.Designer.vb @@ -0,0 +1,38 @@ +'------------------------------------------------------------------------------ +' +' 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. +' +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + 'NOTE: This file is auto-generated; do not modify it directly. To make changes, + ' or if you encounter build errors in this file, go to the Project Designer + ' (go to Project Properties or double-click the My Project node in + ' Solution Explorer), and make changes on the Application tab. + ' + Partial Friend Class MyApplication + + + Public Sub New() + MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows) + Me.IsSingleInstance = False + Me.EnableVisualStyles = True + Me.SaveMySettingsOnExit = True + Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses + End Sub + + + Protected Overrides Sub OnCreateMainForm() + Me.MainForm = Form1 + End Sub + End Class +End Namespace diff --git a/Visual Basic Projects/catalog/catalog/My Project/Application.myapp b/Visual Basic Projects/catalog/catalog/My Project/Application.myapp new file mode 100644 index 0000000..fbb5858 --- /dev/null +++ b/Visual Basic Projects/catalog/catalog/My Project/Application.myapp @@ -0,0 +1,10 @@ + + + true + Form1 + false + 0 + true + 0 + true + \ No newline at end of file diff --git a/Visual Basic Projects/catalog/catalog/catalog.vbproj b/Visual Basic Projects/catalog/catalog/catalog.vbproj new file mode 100644 index 0000000..76fdf00 --- /dev/null +++ b/Visual Basic Projects/catalog/catalog/catalog.vbproj @@ -0,0 +1,33 @@ + + + + WinExe + net5.0-windows + catalog + Sub Main + true + WindowsForms + + + + + + + + + + + True + True + Application.myapp + + + + + + MyApplicationCodeGenerator + Application.Designer.vb + + + + \ No newline at end of file diff --git a/Visual Basic Projects/catalog/catalog/catalog.vbproj.user b/Visual Basic Projects/catalog/catalog/catalog.vbproj.user new file mode 100644 index 0000000..c392cf0 --- /dev/null +++ b/Visual Basic Projects/catalog/catalog/catalog.vbproj.user @@ -0,0 +1,8 @@ + + + + + Form + + + -- cgit v1.2.3