<commit_before>﻿namespace ControlzEx.Showcase
{
    using System;
    using System.Reflection;
    using System.Windows;
    using System.Windows.Input;
    using ControlzEx.Native;
    using ControlzEx.Standard;
#pragma warning disable 618
    using SystemCommands = ControlzEx.Windows.Shell.SystemCommands;
#pragma warning restore 618

    public partial class MainWindow
    {
        public MainWindow()
        {
            //this.ShowActivated = false;
            //this.MaxWidth = 1000;
            //this.MaxHeight = 700;
            //this.SizeToContent = SizeToContent.WidthAndHeight;

            this.InitializeComponent();
        }

        private static readonly PropertyInfo criticalHandlePropertyInfo = typeof(Window).GetProperty("CriticalHandle", BindingFlags.NonPublic | BindingFlags.Instance);
        private static readonly object[] emptyObjectArray = new object[0];

        private void TitleBarGrid_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (e.ClickCount == 1)
            {
                e.Handled = true;

                // taken from DragMove internal code
                this.VerifyAccess();

                // for the touch usage
#pragma warning disable 618
                UnsafeNativeMethods.ReleaseCapture();

                var criticalHandle = (IntPtr)criticalHandlePropertyInfo.GetValue(this, emptyObjectArray);
                // DragMove works too, but not on maximized windows
                NativeMethods.SendMessage(criticalHandle, WM.SYSCOMMAND, (IntPtr)SC.MOUSEMOVE, IntPtr.Zero);
                NativeMethods.SendMessage(criticalHandle, WM.LBUTTONUP, IntPtr.Zero, IntPtr.Zero);
#pragma warning restore 618
            }
            else if (e.ClickCount == 2
                     && this.ResizeMode != ResizeMode.NoResize)
            {
                e.Handled = true;
                this.WindowState = this.WindowState == WindowState.Maximized
                                         ? WindowState.Normal
                                         : WindowState.Maximized;
            }
        }

        private void TitleBarGrid_OnMouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
#pragma warning disable 618
            SystemCommands.ShowSystemMenu(this, e);
#pragma warning restore 618
        }
    }
}<commit_msg>Using SystemCommands instead of WindowState<commit_after>﻿namespace ControlzEx.Showcase
{
    using System;
    using System.Reflection;
    using System.Windows;
    using System.Windows.Input;
    using ControlzEx.Native;
    using ControlzEx.Standard;

    public partial class MainWindow
    {
        public MainWindow()
        {
            //this.ShowActivated = false;
            //this.MaxWidth = 1000;
            //this.MaxHeight = 700;
            //this.SizeToContent = SizeToContent.WidthAndHeight;

            this.InitializeComponent();
        }

        private static readonly PropertyInfo criticalHandlePropertyInfo = typeof(Window).GetProperty("CriticalHandle", BindingFlags.NonPublic | BindingFlags.Instance);
        private static readonly object[] emptyObjectArray = new object[0];

        private void TitleBarGrid_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (e.ClickCount == 1)
            {
                e.Handled = true;

                // taken from DragMove internal code
                this.VerifyAccess();

                // for the touch usage
#pragma warning disable 618
                UnsafeNativeMethods.ReleaseCapture();

                var criticalHandle = (IntPtr)criticalHandlePropertyInfo.GetValue(this, emptyObjectArray);
                // DragMove works too, but not on maximized windows
                NativeMethods.SendMessage(criticalHandle, WM.SYSCOMMAND, (IntPtr)SC.MOUSEMOVE, IntPtr.Zero);
                NativeMethods.SendMessage(criticalHandle, WM.LBUTTONUP, IntPtr.Zero, IntPtr.Zero);
#pragma warning restore 618
            }
            else if (e.ClickCount == 2
                     && this.ResizeMode != ResizeMode.NoResize)
            {
                e.Handled = true;

#pragma warning disable 618
                if (this.WindowState == WindowState.Normal)
                {
                    ControlzEx.Windows.Shell.SystemCommands.MaximizeWindow(this);
                }
                else
                {
                    ControlzEx.Windows.Shell.SystemCommands.RestoreWindow(this);
                }
#pragma warning restore 618
            }
        }

        private void TitleBarGrid_OnMouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
#pragma warning disable 618
            SystemCommands.ShowSystemMenu(this, e);
#pragma warning restore 618
        }
    }
}
{'fraction_non_alphanumeric': 0.07605042016806722, 'fraction_numerical': 0.011764705882352941, 'mean_word_length': 1.960820895522388, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3508978', 'n_tokens_mistral': 1233, 'n_tokens_neox': 1140, 'n_words': 270}