From bdb683d84a36513563535eacb08419a98fd486b7 Mon Sep 17 00:00:00 2001 From: SaiyathAliFathima Date: Thu, 16 Nov 2023 21:06:06 +0530 Subject: [PATCH] Added the sample --- BiggestCashCrop/BiggestCashCrop.sln | 25 ++++++++ BiggestCashCrop/BiggestCashCrop/App.xaml | 9 +++ BiggestCashCrop/BiggestCashCrop/App.xaml.cs | 17 +++++ .../BiggestCashCrop/AssemblyInfo.cs | 10 +++ .../BiggestCashCrop/BiggestCashCrop.csproj | 14 +++++ .../BiggestCashCrop/MainWindow.xaml | 62 +++++++++++++++++++ .../BiggestCashCrop/MainWindow.xaml.cs | 46 ++++++++++++++ .../BiggestCashCrop/Model/CashCropModel.cs | 20 ++++++ .../BiggestCashCrop/ViewModel/CashCropData.cs | 27 ++++++++ 9 files changed, 230 insertions(+) create mode 100644 BiggestCashCrop/BiggestCashCrop.sln create mode 100644 BiggestCashCrop/BiggestCashCrop/App.xaml create mode 100644 BiggestCashCrop/BiggestCashCrop/App.xaml.cs create mode 100644 BiggestCashCrop/BiggestCashCrop/AssemblyInfo.cs create mode 100644 BiggestCashCrop/BiggestCashCrop/BiggestCashCrop.csproj create mode 100644 BiggestCashCrop/BiggestCashCrop/MainWindow.xaml create mode 100644 BiggestCashCrop/BiggestCashCrop/MainWindow.xaml.cs create mode 100644 BiggestCashCrop/BiggestCashCrop/Model/CashCropModel.cs create mode 100644 BiggestCashCrop/BiggestCashCrop/ViewModel/CashCropData.cs diff --git a/BiggestCashCrop/BiggestCashCrop.sln b/BiggestCashCrop/BiggestCashCrop.sln new file mode 100644 index 0000000..77d27ca --- /dev/null +++ b/BiggestCashCrop/BiggestCashCrop.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.7.34031.279 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BiggestCashCrop", "BiggestCashCrop\BiggestCashCrop.csproj", "{04238966-782E-4126-8E2C-22289A496147}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {04238966-782E-4126-8E2C-22289A496147}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {04238966-782E-4126-8E2C-22289A496147}.Debug|Any CPU.Build.0 = Debug|Any CPU + {04238966-782E-4126-8E2C-22289A496147}.Release|Any CPU.ActiveCfg = Release|Any CPU + {04238966-782E-4126-8E2C-22289A496147}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B6383EF6-A945-4797-BDB2-12A11ED54040} + EndGlobalSection +EndGlobal diff --git a/BiggestCashCrop/BiggestCashCrop/App.xaml b/BiggestCashCrop/BiggestCashCrop/App.xaml new file mode 100644 index 0000000..c4c90d1 --- /dev/null +++ b/BiggestCashCrop/BiggestCashCrop/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/BiggestCashCrop/BiggestCashCrop/App.xaml.cs b/BiggestCashCrop/BiggestCashCrop/App.xaml.cs new file mode 100644 index 0000000..63f6630 --- /dev/null +++ b/BiggestCashCrop/BiggestCashCrop/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 BiggestCashCrop +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/BiggestCashCrop/BiggestCashCrop/AssemblyInfo.cs b/BiggestCashCrop/BiggestCashCrop/AssemblyInfo.cs new file mode 100644 index 0000000..8b5504e --- /dev/null +++ b/BiggestCashCrop/BiggestCashCrop/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/BiggestCashCrop/BiggestCashCrop/BiggestCashCrop.csproj b/BiggestCashCrop/BiggestCashCrop/BiggestCashCrop.csproj new file mode 100644 index 0000000..71a107e --- /dev/null +++ b/BiggestCashCrop/BiggestCashCrop/BiggestCashCrop.csproj @@ -0,0 +1,14 @@ + + + + WinExe + net6.0-windows + enable + true + + + + + + + diff --git a/BiggestCashCrop/BiggestCashCrop/MainWindow.xaml b/BiggestCashCrop/BiggestCashCrop/MainWindow.xaml new file mode 100644 index 0000000..653b19e --- /dev/null +++ b/BiggestCashCrop/BiggestCashCrop/MainWindow.xaml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BiggestCashCrop/BiggestCashCrop/MainWindow.xaml.cs b/BiggestCashCrop/BiggestCashCrop/MainWindow.xaml.cs new file mode 100644 index 0000000..94057ac --- /dev/null +++ b/BiggestCashCrop/BiggestCashCrop/MainWindow.xaml.cs @@ -0,0 +1,46 @@ +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 BiggestCashCrop +{ + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + } + + private void Window_Loaded(object sender, RoutedEventArgs e) + { + this.StateChanged += MainWindow_StateChanged; + } + + private void MainWindow_StateChanged(object? sender, EventArgs e) + { + if (this.WindowState == WindowState.Minimized) + { + header.Margin = new Thickness(-50, 3, 0, 10); + } + else if (this.WindowState == WindowState.Maximized) + { + header.Margin = new Thickness(-400, 3, 0, 10); + } + else if (this.WindowState == WindowState.Normal) + { + header.Margin = new Thickness(-50, 3, 0, 10); + } + } + } +} diff --git a/BiggestCashCrop/BiggestCashCrop/Model/CashCropModel.cs b/BiggestCashCrop/BiggestCashCrop/Model/CashCropModel.cs new file mode 100644 index 0000000..cfa8863 --- /dev/null +++ b/BiggestCashCrop/BiggestCashCrop/Model/CashCropModel.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BiggestCashCrop +{ + public class CashCropModel + { + public string Category { get; set; } + public double Value { get; set; } + + public CashCropModel(string category, double value) + { + Category = category; + Value = value; + } + } +} diff --git a/BiggestCashCrop/BiggestCashCrop/ViewModel/CashCropData.cs b/BiggestCashCrop/BiggestCashCrop/ViewModel/CashCropData.cs new file mode 100644 index 0000000..6bb27f3 --- /dev/null +++ b/BiggestCashCrop/BiggestCashCrop/ViewModel/CashCropData.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BiggestCashCrop +{ + public class CashCropData + { + public ObservableCollection Data { get; set; } + + public CashCropData() + { + this.Data = new ObservableCollection + { + new CashCropModel("Cotton", 7.5), + new CashCropModel("Corn", 82.6), + new CashCropModel("Cannabis", 5), + new CashCropModel("Soybeans", 57.5), + new CashCropModel("Hay", 19.3), + new CashCropModel("Wheat", 11.9) + }; + } + } +}