Bladeren bron

Целиком выполненное задание

Blueris 1 week geleden
bovenliggende
commit
9aee49999d

+ 5 - 4
AvaloniaApplication1/App.axaml

@@ -2,9 +2,10 @@
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              x:Class="AvaloniaApplication1.App"
              RequestedThemeVariant="Default">
-             <!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
+	<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
 
-    <Application.Styles>
-        <FluentTheme />
-    </Application.Styles>
+	<Application.Styles>
+		<FluentTheme />
+		<StyleInclude Source="avares://AvaloniaApplication1/Styles1.axaml" />
+	</Application.Styles>
 </Application>

+ 16 - 13
AvaloniaApplication1/MainWindow.axaml

@@ -7,22 +7,25 @@
         Title="AvaloniaApplication1">
 	<Grid HorizontalAlignment="Center">
 		<StackPanel Margin="50 100 50 50">
-			<TextBlock Name="yearT"></TextBlock>
-			<TextBlock Name="mounthT"></TextBlock>
-			<TextBlock Name="daysT"></TextBlock>
-			<TextBlock Name="dayOfWeek"></TextBlock>
-			<TextBlock Name="DBW"></TextBlock>
-			<TextBlock Name="Viss"></TextBlock>
-			<TextBlock Name="VisY"></TextBlock>
+			<TextBlock  Name="yearT"></TextBlock>
+			<TextBlock  Name="mounthT"></TextBlock>
+			<TextBlock  Name="daysT"></TextBlock>
+			<TextBlock  Name="dayOfWeek"></TextBlock>
+			<TextBlock  Name="DBW"></TextBlock>
+			<TextBlock  Name="Viss"></TextBlock>
+			<TextBlock  Name="VisY"></TextBlock>
+			<TextBlock  Name="Znak"></TextBlock>
 		</StackPanel>
 		<StackPanel Margin="100 250 100 100">
-		
-			<DatePicker Width="400" Height="30" VerticalAlignment="Center" Name="dateT"></DatePicker>
-			<Button  VerticalAlignment="Center" Click="Button_Click" Width="160" Height="30" HorizontalAlignment="Center">
-			Подтвердить выбор	
-			</Button>			
-		</StackPanel>
 
+			<TextBlock  Name="Error"></TextBlock>
+			<DatePicker Classes ="Text" Width="400" Height="30" VerticalAlignment="Center" Name="dateT"></DatePicker>
+			<RadioButton Classes ="RB" Name="Vost">Восточный календарь</RadioButton>
+			<RadioButton Classes ="RB"  Name="Zod">Знак зодиака</RadioButton>
+			<Button Classes ="but" Margin="0 10" VerticalAlignment="Center" Click="Button_Click" Width="160" Height="30" HorizontalAlignment="Center">
+				Подтвердить выбор
+			</Button>
+		</StackPanel>
 	</Grid>
 	
 </Window>

+ 121 - 3
AvaloniaApplication1/MainWindow.axaml.cs

@@ -1,5 +1,7 @@
 using Avalonia.Controls;
 using Avalonia.Interactivity;
+using Avalonia.Media;
+using Avalonia.Media.Imaging;
 using System;
 using System.Data;
 using System.Diagnostics;
@@ -15,13 +17,14 @@ namespace AvaloniaApplication1
             
             
         }
