Exemple #1
0
        /// <summary>
        /// Converts the given value object to the specified type, using the specified
        /// context and culture information.
        /// </summary>
        /// <param name="context">An ITypeDescriptorContext that provides a format context.</param>
        /// <param name="culture">A CultureInfo. If nullNothingnullptra null reference
        /// (Nothing in Visual Basic) is passed, the current culture is assumed.</param>
        /// <param name="value">The Object to convert.</param>
        /// <param name="destinationType">The Type to convert the value parameter to.</param>
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            try
            {
                MSDataGridHelperLayoutInfo dgi = null;
                if (destinationType == typeof(InstanceDescriptor) && value is MSDataGridHelperLayoutInfo)
                {
                    dgi = (MSDataGridHelperLayoutInfo)value;

                    ConstructorInfo ctor = typeof(MSDataGridHelperLayoutInfo).GetConstructor(new Type[] { typeof(Splits), typeof(Columns), typeof(string) });
                    if (ctor != null)
                    {
                        return(new InstanceDescriptor(ctor, new object[] { dgi.GridSplits, dgi.GridColumns, System.DateTime.Now.ToString() }));
                    }
                }

                if (destinationType == typeof(string) && value is MSDataGridHelperLayoutInfo)
                {
                    return("[Grid Layout]");
                }
            }
            catch { }

            return(base.ConvertTo(context, culture, value, destinationType));
        }
 /// <summary>
 /// Sets a grid layout to a given grid.
 /// </summary>
 /// <param name="grid">The grid to set the grid layout to.</param>
 /// <param name="value">The new grid layout.</param>
 public void SetGridLayout(object grid, MSDataGridHelperLayoutInfo value)
 {
     if (!gridLayout.ContainsKey(grid))
         gridLayout.Add(grid, value);
     else
         gridLayout[grid] = value;
 }
Exemple #3
0
 /// <summary>
 /// Sets a grid layout to a given grid.
 /// </summary>
 /// <param name="grid">The grid to set the grid layout to.</param>
 /// <param name="value">The new grid layout.</param>
 public void SetGridLayout(object grid, MSDataGridHelperLayoutInfo value)
 {
     if (!gridLayout.ContainsKey(grid))
     {
         gridLayout.Add(grid, value);
     }
     else
     {
         gridLayout[grid] = value;
     }
 }
 /// <summary>
 /// Builds an instance of MSDataGridHelperDesignerModalView with 
 /// the specified grid layout information object.
 /// </summary>
 /// <param name="gridInfo">A MSDataGridHelperLayoutInfo containing the grid layout information 
 /// for the new instance.</param>
 public MSDataGridHelperDesignerModalView(MSDataGridHelperLayoutInfo gridInfo)
 {
     InitializeComponent();
     _gridInfo = gridInfo;
 }
 /// <summary>
 /// Builds an instance of MSDataGridHelperDesignerModalView with
 /// the specified grid layout information object.
 /// </summary>
 /// <param name="gridInfo">A MSDataGridHelperLayoutInfo containing the grid layout information
 /// for the new instance.</param>
 public MSDataGridHelperDesignerModalView(MSDataGridHelperLayoutInfo gridInfo)
 {
     InitializeComponent();
     _gridInfo = gridInfo;
 }