Пример #1
0
 private Task OnClosing(ClosingEvent arg)
 {
     if (_restartServiceOnExit && !IsServiceRunning)
     {
         StartService();
     }
     return(Task.CompletedTask);
 }
Пример #2
0
 private void fEnter_FormClosing(object sender, FormClosingEventArgs e)
 {
     ClosingEvent?.Invoke();
 }
Пример #3
0
 Task OnClosing(ClosingEvent arg)
 {
     SystemEvents.SessionSwitch -= SystemEvents_SessionSwitch;
     return(Task.CompletedTask);
 }
Пример #4
0
 private void OnRaiseClosingEvent()
 {
     ClosingEvent?.Invoke(this, new EventArgs());
 }
 protected override int QueryClose(out bool canClose)
 {
     ClosingEvent?.Invoke(this, EventArgs.Empty);
     return(base.QueryClose(out canClose));
 }
Пример #6
0
 public void OnClose()
 {
     Closed = true;
     ClosingEvent?.Invoke();
 }
Пример #7
0
 remove => RemoveHandler(ClosingEvent, value);
Пример #8
0
 add => AddHandler(ClosingEvent, value);
Пример #9
0
        public UiEncodingWindow()
        {
            #region Construct

            WindowStartupLocation = WindowStartupLocation.CenterScreen;
            ResizeMode            = ResizeMode.CanMinimize;
            Width  = 1024;
            Height = 768;

            UiGrid root = UiGridFactory.Create(4, 1);
            {
                root.RowDefinitions[0].Height = GridLength.Auto;
                root.RowDefinitions[2].Height = GridLength.Auto;
                root.RowDefinitions[3].Height = GridLength.Auto;

                _comboBox = UiComboBoxFactory.Create();
                {
                    _comboBox.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
                    _comboBox.Margin            = new Thickness(3);
                    _comboBox.DisplayMemberPath = "DisplayName";
                    _comboBox.SelectionChanged += OnComboBoxItemChanged;
                    root.AddUiElement(_comboBox, 0, 0);
                }

                _editViewport = new UiDxViewport();
                {
                    _editViewport.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
                    _editViewport.VerticalAlignment   = VerticalAlignment.Stretch;

                    _editViewport.DrawSprites    += OnEditViewportDrawSprites;
                    _editViewport.DrawPrimitives += OnEditViewportDrawPrimitives;

                    _editViewport.DxControl.Control.MouseDown += OnDxControlElementMouseDown;
                    _editViewport.DxControl.Control.MouseUp   += OnDxControlElementMouseUp;
                    _editViewport.DxControl.Control.MouseMove += OnDxControlElementMouseMove;

                    root.AddUiElement(_editViewport, 1, 0);
                }

                UiGrid previewGroup = UiGridFactory.Create(2, 2);
                {
                    previewGroup.RowDefinitions[0].Height   = GridLength.Auto;
                    previewGroup.ColumnDefinitions[1].Width = GridLength.Auto;

                    _previewViewport = new UiDxViewport();
                    {
                        _previewViewport.Height = 200;
                        _previewViewport.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
                        _previewViewport.VerticalAlignment   = VerticalAlignment.Stretch;

                        _previewViewport.DrawSprites += OnPreviewViewportDraw;
                        _previewViewport.DxControl.RenderContainer.BackBuffer.BackgroundColor = Colors.Black;

                        previewGroup.AddUiElement(_previewViewport, 0, 0, 2);
                    }

                    UiEncodingLabeledNumber scale = new UiEncodingLabeledNumber("Масштаб:", 200, 100, 400, OnScaleValueChanged);
                    {
                        scale.Value = 100;
                        scale.NumberControl.Increment = 25;
                        previewGroup.AddUiElement(scale, 0, 1);
                    }

                    UiTextBox textBox = UiTextBoxFactory.Create();
                    {
                        textBox.Text         = _previewText;
                        textBox.TextChanged += OnPreviewTextChanged;
                        previewGroup.AddUiElement(textBox, 1, 1);
                    }

                    root.AddUiElement(previewGroup, 2, 0);
                }

                _charactersControl = new UiEncodingCharactersControl();
                {
                    root.AddUiElement(_charactersControl, 3, 0);
                }

                UiButton button = UiButtonFactory.Create("OK");
                {
                    button.Width  = 70;
                    button.Margin = new Thickness(3);
                    button.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
                    button.Click += (s, a) => DialogResult = true;
                    root.AddUiElement(button, 3, 0);
                }
            }
            Content = root;

            _editViewport.DxControl.RenderContainer.Reseted += ResetBurshes;
            ResetBurshes(_editViewport.DxControl.RenderContainer);

            Thread movingThread = new Thread(MovingThread);
            movingThread.Start();

            Activated += OnWindowActivated;
            Closing   += (s, e) => ClosingEvent.Set();
            Closing   += OnWindowClosing;

            #endregion
        }