Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Diagnostics;
- using System.Linq;
- using System.Runtime.CompilerServices;
- 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;
- using View.Annotations;
- namespace View.Menu
- {
- /// <summary>
- /// Interaction logic for Menu.xaml
- /// </summary>
- public partial class Menu : INotifyPropertyChanged
- {
- private double _height;
- private double _width;
- public string Version { get; set; }
- public double HeightValue { get => _height;
- set { _height = value; OnPropertyChanged(); } }
- public double WidthValue { get => _width;
- set { _width = value; OnPropertyChanged(); } }
- public Menu()
- {
- InitializeComponent();
- Version = $"Version: {FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).FileVersion}";
- DataContext = this;
- }
- public event PropertyChangedEventHandler PropertyChanged;
- [NotifyPropertyChangedInvocator]
- protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
- }
- private void FrameworkElement_OnSizeChanged(object sender, SizeChangedEventArgs e)
- {
- var temp = (Grid)sender;
- //Properties
- HeightValue = temp.ActualHeight;
- WidthValue = temp.ActualWidth;
- //Top logo
- Logo.Width = WidthValue / 2;
- Logo.Height = HeightValue / 3;
- //Button Panel
- MenuPanel.Width = WidthValue / 2;
- MenuPanel.Height = HeightValue;
- //Right Label
- RightLabel.FontSize = WidthValue / 22;
- //News Panel
- NewsPanel.Height = HeightValue;
- }
- private void ExitButton_OnClick(object sender, RoutedEventArgs e)
- {
- Process.GetCurrentProcess().Kill();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement