Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Input;
- namespace CPU_Control
- {
- /// <summary>
- /// Логика взаимодействия для MainWindow.xaml
- /// </summary>
- public partial class PcControl : Window
- {
- public bool Pinned { get; set; } = false;
- public PcControl()
- {
- InitializeComponent();
- WindowStartupLocation = WindowStartupLocation.Manual;
- var margin = 10;
- Top = margin;
- Left = SystemParameters.PrimaryScreenWidth - Width - margin;
- }
- private void Window_MouseDown(object sender, MouseButtonEventArgs e)
- {
- if (e.ChangedButton == MouseButton.Left && !Pinned)
- this.DragMove();
- }
- private void Window_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
- {
- ContextMenu cm = this.FindResource("cmButton") as ContextMenu;
- cm.PlacementTarget = sender as Button;
- cm.IsOpen = true;
- }
- private void CmCloseApp(object sender, RoutedEventArgs e)
- {
- Close();
- }
- private void TogglePin(object sender, RoutedEventArgs e)
- {
- Pinned = !Pinned;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement