/MetroDemo/MainWindow.xaml.cs
https://bitbucket.org/aeoth/mahapps.metro/ · C# · 160 lines · 117 code · 43 blank · 0 comment · 6 complexity · 5dc4f6e186d4ce2683bdcb632d088292 MD5 · raw file
- using System;
- using System.Collections;
- using System.Reflection;
- using System.Windows;
- using System.Windows.Input;
-
- namespace MetroDemo
- {
- public partial class MainWindow
- {
- public MainWindow()
- {
- InitializeComponent();
- }
-
- private void WindowMouseDown(object sender, MouseButtonEventArgs e)
- {
- if (e.RightButton != MouseButtonState.Pressed && e.MiddleButton != MouseButtonState.Pressed)
- DragMove();
- }
-
- private void BtnMinClick(object sender, RoutedEventArgs e)
- {
- WindowState = WindowState.Minimized;
- }
-
- private void BtnCloseClick(object sender, RoutedEventArgs e)
- {
- Application.Current.Shutdown();
- }
-
- private void BtnMaxClick(object sender, RoutedEventArgs e)
- {
- WindowState = WindowState == WindowState.Normal ? WindowState.Maximized : WindowState.Normal;
- }
-
-
- private void MiDarkRed(object sender, RoutedEventArgs e)
- {
- var redRd = new ResourceDictionary();
- var darkRd = new ResourceDictionary();
-
- redRd.Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/Red.xaml");
- darkRd.Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml");
-
-
- ApplyResourceDictionary(redRd);
- ApplyResourceDictionary(darkRd);
-
-
- }
-
- private void MiLightGreen(object sender, RoutedEventArgs e)
- {
- var greenRd = new ResourceDictionary();
- var lightRd = new ResourceDictionary();
-
- greenRd.Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/Green.xaml");
- lightRd.Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml");
-
-
- ApplyResourceDictionary(greenRd);
- ApplyResourceDictionary(lightRd);
- }
-
- private void ApplyResourceDictionary(ResourceDictionary rd)
- {
- foreach (DictionaryEntry r in rd)
- {
- if (Resources.Contains(r.Key))
- Resources.Remove(r.Key);
-
- Resources.Add(r.Key, r.Value);
- }
- }
-
- private void Button_Click(object sender, RoutedEventArgs e)
- {
- pb.IsIndeterminate = !pb.IsIndeterminate;
- }
-
- private void MiLightRed(object sender, RoutedEventArgs e)
- {
- var accentRd = new ResourceDictionary();
- var themeRd = new ResourceDictionary();
-
- accentRd.Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/Red.xaml");
- themeRd.Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml");
-
-
- ApplyResourceDictionary(accentRd);
- ApplyResourceDictionary(themeRd);
- }
-
- private void MiLightBlue(object sender, RoutedEventArgs e)
- {
- var accentRd = new ResourceDictionary();
- var themeRd = new ResourceDictionary();
-
- accentRd.Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml");
- themeRd.Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml");
-
-
- ApplyResourceDictionary(accentRd);
- ApplyResourceDictionary(themeRd);
- }
-
- private void MiLightPurple(object sender, RoutedEventArgs e)
- {
- var accentRd = new ResourceDictionary();
- var themeRd = new ResourceDictionary();
-
- accentRd.Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/Purple.xaml");
- themeRd.Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml");
-
-
- ApplyResourceDictionary(accentRd);
- ApplyResourceDictionary(themeRd);
- }
-
- private void MiDarkBlue(object sender, RoutedEventArgs e)
- {
- var accentRd = new ResourceDictionary();
- var themeRd = new ResourceDictionary();
-
- accentRd.Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml");
- themeRd.Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml");
-
-
- ApplyResourceDictionary(accentRd);
- ApplyResourceDictionary(themeRd);
- }
-
- private void MiDarkGreen(object sender, RoutedEventArgs e)
- {
- var accentRd = new ResourceDictionary();
- var themeRd = new ResourceDictionary();
-
- accentRd.Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/Green.xaml");
- themeRd.Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml");
-
-
- ApplyResourceDictionary(accentRd);
- ApplyResourceDictionary(themeRd);
- }
-
- private void MiDarkPurple(object sender, RoutedEventArgs e)
- {
- var accentRd = new ResourceDictionary();
- var themeRd = new ResourceDictionary();
-
- accentRd.Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/Purple.xaml");
- themeRd.Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml");
-
-
- ApplyResourceDictionary(accentRd);
- ApplyResourceDictionary(themeRd);
- }
- }
- }