예제 #1
0
        protected void OnClosingWindow(ClosingWindowEventArgs args)
        {
            var handler = ClosingWindow;

            if (handler != null)
            {
                handler(this, args);
            }
        }
예제 #2
0
#pragma warning restore 618

        private void CloseClick(object sender, RoutedEventArgs e)
        {
            var closingWindowEventHandlerArgs = new ClosingWindowEventArgs();

            OnClosingWindow(closingWindowEventHandlerArgs);

            if (closingWindowEventHandlerArgs.Cancelled)
            {
                return;
            }

            if (null == this.ParentWindow)
            {
                return;
            }
            this.ParentWindow.Close();
        }