лаба 4 начата и почти... почти сделана вроде

This commit is contained in:
Елена Бакальская 2024-10-18 00:46:43 +04:00
parent 2d2885ba49
commit af8268ea0a
10 changed files with 397 additions and 119 deletions

81
lab4/Form1.Designer.cs generated Normal file
View File

@ -0,0 +1,81 @@
namespace lab4
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
dateTimePicker = new DateTimePicker();
label1 = new Label();
numericUpDown = new NumericUpDown();
((System.ComponentModel.ISupportInitialize)numericUpDown).BeginInit();
SuspendLayout();
//
// dateTimePicker
//
dateTimePicker.Location = new Point(12, 12);
dateTimePicker.Name = "dateTimePicker";
dateTimePicker.Size = new Size(250, 27);
dateTimePicker.TabIndex = 0;
dateTimePicker.ValueChanged += dateTimePicker_ValueChanged;
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(12, 57);
label1.Name = "label1";
label1.Size = new Size(0, 20);
label1.TabIndex = 1;
//
// numericUpDown
//
numericUpDown.Location = new Point(290, 12);
numericUpDown.Name = "numericUpDown";
numericUpDown.Size = new Size(150, 27);
numericUpDown.TabIndex = 2;
//
// Form1
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(numericUpDown);
Controls.Add(label1);
Controls.Add(dateTimePicker);
Name = "Form1";
Text = "Form1";
((System.ComponentModel.ISupportInitialize)numericUpDown).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private DateTimePicker dateTimePicker;
private Label label1;
private NumericUpDown numericUpDown;
}
}

22
lab4/Form1.cs Normal file
View File

@ -0,0 +1,22 @@
namespace lab4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void dateTimePicker_ValueChanged(object sender, EventArgs e)
{
DateTime date = dateTimePicker.Value;
int hours = Convert.ToInt32(numericUpDown.Value);
if (date != null)
{
label1.Text = "Âû âûáðàëè: " + date.ToString() + " â " + date.Hour.ToString() + " ÷àñîâ è " + date.Minute.ToString() + " ìèíóò";
label1.Text += $"\nÀ åñëè áû âû âûáðàëè âðåìÿ ÷åðåç {hours} ÷àñîâ è ñòîëüêî æå äíåé, òî áûëî áû "
+ date.AddHours(hours).Hour.ToString() + " ÷àñîâ è " + date.AddDays(hours).Day.ToString() + " äíåé ìåñÿöà: " + date.AddDays(hours).Month.ToString();
}
}
}
}

120
lab4/Form1.resx Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

17
lab4/Program.cs Normal file
View File

@ -0,0 +1,17 @@
namespace lab4
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
}
}
}

11
lab4/lab4.csproj Normal file
View File

@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>