-       public void Button_Click(object source, RoutedEventArgs args)
+       
+        public void Button_Click(object source, RoutedEventArgs args)
         {
             string date = dateT.SelectedDate.ToString();
 
             if (date == "")
             {
-                mounthT.Text = "Âû ââåëè íåñóùåñòâóþùóþ äàòó";
+                Error.Text = "Âû ââåëè íåñóùåñòâóþùóþ äàòó";
             }
             else
             {
@@ -35,10 +38,11 @@ namespace AvaloniaApplication1
 
                 if (BD > ToDay)
                 {
-                    mounthT.Text = "Âû ââåëè áóäóùóþ äàòó";
+                    Error.Text = "Âû ââåëè áóäóùóþ äàòó";
                 }
                 else
                 {
+                    Error.Text = "";
                     int Vis = 0;
                     int DbWeek = 0;
                     DateTime dayW;
@@ -115,7 +119,121 @@ namespace AvaloniaApplication1
                     DBW.Text = "Êîëè÷åñòâî îòïðàçäíîâàííûõ äíåé ðîæäåíèé â " + DayOfWeek + ": " + DbWeek;
                     Viss.Text = "Êîëè÷åñòâî âèñîêîñíûõ ãîäîâ: " + Vis;
                 }
+                if(Zod.IsChecked == false && Vost.IsChecked == false)
+                {
+
+                }
+                if(Vost.IsChecked == true)
+                {
+                    string Zod = " ";
+                    if(year == 1971 || year == 1983 || year == 1995 || year == 2007 || year == 2019 || year == 2031)
+                    {
+                        Zod = "Ñâèíüÿ";
+                    }
+                    if (year == 1972 || year == 1984 || year == 1996 || year == 2008 || year == 2020 || year == 1960)
+                    {
+                        Zod = "Êðûñà";
+                    }
+                    if (year == 1973 || year == 1985 || year == 1997 || year == 2009 || year == 2021 || year == 1961)
+                    {
+                        Zod = "Áûê";
+                    }
+                    if (year == 1974 || year == 1986 || year == 1998 || year == 2010 || year == 2022 || year == 1962)
+                    {
+                        Zod = "Òèãð";
+                    }
+                    if (year == 1975 || year == 1987 || year == 1999 || year == 2011 || year == 2023 || year == 1963)
+                    {
+                        Zod = "Êðîëèê";
+                    }
+                    if (year == 1976 || year == 1988 || year == 2000 || year == 2012 || year == 2024 || year == 1964)
+                    {
+                        Zod = "Äðàêîí";
+                    }
+                    if (year == 1977 || year == 1989 || year == 2001 || year == 2013 || year == 2025 || year == 1965)
+                    {
+                        Zod = "Çìåÿ";
+                    }
+                    if (year == 1978 || year == 1990 || year == 2002 || year == 2014 || year == 2026 || year == 1966)
+                    {
+                        Zod = "Ëîøàäü";
+                    }
+                    if (year == 1979 || year == 1991 || year == 2003 || year == 2015 || year == 2027 || year == 1967)
+                    {
+                        Zod = "Êîíü";
+                    }
+                    if (year == 1980 || year == 1992 || year == 2004 || year == 2016 || year == 2028 || year == 1968)
+                    {
+                        Zod = "Îáåçüÿíà";
+                    }
+                    if (year == 1981 || year == 1993 || year == 2005 || year == 2017 || year == 2029 || year == 1969)
+                    {
+                        Zod = "Ïåòóõ";
+                    }
+                    if (year == 1982 || year == 1994 || year == 2006 || year == 2018 || year == 2030 || year == 1970)
+                    {
+                        Zod = "Ñîáàêà";
+                    }
+                    Znak.Text = "Çíàê âîñòî÷íîãî êàëåíäàðÿ: " + Zod;
+                }
+                if (Zod.IsChecked == true)
+                {
+                    string Zod = " ";
+                    if(day >= 21 && mounth == 3 || day <= 19 && mounth == 4)
+                    {
+                        Zod = "Îâåí"; 
+
+                    }
+                    if (day >= 20 && mounth == 4 || day <= 20 && mounth == 5)
+                    {
+                        Zod = "Òåëåö";
+                    }
+                    if (day >= 21 && mounth == 5 || day <= 20 && mounth == 6)
+                    {
+                        Zod = "Áëèçíåöû";
+                    }
+                    if (day >= 21 && mounth == 6 || day <= 22 && mounth == 7)
+                    {
+                        Zod = "Ðàê";
+                    }
+                    if (day >= 23 && mounth == 7 || day <= 22 && mounth == 8)
+                    {
+                        Zod = "Ëåâ";
+                    }
+                    if (day >= 23 && mounth == 8 || day <= 22 && mounth == 9)
+                    {
+                        Zod = "Äåâà";
+                    }
+                    if (day >= 23 && mounth == 9 || day <= 22 && mounth == 10)
+                    {
+                        Zod = "Âåñû";
+                    }
+                    if (day >= 23 && mounth == 10 || day <= 21 && mounth == 11)
+                    {
+                        Zod = "Ñêîðïèîí";
+                    }
+                    if (day >= 22 && mounth == 11 || day <= 21 && mounth == 12)
+                    {
+                        Zod = "Ñòðåëåö";
+                    }
+                    if (day >= 22 && mounth == 12 || day <= 19 && mounth == 1)
+                    {
+                        Zod = "Êîçåðîã";
+                    }
+                    if (day >= 20 && mounth == 1 || day <= 18 && mounth == 2)
+                    {
+                        Zod = "Âîäîëåé";
+                    }
+                    if (day >= 19 && mounth == 2 || day <= 20 && mounth == 3)
+                    {
+                        Zod = "Ðûáû";
+                    }
+
+                    Znak.Text = "Çíàê çîäèàêà: " + Zod;
+                }
+
             }
+            
         }
     }
 }

+ 40 - 0
AvaloniaApplication1/Styles1.axaml

@@ -0,0 +1,40 @@
+<Styles xmlns="https://github.com/avaloniaui"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+  <Design.PreviewWith>
+    <Border Padding="20">
+      <!-- Add Controls for Previewer Here -->
+    </Border>
+  </Design.PreviewWith>
+
+	<Style Selector="Button.but">
+		<Setter Property="Background" Value="#84a5c8"/>
+		<Setter Property="Foreground" Value="White"/>
+		<Setter Property="BorderBrush" Value="#304c65"/>
+		<Setter Property="CornerRadius" Value="5"/>
+		<Setter Property="FontSize" Value="14"/>
+		
+		<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
+			<Setter Property="Background" Value="#4c393d" />
+			<Setter Property="BorderBrush" Value="#aebed4" />
+			<Setter Property="Foreground" Value="White" />
+		</Style>
+
+		<Style Selector="^:pressed">
+			<Setter Property="RenderTransform" Value="scale(1.5)" />
+		</Style>
+		
+	</Style>
+
+	<Style Selector="DatePicker.Text">
+		<Setter Property="BorderBrush" Value="#aebed4" />
+		</Style>
+
+	<Style Selector="RadioButton.RB">
+		<Setter Property="Foreground" Value="#84a5c8" />
+		<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
+			<Setter Property="Background" Value="#4c393d" />
+			<Setter Property="BorderBrush" Value="#aebed4" />
+			<Setter Property="Foreground" Value="White" />
+		</Style>
+	</Style>
+</Styles>