Ejemplo n.º 1
0
        private void ConfigPoint(bool createNew = false)
        {
            var wnd = new View.ConfigWindows.DialogWindow();

            wnd.Owner = Helpers.MVVM.MVVMHelper.GetActiveWindow();
            wnd.Title = createNew ? "Создание точки" : "Редактирование точки";
            var cont = new View.ConfigWindows.WayPointConfigPanel();

            wnd.Content = cont;

            WayPointViewModel wpvm = null;

            if (createNew || _selectedIOPoint == null)
            {
                WayPoint wp = new WayPoint(0, 0, Layers.IndexOf(SelectedLayer), 5, 5);
                wpvm         = new WayPointViewModel(_scenario.Services, AllWayPoints.Select(p => p.WayPoint), wp);
                wpvm.LayerId = Layers.IndexOf(_selectedLayer);
            }
            else
            {
                wpvm           = _selectedIOPoint;
                wpvm.CloseView = false;
            }

            wnd.DataContext = wpvm;
            wnd.ShowDialog();
            if (wpvm.DialogResult == true)
            {
                if (createNew)
                {
                    AllWayPoints.Add(wpvm);
                    OnPropertyChanged("IOPoints");
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Метод, отлавливающий захват контрольного комплекса мышью
 /// </summary>
 /// <param name="el">Источник</param>
 private void OnMouseLeftButtonDown(UIElement el)
 {
     _isDown = true;
     _mouseDownOnSourcePoint = Mouse.GetPosition(el);
     _dragSource             = IOPoints.FirstOrDefault(p => new Rect(p.X, p.Y, p.Width, p.Height).Contains(_mouseDownOnSourcePoint));
     if (_dragSource == null)
     {
         _isDown = false;
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Метод, отлавливающий освобождение контрольного комплекса мышью
 /// </summary>
 /// <param name="el">Источник</param>
 private void OnMouseLeftButtonUp(UIElement el)
 {
     if (_isDown)
     {
         if (_isDragging)
         {
             System.Windows.Input.Mouse.Capture(null);
             _isDragging = false;
             _dragSource.SaveCommand.Execute(null);
             _dragSource = null;
         }
         _isDown = false;
     }
 }
 /// <summary>
 /// Метод, отлавливающий освобождение контрольного комплекса мышью
 /// </summary>
 /// <param name="el">Источник</param>
 private void OnMouseLeftButtonUp(UIElement el)
 {
     if (_isDown)
     {
         if (_isDragging)
         {
             System.Windows.Input.Mouse.Capture(null);
             _isDragging = false;
             _dragSource.SaveCommand.Execute(null);
             _dragSource = null;
         }
         _isDown = false;
     }
 }
 /// <summary>
 /// Метод, отлавливающий захват контрольного комплекса мышью
 /// </summary>
 /// <param name="el">Источник</param>
 private void OnMouseLeftButtonDown(UIElement el)
 {
     _isDown = true;
     _mouseDownOnSourcePoint = Mouse.GetPosition(el);
     _dragSource = IOPoints.FirstOrDefault(p => new Rect(p.X, p.Y, p.Width, p.Height).Contains(_mouseDownOnSourcePoint));
     if (_dragSource == null)
     {
         _isDown = false;
     }
 }
        private void ConfigPoint(bool createNew = false)
        {
            var wnd = new View.ConfigWindows.DialogWindow();
            wnd.Owner = Helpers.MVVM.MVVMHelper.GetActiveWindow();
            wnd.Title = createNew ? "Создание точки" : "Редактирование точки";
            var cont = new View.ConfigWindows.WayPointConfigPanel();
            wnd.Content = cont;

            WayPointViewModel wpvm = null;
            if (createNew || _selectedIOPoint == null)
            {
                WayPoint wp = new WayPoint(0, 0, Layers.IndexOf(SelectedLayer), 5, 5);
                wpvm = new WayPointViewModel(_scenario.Services, AllWayPoints.Select(p => p.WayPoint), wp);
                wpvm.LayerId = Layers.IndexOf(_selectedLayer);
            }
            else
            {
                wpvm = _selectedIOPoint;
                wpvm.CloseView = false;
            }

            wnd.DataContext = wpvm;
            wnd.ShowDialog();
            if (wpvm.DialogResult == true)
            {
                if (createNew)
                {
                    AllWayPoints.Add(wpvm);
                    OnPropertyChanged("IOPoints");
                }
            }
        }