25
lab4/lab4.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34714.143
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lab4", "lab4.csproj", "{384DCA7D-2F55-4FF5-AABC-2A2E59A8E72D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{384DCA7D-2F55-4FF5-AABC-2A2E59A8E72D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{384DCA7D-2F55-4FF5-AABC-2A2E59A8E72D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{384DCA7D-2F55-4FF5-AABC-2A2E59A8E72D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{384DCA7D-2F55-4FF5-AABC-2A2E59A8E72D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2613C18E-1449-4505-9FB5-5DF9EC2AB52A}
EndGlobalSection
EndGlobal

View File

@ -7,6 +7,7 @@
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<DatePicker HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top"/>
</Grid>
</Window>

View File

@ -18,18 +18,18 @@
<xs:element name="size">
<xs:complexType>
<xs:sequence>
<xs:element name="width" type="xs:string"/>
<xs:element name="height" type="xs:string"/>
<xs:element name="width" type="xs:float" minOccurs="0"/>
<xs:element name="height" type="xs:float" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="weight" type="xs:string"/>
<xs:element name="weight" type="xs:int" minOccurs="0"/>
<xs:element name="color" type="xs:string"/>
<xs:element name="diet">
<xs:complexType>
<xs:sequence>
<xs:element name="food" type="xs:string"/>
<xs:element name="averageIntake" type="xs:string"/>
<xs:element name="averageIntake" type="xs:int"/>
</xs:sequence>
</xs:complexType>
</xs:element>

View File

@ -1,126 +1,125 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE animals SYSTEM "animals.dtd">
<animals xmlns="http://msiter.ru"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://msiter.ru note.xsd">
<?xml-stylesheet type="text/xsl" href="styles.xslt"?>
xsi:schemaLocation="http://msiter.ru ./animals.xsd">
<?xml-stylesheet type="text/xsl" href="styles.xslt"?>
<animals>
<animal id="1">
<name>Слон</name>
<size>
<width>3.2</width>
<height>4.0</height>
</size>
<weight>5400</weight>
<color>Серый</color>
<diet>
<food>Трава</food>
<averageIntake>около 150</averageIntake>
</diet>
<habitat>Саванна</habitat>
<interestingFact>Слоны - самые большие животные на Земле (на суше)</interestingFact>
</animal>
<animal id="2">
<name>Пингвин</name>
<size>
<width>0.4</width>
<height>1.1</height>
</size>
<weight>30</weight>
<color>Черно-белые, иногда фиолетово-белые</color>
<diet>
<food>Рыба</food>
<averageIntake>2</averageIntake>
</diet>
<habitat>Антарктика</habitat>
<interestingFact>Пингвины-родители по очереди высиживают яйца, пока второй партнер уходит на охоту за рыбой</interestingFact>
</animal>
<!DOCTYPE animals SYSTEM "animals.dtd">
<animal id="3">
<animals>
<animal id="1">
<name>Слон</name>
<size>
<width>3.2</width>
<height>4.0</height>
</size>
<weight>5400</weight>
<color>Серый</color>
<diet>
<food>Трава</food>
<averageIntake>около 150</averageIntake>
</diet>
<habitat>Саванна</habitat>
<interestingFact>Слоны - самые большие животные на Земле (на суше)</interestingFact>
</animal>
<name>Тигр</name>
<size>
<width>1.2</width>
<height>1.0</height>
</size>
<weight>220</weight>
<color>Оранжевый с черными полосами</color>
<diet>
<food>
Мясо
</food>
<averageIntake>
10
</averageIntake>
</diet>
<habitat>Леса, саванны</habitat>
<interestingFact>Тигры могут проплывать до 6 км за один раз</interestingFact>
</animal>
<animal id="2">
<name>Пингвин</name>
<size>
<width>0.4</width>
<height>1.1</height>
</size>
<weight>30</weight>
<color>Черно-белые, иногда фиолетово-белые</color>
<diet>
<food>Рыба</food>
<averageIntake>2</averageIntake>
</diet>
<habitat>Антарктика</habitat>
<interestingFact>Пингвины-родители по очереди высиживают яйца, пока второй партнер уходит на охоту за рыбой</interestingFact>
</animal>
<animal id="4">
<animal id="3">
<name>Панда</name>
<size>
<width>0.8</width>
<height>0.7</height>
</size>
<weight>100</weight>
<color>Черно-белый</color>
<name>Тигр</name>
<size>
<width>1.2 м</width>
<height>1.0 м</height>
</size>
<weight>220</weight>
<color>Оранжевый с черными полосами</color>
<diet>
<food>
Мясо
</food>
<averageIntake>
10
</averageIntake>
</diet>
<habitat>Леса, саванны</habitat>
<interestingFact>Тигры могут проплывать до 6 км за один раз</interestingFact>
</animal>
<diet>
<food>
Бамбук
</food>
<averageIntake>
15
</averageIntake>
</diet>
<habitat>Горные леса Китая</habitat>
<interestingFact>Панды проводят до 14 часов в день, поедая бамбук</interestingFact>
</animal>
<animal id="4">
<animal id="5">
<name>Белый медведь</name>
<size>
<width>1.5</width>
<height>1.6</height>
</size>
<weight>450</weight>
<color>Белый</color>
<diet>
<food>
Морские млекопитающие
</food>
<averageIntake>
7
</averageIntake>
</diet>
<habitat>Арктика</habitat>
<interestingFact>Белые медведи могут нюхать добычу на расстоянии до 30 км</interestingFact>
</animal>
<name>Панда</name>
<size>
<width>0.8 м</width>
<height>0.7 м</height>
</size>
<weight>100</weight>
<color>Черно-белый</color>
<diet>
<food>
Бамбук
</food>
<averageIntake>
15
</averageIntake>
</diet>
<habitat>Горные леса Китая</habitat>
<interestingFact>Панды проводят до 14 часов в день, поедая бамбук</interestingFact>
</animal>
<animal id="5">
<name>Белый медведь</name>
<size>
<width>1.5 м</width>
<height>1.6 м</height>
</size>
<weight>450</weight>
<color>Белый</color>
<diet>
<food>
Морские млекопитающие
</food>
<averageIntake>
7
</averageIntake>
</diet>
<habitat>Арктика</habitat>
<interestingFact>Белые медведи могут нюхать добычу на расстоянии до 30 км</interestingFact>
</animal>
<animal id="6">
<name>Фламинго</name>
<size>
<width>0.3 м</width>
<height>1.5 м</height>
</size>
<weight>3</weight>
<color>Розовый</color>
<diet>
<food>
Мелкие рыбы и водоросли
</food>
<averageIntake>
0.5
</averageIntake>
</diet>
<habitat>Соленые озера и лагуны</habitat>
<interestingFact>Цвет перьев фламинго зависит от их диеты</interestingFact>
</animal>
<animal id="6">
<name>Фламинго</name>
<size>
<width>0.3</width>
<height>1.5</height>
</size>
<weight>3</weight>
<color>Розовый</color>
<diet>
<food>
Мелкие рыбы и водоросли
</food>
<averageIntake>
0.5
</averageIntake>
</diet>
<habitat>Соленые озера и лагуны</habitat>
<interestingFact>Цвет перьев фламинго зависит от их диеты</interestingFact>
</animal>
</animals>
</animals>

View File

@ -102,7 +102,9 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="animals.dtd" />
<None Include="animals.dtd">
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>