Exemple #1
0
        /// <summary>
        /// Creates a new object that is a copy of the current instance.
        /// </summary>
        /// <returns>
        /// A new object that is a copy of this instance.
        /// </returns>
        public virtual object Clone()
        {
            MemoryStream stream = new MemoryStream();

            try
            {
                XmlWriter writer = XmlWriter.Create((Stream)stream);
                if (writer != null)
                {
                    Serializer.SerializeObj(this, "FloatingObject", writer);
                    writer.Close();
                    stream.Seek(0L, (SeekOrigin)SeekOrigin.Begin);
                    XmlReader @this = XmlReader.Create((Stream)stream);
                    if (@this != null)
                    {
                        FloatingObject obj2 = this.CreateObjectOnClone();
                        ((IXmlSerializable)obj2).ReadXml(@this);
                        @this.Close();
                        return(obj2);
                    }
                }
            }
            finally
            {
                ((Stream)stream).Close();
            }
            return(null);
        }
Exemple #2
0
        public FloatingObjectContainer(Dt.Cells.Data.FloatingObject floatingObject, CellsPanel parentViewport)
        {
            _floatingObject            = floatingObject;
            base.Visibility            = floatingObject.Visible ? Visibility.Visible : Visibility.Collapsed;
            ParentViewport             = parentViewport;
            Loaded                    += FloatingObjectContainer_Loaded;
            _outBorder                 = new Border();
            _outBorder.BorderBrush     = BorderBrush;
            _outBorder.Background      = BorderGapBrush;
            _outBorder.BorderThickness = new Thickness(2.0);
            _outBorder.CornerRadius    = new Windows.UI.Xaml.CornerRadius(5.0);
            base.Children.Add(_outBorder);
            _glyphGrid = new Grid();
            base.Children.Add(_glyphGrid);
            RowDefinition definition = new RowDefinition();

            definition.Height = new Windows.UI.Xaml.GridLength(7.0);
            _glyphGrid.RowDefinitions.Add(definition);
            _glyphGrid.RowDefinitions.Add(new RowDefinition());
            RowDefinition definition2 = new RowDefinition();

            definition2.Height = new Windows.UI.Xaml.GridLength(7.0);
            _glyphGrid.RowDefinitions.Add(definition2);
            ColumnDefinition definition3 = new ColumnDefinition();

            definition3.Width = new Windows.UI.Xaml.GridLength(7.0);
            _glyphGrid.ColumnDefinitions.Add(definition3);
            _glyphGrid.ColumnDefinitions.Add(new ColumnDefinition());
            ColumnDefinition definition4 = new ColumnDefinition();

            definition4.Width = new Windows.UI.Xaml.GridLength(7.0);
            _glyphGrid.ColumnDefinitions.Add(definition4);
            _leftRect        = new Rectangle();
            _leftRect.Margin = new Thickness(-1.0, 0.0, 1.0, 0.0);
            _leftRect.Fill   = BorderGapBrush;
            _glyphGrid.Children.Add(_leftRect);
            Grid.SetColumn(_leftRect, 0);
            Grid.SetRowSpan(_leftRect, 3);
            _topRect        = new Rectangle();
            _topRect.Margin = new Thickness(0.0, -1.0, 0.0, 1.0);
            _topRect.Fill   = BorderGapBrush;
            _glyphGrid.Children.Add(_topRect);
            Grid.SetRow(_topRect, 0);
            Grid.SetColumnSpan(_topRect, 3);
            _rightRect        = new Rectangle();
            _rightRect.Margin = new Thickness(1.0, 0.0, -1.0, 0.0);
            _rightRect.Fill   = BorderGapBrush;
            _glyphGrid.Children.Add(_rightRect);
            Grid.SetColumn(_rightRect, 2);
            Grid.SetRowSpan(_rightRect, 3);
            _bottomRect        = new Rectangle();
            _bottomRect.Margin = new Thickness(0.0, 1.0, 0.0, -1.0);
            _bottomRect.Fill   = BorderGapBrush;
            _glyphGrid.Children.Add(_bottomRect);
            Grid.SetRow(_bottomRect, 2);
            Grid.SetColumnSpan(_bottomRect, 3);

            _topLeftRect        = new Image();
            _topLeftRect.Width  = 7.0;
            _topLeftRect.Height = 7.0;
            _glyphGrid.Children.Add(_topLeftRect);
            Grid.SetRow(_topLeftRect, 0);
            Grid.SetColumn(_topLeftRect, 0);
            _topCentertRect                   = new Image();
            _topCentertRect.Width             = 15.0;
            _topCentertRect.Height            = 3.0;
            _topCentertRect.VerticalAlignment = VerticalAlignment.Top;
            _glyphGrid.Children.Add(_topCentertRect);
            Grid.SetRow(_topCentertRect, 0);
            Grid.SetColumn(_topCentertRect, 1);
            _topRightRect        = new Image();
            _topRightRect.Width  = 7.0;
            _topRightRect.Height = 7.0;
            _glyphGrid.Children.Add(_topRightRect);
            Grid.SetRow(_topRightRect, 0);
            Grid.SetColumn(_topRightRect, 2);
            _middleLeftRect        = new Image();
            _middleLeftRect.Width  = 3.0;
            _middleLeftRect.Height = 15.0;
            _middleLeftRect.HorizontalAlignment = HorizontalAlignment.Left;
            _glyphGrid.Children.Add(_middleLeftRect);
            Grid.SetRow(_middleLeftRect, 1);
            Grid.SetColumn(_middleLeftRect, 0);
            _middleRightRect        = new Image();
            _middleRightRect.Width  = 3.0;
            _middleRightRect.Height = 15.0;
            _middleRightRect.HorizontalAlignment = HorizontalAlignment.Right;
            _glyphGrid.Children.Add(_middleRightRect);
            Grid.SetRow(_middleRightRect, 1);
            Grid.SetColumn(_middleRightRect, 2);
            _bottomLeftRect        = new Image();
            _bottomLeftRect.Width  = 7.0;
            _bottomLeftRect.Height = 7.0;
            _glyphGrid.Children.Add(_bottomLeftRect);
            Grid.SetRow(_bottomLeftRect, 2);
            Grid.SetColumn(_bottomLeftRect, 0);
            _bottomCenterRect                   = new Image();
            _bottomCenterRect.Width             = 15.0;
            _bottomCenterRect.Height            = 3.0;
            _bottomCenterRect.VerticalAlignment = VerticalAlignment.Bottom;
            _glyphGrid.Children.Add(_bottomCenterRect);
            Grid.SetRow(_bottomCenterRect, 2);
            Grid.SetColumn(_bottomCenterRect, 1);
            _bottomRightRect        = new Image();
            _bottomRightRect.Width  = 7.0;
            _bottomRightRect.Height = 7.0;
            _glyphGrid.Children.Add(_bottomRightRect);
            Grid.SetRow(_bottomRightRect, 2);
            Grid.SetColumn(_bottomRightRect, 2);
            LoadImages();

            _innerBorder                 = new Border();
            _innerBorder.BorderBrush     = BorderBrush;
            _innerBorder.BorderThickness = new Thickness(2.0);
            _innerBorder.CornerRadius    = new Windows.UI.Xaml.CornerRadius(10.0);
            Children.Add(_innerBorder);
            _contentPanel            = new Border();
            _contentPanel.Background = new SolidColorBrush(Colors.Transparent);
            Children.Add(_contentPanel);
            _defaultContent     = new Border();
            _contentPanel.Child = _defaultContent;
            UpdateElements(false);
        }