public void UpdateOnSelect(Fig selfig, IEnumerable <Fig> sellist)
 {
     _selfig     = selfig;
     _sellist    = sellist;
     DataContext = _selfig;
     if (_selfig != null)
     {
         var fp = CultureInfo.GetCultureInfo("en-US");
         LeftEdit.Text   = selfig.Left.ToString(fp);
         TopEdit.Text    = selfig.Top.ToString(fp);
         WidthEdit.Text  = selfig.Width.ToString(fp);
         HeightEdit.Text = selfig.Height.ToString(fp);
     }
     CustomsTable.CellEditEnding    -= CustomsTable_CellEditEnding;
     _customProps.CollectionChanged -= _customProps_CollectionChanged;
     _customProps.Clear();
     if (_selfig != null && _selfig.Customs != null)
     {
         foreach (var prop in _selfig.Customs)
         {
             _customProps.Add(prop);
         }
     }
     CustomsTable.CellEditEnding    += CustomsTable_CellEditEnding;
     _customProps.CollectionChanged += _customProps_CollectionChanged;
 }
 public FigPropsEditor(Fig selfig, IEnumerable <Fig> sellist)
 {
     InitializeComponent();
     UpdateOnSelect(selfig, sellist);
     CustomsTable.ItemsSource        = _customProps;
     CustomsTable.CellEditEnding    += CustomsTable_CellEditEnding;
     _customProps.CollectionChanged += _customProps_CollectionChanged;
 }
예제 #3
0
        private void UpdatePropsEditorWindow(Fig fig, IEnumerable <Fig> list, bool firstCall)
        {
            if (firstCall)
            {
                if (_propWindowEditor == null)
                {
                    switch (DrawingSurface.EditorMode)
                    {
                    case EditorMode.AsScheme:
                        DrawingSurface.Scheme.PropertyChanged +=
                            (o, args) => { SaveContentButton.IsEnabled = true; };
                        _propWindowEditor = new PagePropsEditor(DrawingSurface.Scheme,
                                                                DrawingSurface.GetFilesFolder())
                        {
                            Owner      = this,
                            Visibility = Visibility.Hidden
                        };
                        break;

                    case EditorMode.AsShape:
                        DrawingSurface.Shape.PropertyChanged +=
                            (o, args) => { SaveContentButton.IsEnabled = true; };
                        _propWindowEditor = new ShapePropsEditor(DrawingSurface.Shape)
                        {
                            Owner      = this,
                            Visibility = Visibility.Hidden
                        };
                        break;
                    }
                }
                if (_propFigEditor == null)
                {
                    _propFigEditor = new FigPropsEditor(DrawingSurface.SelectedFig,
                                                        DrawingSurface.SelectedList)
                    {
                        Owner      = this,
                        Visibility = Visibility.Hidden
                    };
                }
            }
            if (_propFigEditor == null || _propWindowEditor == null)
            {
                return;
            }
            if (fig == null)
            {
                if (_propFigEditor.Visibility == Visibility.Visible || firstCall)
                {
                    _propWindowEditor.Left       = _propFigEditor.Left;
                    _propWindowEditor.Top        = _propFigEditor.Top;
                    _propWindowEditor.Visibility = Visibility.Visible;
                    _propFigEditor.Visibility    = Visibility.Hidden;
                }
            }
            else
            {
                if (_propWindowEditor.Visibility == Visibility.Visible || firstCall)
                {
                    _propFigEditor.Left          = _propWindowEditor.Left;
                    _propFigEditor.Top           = _propWindowEditor.Top;
                    _propFigEditor.Visibility    = Visibility.Visible;
                    _propWindowEditor.Visibility = Visibility.Hidden;
                }
                ((FigPropsEditor)_propFigEditor).UpdateOnSelect(fig, list);
            }
        }