added Revit 2020 SDK files

This commit is contained in:
Jeremy Tammik
2019-09-11 14:43:53 +02:00
parent fbb29172ed
commit 8b8832b7be
2956 changed files with 938523 additions and 0 deletions
@@ -0,0 +1,65 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
namespace Revit.SDK.Samples.NewHostedSweep.CS
{
/// <summary>
/// This class is intent to convert CreationData to String.
/// </summary>
class CreationDataTypeConverter : TypeConverter
{
/// <summary>
/// CreationData can convert to string.
/// </summary>
/// <param name="context"></param>
/// <param name="destinationType"></param>
/// <returns></returns>
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{
return destinationType == typeof(String);
}
/// <summary>
/// Convert CreationData to string.
/// </summary>
/// <param name="context"></param>
/// <param name="culture"></param>
/// <param name="value"></param>
/// <param name="destinationType"></param>
/// <returns></returns>
public override object ConvertTo(ITypeDescriptorContext context,
System.Globalization.CultureInfo culture, object value, Type destinationType)
{
CreationData cd = value as CreationData;
if (cd != null)
{
return "Total " + cd.EdgesForHostedSweep.Count + " Edges";
}
return base.ConvertTo(context, culture, value, destinationType);
}
}
}
@@ -0,0 +1,217 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
namespace Revit.SDK.Samples.NewHostedSweep.CS
{
partial class EdgeFetchForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EdgeFetchForm));
this.comboBoxTypes = new System.Windows.Forms.ComboBox();
this.groupBoxEdges = new System.Windows.Forms.GroupBox();
this.treeViewHost = new System.Windows.Forms.TreeView();
this.buttonOK = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.pictureBoxPreview = new System.Windows.Forms.PictureBox();
this.label = new System.Windows.Forms.Label();
this.imageListForCheckBox = new System.Windows.Forms.ImageList(this.components);
this.labelHit = new System.Windows.Forms.Label();
this.groupBoxEdges.SuspendLayout();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPreview)).BeginInit();
this.SuspendLayout();
//
// comboBoxTypes
//
this.comboBoxTypes.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxTypes.FormattingEnabled = true;
this.comboBoxTypes.Location = new System.Drawing.Point(12, 38);
this.comboBoxTypes.Name = "comboBoxTypes";
this.comboBoxTypes.Size = new System.Drawing.Size(207, 21);
this.comboBoxTypes.TabIndex = 3;
//
// groupBoxEdges
//
this.groupBoxEdges.Controls.Add(this.treeViewHost);
this.groupBoxEdges.Location = new System.Drawing.Point(12, 65);
this.groupBoxEdges.Name = "groupBoxEdges";
this.groupBoxEdges.Size = new System.Drawing.Size(207, 610);
this.groupBoxEdges.TabIndex = 4;
this.groupBoxEdges.TabStop = false;
this.groupBoxEdges.Text = "Extract Edges for HostedSweep";
//
// treeViewHost
//
this.treeViewHost.Dock = System.Windows.Forms.DockStyle.Fill;
this.treeViewHost.Location = new System.Drawing.Point(3, 16);
this.treeViewHost.Name = "treeViewHost";
this.treeViewHost.Size = new System.Drawing.Size(201, 591);
this.treeViewHost.TabIndex = 1;
this.treeViewHost.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.treeViewHost_BeforeExpand);
this.treeViewHost.NodeMouseHover += new System.Windows.Forms.TreeNodeMouseHoverEventHandler(this.treeViewHost_NodeMouseHover);
this.treeViewHost.BeforeCollapse += new System.Windows.Forms.TreeViewCancelEventHandler(this.treeViewHost_BeforeCollapse);
this.treeViewHost.KeyDown += new System.Windows.Forms.KeyEventHandler(this.treeViewHost_KeyDown);
this.treeViewHost.MouseDown += new System.Windows.Forms.MouseEventHandler(this.treeViewHost_MouseDown);
//
// buttonOK
//
this.buttonOK.Location = new System.Drawing.Point(28, 681);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 23);
this.buttonOK.TabIndex = 5;
this.buttonOK.Text = "&OK";
this.buttonOK.UseVisualStyleBackColor = true;
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
//
// buttonCancel
//
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.Location = new System.Drawing.Point(125, 681);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 6;
this.buttonCancel.Text = "&Cancel";
this.buttonCancel.UseVisualStyleBackColor = true;
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.pictureBoxPreview);
this.groupBox1.Location = new System.Drawing.Point(225, 11);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(604, 615);
this.groupBox1.TabIndex = 8;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Preview";
//
// pictureBoxPreview
//
this.pictureBoxPreview.BackColor = System.Drawing.SystemColors.WindowText;
this.pictureBoxPreview.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBoxPreview.Location = new System.Drawing.Point(3, 16);
this.pictureBoxPreview.Name = "pictureBoxPreview";
this.pictureBoxPreview.Size = new System.Drawing.Size(598, 596);
this.pictureBoxPreview.TabIndex = 10;
this.pictureBoxPreview.TabStop = false;
this.pictureBoxPreview.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBoxPreview_MouseDown);
this.pictureBoxPreview.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBoxPreview_MouseMove);
this.pictureBoxPreview.Paint += new System.Windows.Forms.PaintEventHandler(this.pictureBoxPreview_Paint);
this.pictureBoxPreview.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pictureBoxPreview_MouseClick);
//
// label
//
this.label.AutoSize = true;
this.label.Location = new System.Drawing.Point(15, 11);
this.label.Name = "label";
this.label.Size = new System.Drawing.Size(157, 13);
this.label.TabIndex = 9;
this.label.Text = "Select a type for HostedSweep:";
//
// imageListForCheckBox
//
this.imageListForCheckBox.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageListForCheckBox.ImageStream")));
this.imageListForCheckBox.TransparentColor = System.Drawing.Color.Transparent;
this.imageListForCheckBox.Images.SetKeyName(0, "CBUnchecked.bmp");
this.imageListForCheckBox.Images.SetKeyName(1, "CBchecked.bmp");
this.imageListForCheckBox.Images.SetKeyName(2, "CBIndeterminate.bmp");
//
// labelHit
//
this.labelHit.AutoSize = true;
this.labelHit.Location = new System.Drawing.Point(226, 633);
this.labelHit.Name = "labelHit";
this.labelHit.Size = new System.Drawing.Size(527, 52);
this.labelHit.TabIndex = 10;
this.labelHit.Text = resources.GetString("labelHit.Text");
//
// EdgeFetchForm
//
this.AcceptButton = this.buttonOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(834, 716);
this.Controls.Add(this.labelHit);
this.Controls.Add(this.label);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonOK);
this.Controls.Add(this.groupBoxEdges);
this.Controls.Add(this.comboBoxTypes);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "EdgeFetchForm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Extract edges for Hosted Sweep";
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.EdgeFetch_KeyDown);
this.Load += new System.EventHandler(this.EdgeFetch_Load);
this.groupBoxEdges.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPreview)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ComboBox comboBoxTypes;
private System.Windows.Forms.GroupBox groupBoxEdges;
private System.Windows.Forms.Button buttonOK;
private System.Windows.Forms.Button buttonCancel;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TreeView treeViewHost;
private System.Windows.Forms.Label label;
private System.Windows.Forms.ImageList imageListForCheckBox;
private System.Windows.Forms.PictureBox pictureBoxPreview;
private System.Windows.Forms.Label labelHit;
}
}
@@ -0,0 +1,644 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using System.Drawing.Drawing2D;
namespace Revit.SDK.Samples.NewHostedSweep.CS
{
/// <summary>
/// This form is intent to fetch edges for hosted sweep creation or modification.
/// It contains a picture box for geometry preview and a tree view to list all the edges
/// which hosted sweep can be created on.
/// If the user mouse-over an edge where a hosted sweep can be created, the edge will be
/// highlighted in yellow. If user clicks on the highlighted edge, the edge will
/// be marked as selected in red color. Click it again to un-select, the color will turn back.
/// Edge selection from preview box will be reflected in edge list and vice versa.
/// The geometry displayed in the picture box can be rotated with left mouse or
/// arrow keys (up, down, left and right) and zoomed with right mouse.
/// </summary>
public partial class EdgeFetchForm : System.Windows.Forms.Form
{
#region Fields and Constructors
/// <summary>
/// Contains all the data need to fetch edges.
/// </summary>
private CreationData m_creationData;
/// <summary>
/// Flag to indicate whether or not we should cancel expand or collapse
/// the tree-node which contains children.
/// </summary>
private bool m_cancelExpandOrCollapse;
/// <summary>
/// Active element displayed in the preview.
/// </summary>
private Autodesk.Revit.DB.Element m_activeElem;
/// <summary>
/// Yield rotation and scale transformation for current geometry display.
/// </summary>
private TrackBall m_trackBall;
/// <summary>
/// Move the Graphics origin to preview center and flip its y-Axis.
/// </summary>
private Matrix m_centerMatrix;
/// <summary>
/// Default constructor.
/// </summary>
public EdgeFetchForm()
{
InitializeComponent();
}
/// <summary>
/// Customize constructor.
/// </summary>
/// <param name="creationData"></param>
public EdgeFetchForm(CreationData creationData)
: this()
{
m_creationData = creationData;
treeViewHost.StateImageList = imageListForCheckBox;
m_trackBall = new TrackBall();
}
#endregion
#region Initialize Methods
/// <summary>
/// Initialize the combo box data source with Autodesk.Revit.DB.
/// e.g. FasciaTypes, GutterTypes, SlabEdgeTypes, and so on.
/// </summary>
private void InitializeTypes()
{
List<object> objects = new List<object>();
object selected = null;
foreach (object obj in m_creationData.Creator.AllTypes)
{
objects.Add(obj);
if (m_creationData.Symbol != null)
{
if ((obj as Autodesk.Revit.DB.ElementType).Id.IntegerValue == m_creationData.Symbol.Id.IntegerValue)
{
selected = obj;
}
}
}
comboBoxTypes.DataSource = objects;
comboBoxTypes.DisplayMember = "Name";
if (selected != null)
comboBoxTypes.SelectedItem = selected;
}
/// <summary>
/// Initialize the TreeView: create a tree according to geometry edges
/// and set each node's check status to unchecked.
/// </summary>
private void InitializeTree()
{
HostedSweepCreator creator = m_creationData.Creator;
TreeNode rootNode = new TreeNode();
rootNode.StateImageIndex = (int)CheckState.Unchecked;
foreach (KeyValuePair<Autodesk.Revit.DB.Element, List<Edge>> pair in creator.SupportEdges)
{
Autodesk.Revit.DB.Element elem = pair.Key;
TreeNode elemNode = new TreeNode("[Id:" + elem.Id.IntegerValue + "] " + elem.Name);
elemNode.StateImageIndex = (int)CheckState.Unchecked;
rootNode.Nodes.Add(elemNode);
elemNode.Tag = elem;
int i = 1;
foreach (Edge edge in pair.Value)
{
TreeNode edgeNode = new TreeNode("Edge " + i);
edgeNode.StateImageIndex = (int)CheckState.Unchecked;
edgeNode.Tag = edge;
elemNode.Nodes.Add(edgeNode);
++i;
}
}
rootNode.Text = "Roofs";
if (creator is SlabEdgeCreator)
{
rootNode.Text = "Floors";
}
treeViewHost.Nodes.Add(rootNode);
treeViewHost.TopNode.Expand();
}
/// <summary>
/// Initialize element geometry.
/// </summary>
private void InitializeElementGeometry()
{
foreach (ElementGeometry elemGeom in m_creationData.Creator.ElemGeomDic.Values)
{
elemGeom.InitializeTransform(pictureBoxPreview.Width * 0.8, pictureBoxPreview.Height * 0.8);
elemGeom.ResetEdgeStates();
}
}
/// <summary>
/// Initialize tree check states according to edges which hosted sweep can be created on.
/// </summary>
private void InitializeTreeCheckStates()
{
if (m_creationData.EdgesForHostedSweep.Count == 0) return;
// Initialize edge binding selection state
foreach(Edge edge in m_creationData.EdgesForHostedSweep)
{
foreach(ElementGeometry elemGeom in m_creationData.Creator.ElemGeomDic.Values)
{
if(elemGeom.EdgeBindingDic.ContainsKey(edge))
{
elemGeom.EdgeBindingDic[edge].IsSelected = true;
}
}
}
// Initialize tree node selection state
// check on all the edges on which we created hostd sweeps
TreeNode root = treeViewHost.Nodes[0];
foreach(TreeNode elemNode in root.Nodes)
{
foreach(TreeNode edgeNode in elemNode.Nodes)
{
Edge edge = edgeNode.Tag as Edge;
if(m_creationData.EdgesForHostedSweep.IndexOf(edge) != -1)
{
edgeNode.StateImageIndex = (int)CheckState.Checked;
UpdateParent(edgeNode);
}
}
}
}
/// <summary>
/// Initialize text properties of this form.
/// </summary>
private void InitializeText()
{
this.Text = "Pick edges for " + m_creationData.Creator.Name;
this.label.Text = "Select a type for " + m_creationData.Creator.Name;
this.groupBoxEdges.Text = "All edges for " + m_creationData.Creator.Name;
}
/// <summary>
/// Initialize something related to the geometry preview.
/// </summary>
private void InitializePreview()
{
m_centerMatrix = new Matrix(1, 0, 0, -1,
(float)pictureBoxPreview.Width / 2.0f, (float)pictureBoxPreview.Height / 2.0f);
this.KeyPreview = true;
foreach (Autodesk.Revit.DB.Element elem in m_creationData.Creator.ElemGeomDic.Keys)
{
m_activeElem = elem;
break;
}
}
#endregion
#region Auxiliary Methods
/// <summary>
/// Extract the checked edges in the whole tree to CreationData.EdgesForHostedSweep.
/// </summary>
private void ExtractCheckedEdgesAndSelectedSymbol()
{
m_creationData.EdgesForHostedSweep.Clear();
TreeNode rootNode = treeViewHost.Nodes[0];
foreach (TreeNode hostNode in rootNode.Nodes)
{
foreach (TreeNode edgeNode in hostNode.Nodes)
{
if (edgeNode.StateImageIndex == (int)CheckState.Checked)
m_creationData.EdgesForHostedSweep.Add(edgeNode.Tag as Edge);
}
}
m_creationData.Symbol = comboBoxTypes.SelectedItem as Autodesk.Revit.DB.ElementType;
}
/// <summary>
/// Update tree node check status, it will impact its children and parents' status.
/// </summary>
/// <param name="node">Tree node to update</param>
/// <param name="state">CheckState value</param>
private void UpdateNodeCheckStatus(TreeNode node, CheckState state)
{
node.StateImageIndex = (int)state;
if(node.Tag != null && node.Tag is Edge && m_activeElem != null)
{
Edge edge = node.Tag as Edge;
Autodesk.Revit.DB.Element elem = node.Parent.Tag as Autodesk.Revit.DB.Element;
ElementGeometry elemGeom = m_creationData.Creator.ElemGeomDic[elem];
elemGeom.EdgeBindingDic[edge].IsSelected =
(node.StateImageIndex == (int)CheckState.Checked);
}
UpdateChildren(node);
UpdateParent(node);
}
/// <summary>
/// Recursively update tree children's status to match its parent status.
/// </summary>
/// <param name="node">Parent node whose children will be updated</param>
private void UpdateChildren(TreeNode node)
{
foreach (TreeNode child in node.Nodes)
{
if (child.StateImageIndex != node.StateImageIndex)
{
child.StateImageIndex = node.StateImageIndex;
if(m_activeElem != null && child.Tag != null && child.Tag is Edge)
{
Edge edge = child.Tag as Edge;
Autodesk.Revit.DB.Element elem = child.Parent.Tag as Autodesk.Revit.DB.Element;
ElementGeometry elemGeom = m_creationData.Creator.ElemGeomDic[elem];
elemGeom.EdgeBindingDic[edge].IsSelected =
(child.StateImageIndex == (int)CheckState.Checked);
}
}
UpdateChildren(child);
}
}
/// <summary>
/// Recursively update tree parent's status to match its children status.
/// </summary>
/// <param name="node">Child whose parents will be updated</param>
private void UpdateParent(TreeNode node)
{
TreeNode parent = node.Parent;
if (parent == null) return;
foreach (TreeNode brother in parent.Nodes)
{
if (brother.StateImageIndex != node.StateImageIndex)
{
parent.StateImageIndex = (int)CheckState.Indeterminate;
UpdateParent(parent);
return;
}
}
parent.StateImageIndex = node.StateImageIndex;
UpdateParent(parent);
}
/// <summary>
/// Switch geometry displayed in the preview according to the tree node.
/// </summary>
/// <param name="node">Tree node to active</param>
private void ActiveNode(TreeNode node)
{
if (node.Tag == null) return;
if (node.Tag is Autodesk.Revit.DB.Element)
m_activeElem = node.Tag as Autodesk.Revit.DB.Element;
else if (node.Tag is Edge)
{
m_activeElem = node.Parent.Tag as Autodesk.Revit.DB.Element;
}
}
/// <summary>
/// Clear Highlighted status of all highlighted edges.
/// </summary>
private void ClearAllHighLight()
{
if (m_activeElem == null) return;
ElementGeometry elemGeom = m_creationData.Creator.ElemGeomDic[m_activeElem];
foreach (Edge edge in m_creationData.Creator.SupportEdges[m_activeElem])
{
elemGeom.EdgeBindingDic[edge].IsHighLighted = false;
}
}
/// <summary>
/// Get the related tree node of an edit
/// </summary>
/// <param name="edge">Given edge to find its tree-node</param>
/// <returns>Tree-node matched with the given edge</returns>
private TreeNode GetEdgeTreeNode(Edge edge)
{
TreeNode result = null;
TreeNode root = treeViewHost.Nodes[0];
Stack<TreeNode> todo = new Stack<TreeNode>();
todo.Push(root);
while (todo.Count > 0)
{
TreeNode node = todo.Pop();
if (node.Tag != null && node.Tag is Edge && (node.Tag as Edge) == edge)
{
result = node;
break;
}
foreach (TreeNode tmpNode in node.Nodes)
{
todo.Push(tmpNode);
}
}
return result;
}
#endregion
#region Event handles
/// <summary>
/// Extract checked edges and verify there are edges
/// checked in the treeView, if there aren't edges to be checked, complain
/// about it with a message box, otherwise close this from.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonOK_Click(object sender, EventArgs e)
{
ExtractCheckedEdgesAndSelectedSymbol();
if (m_creationData.EdgesForHostedSweep.Count == 0)
{
TaskDialog.Show("Revit", "At least one edge should be selected!");
return;
}
this.DialogResult = DialogResult.OK;
this.Close();
}
/// <summary>
/// Close this form.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
/// <summary>
/// This form Load event handle, all the initializations will be in here.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void EdgeFetch_Load(object sender, EventArgs e)
{
InitializeTypes();
InitializeTree();
InitializeElementGeometry();
InitializeTreeCheckStates();
InitializeText();
InitializePreview();
}
/// <summary>
/// Suppress the default behaviors that double-click
/// on a tree-node which contains children will make the tree-node collapse or expand.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void treeViewHost_BeforeCollapse(object sender, TreeViewCancelEventArgs e)
{
if (m_cancelExpandOrCollapse)
e.Cancel = true;
m_cancelExpandOrCollapse = false;
}
/// <summary>
/// Suppress the default behaviors that double-click
/// on a tree-node which contains children will make the tree-node collapse or expand.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void treeViewHost_BeforeExpand(object sender, TreeViewCancelEventArgs e)
{
if (m_cancelExpandOrCollapse)
e.Cancel = true;
m_cancelExpandOrCollapse = false;
}
/// <summary>
/// Draw the geometry.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void pictureBoxPreview_Paint(object sender, PaintEventArgs e)
{
if (m_activeElem == null) return;
ElementGeometry elemGeo = null;
if (!m_creationData.Creator.ElemGeomDic.TryGetValue(m_activeElem, out elemGeo)) return;
e.Graphics.Transform = m_centerMatrix;
e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
elemGeo.Draw(e.Graphics);
}
/// <summary>
/// Initialize the track ball.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void pictureBoxPreview_MouseDown(object sender, MouseEventArgs e)
{
m_trackBall.OnMouseDown(pictureBoxPreview.Width, pictureBoxPreview.Height, e);
}
/// <summary>
/// Rotate or zoom the displayed geometry, or highlight the edge under the mouse location.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void pictureBoxPreview_MouseMove(object sender, MouseEventArgs e)
{
if (m_activeElem == null) return;
m_trackBall.OnMouseMove(e);
if (e.Button == MouseButtons.Left)
{
m_creationData.Creator.ElemGeomDic[m_activeElem].Rotation *= m_trackBall.Rotation;
pictureBoxPreview.Refresh();
}
else if (e.Button == MouseButtons.Right)
{
m_creationData.Creator.ElemGeomDic[m_activeElem].Scale *= m_trackBall.Scale;
pictureBoxPreview.Refresh();
}
if (e.Button == MouseButtons.None)
{
ClearAllHighLight();
pictureBoxPreview.Refresh();
Matrix mat = (Matrix)m_centerMatrix.Clone();
mat.Invert();
PointF[] pts = new PointF[1] { e.Location };
mat.TransformPoints(pts);
ElementGeometry elemGeom = m_creationData.Creator.ElemGeomDic[m_activeElem];
foreach (Edge edge in m_creationData.Creator.SupportEdges[m_activeElem])
{
if (elemGeom.EdgeBindingDic.ContainsKey(edge))
{
if (elemGeom.EdgeBindingDic[edge].HighLight(pts[0].X, pts[0].Y))
{
pictureBoxPreview.Refresh();
}
}
}
}
}
/// <summary>
/// Select or unselect edge
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void pictureBoxPreview_MouseClick(object sender, MouseEventArgs e)
{
if (m_activeElem == null || e.Button != MouseButtons.Left) return;
ElementGeometry elemGeom = m_creationData.Creator.ElemGeomDic[m_activeElem];
foreach (Edge edge in m_creationData.Creator.SupportEdges[m_activeElem])
{
if (elemGeom.EdgeBindingDic.ContainsKey(edge))
{
if (elemGeom.EdgeBindingDic[edge].IsHighLighted)
{
bool isSelect = elemGeom.EdgeBindingDic[edge].IsSelected;
elemGeom.EdgeBindingDic[edge].IsHighLighted = false;
elemGeom.EdgeBindingDic[edge].IsSelected = !isSelect;
TreeNode node = GetEdgeTreeNode(edge);
CheckState state = isSelect ? CheckState.Unchecked : CheckState.Checked;
UpdateNodeCheckStatus(node, state);
pictureBoxPreview.Refresh();
treeViewHost.Refresh();
return;
}
}
}
}
/// <summary>
/// Highlight the edge in the preview
/// if mouse-over an edge tree-node.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void treeViewHost_NodeMouseHover(object sender, TreeNodeMouseHoverEventArgs e)
{
TreeNode node = e.Node;
treeViewHost.SelectedNode = e.Node;
ClearAllHighLight();
ActiveNode(node);
pictureBoxPreview.Refresh();
if (m_activeElem == null || node.Tag == null || !(node.Tag is Edge)) return;
ElementGeometry elemGeom = m_creationData.Creator.ElemGeomDic[m_activeElem];
elemGeom.EdgeBindingDic[node.Tag as Edge].IsHighLighted = true;
pictureBoxPreview.Refresh();
}
/// <summary>
/// Use arrow keys to rotate the display of geometry.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void EdgeFetch_KeyDown(object sender, KeyEventArgs e)
{
m_trackBall.OnKeyDown(e);
switch (e.KeyCode)
{
case Keys.Up:
case Keys.Down:
case Keys.Left:
case Keys.Right:
m_creationData.Creator.ElemGeomDic[m_activeElem].Rotation *= m_trackBall.Rotation;
pictureBoxPreview.Refresh();
break;
default: break;
}
}
/// <summary>
/// Suppress the key input.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void treeViewHost_KeyDown(object sender, KeyEventArgs e)
{
e.SuppressKeyPress = true;
}
/// <summary>
/// Select or un-select the key-node
/// if down the left mouse button in the area of check-box or label.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void treeViewHost_MouseDown(object sender, MouseEventArgs e)
{
TreeViewHitTestInfo hitInfo = treeViewHost.HitTest(e.Location);
if(e.Button == MouseButtons.Left &&
(hitInfo.Location == TreeViewHitTestLocations.StateImage ||
hitInfo.Location == TreeViewHitTestLocations.Label))
{
// mouse down in area of state image or label.
TreeNode node = hitInfo.Node;
if(node.Nodes.Count > 0)
// cancel the expand or collapse of node which has children.
m_cancelExpandOrCollapse = true;
// active the node.
ActiveNode(node);
// select or un-select the node.
CheckState checkState = (CheckState)((node.StateImageIndex + 1) % 2);
UpdateNodeCheckStatus(node, checkState);
pictureBoxPreview.Refresh();
}
}
#endregion
}
}
@@ -0,0 +1,178 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="imageListForCheckBox.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="imageListForCheckBox.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADA
CQAAAk1TRnQBSQFMAgEBAwEAAQQBAAEEAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIA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8BiwG8ARsQAAEbAfEBiwHzBPQF/wGLAbwCGwHxAYsD9AHyAfEF/wGL
AbwCGwHxAYsB9AHzAggBwgPxAv8BiwG8ARsQAAEbAfEBiwLzBPQE/wGLAbwCGwHxAYsB8wH0AfIClwHx
BP8BiwG8AhsB8QGLAfMB8AaXAfEB/wGLAbwBGxAAARsB8QGLA/ME9AP/AYsBvAIbAfEBiwHzAfEBlwJP
AZcBwgP/AYsBvAIbAfEBiwHzAQgGlwHxAf8BiwG8ARsQAAEbAfEBiwHyA/ME9AL/AYsBvAIbAfEBiwHz
AQgBTwFVAZcBTwGXAfEC/wGLAbwCGwHxAYsB8wEIBpcB8QH/AYsBvAEbEAABGwHxAYsD8gLzBPQB/wGL
AbwCGwHxAYsB8gEIAU8CCAGXAU8BlwHxAf8BiwG8AhsB8QGLAfIBCAaXAcIB/wGLAbwBGxAAARsB8QGL
AfEC8gPzA/QB9gGLAbwCGwHxAYsB8gHwAQgC8wEIAZcBTwEIAf8BiwG8AhsB8QGLAfIBCAaXAQgB/wGL
AbwBGxAAARsB8QGLAfEE8gLzA/QBiwG8AhsB8QGLA/ID8wEIAZcBCAH2AYsBvAIbAfEBiwHyAQgGlwEI
AfYBiwG8ARsQAAEbAfEBiwHwAfED8gPzAvQBiwG8AhsB8QGLBPID8wHwAfMB9AGLAbwCGwHxAYsB8gHx
BQgB8AHzAfQBiwG8ARsQAAEbAfEBiwLwAvEC8gPzAfQBiwG8AhsB8QGLBfID8wL0AYsBvAIbAfEBiwXy
A/MC9AGLAbwBGxAAARsB8QyLAbwCGwHxDIsBvAIbAfEMiwG8ARsQAAIbDPEEGwzxBBsM8QIbEAAwGxAA
AUIBTQE+BwABPgMAASgDAAFAAwABEAMAAQEBAAEBBQABgBcAA/+BAAs=
</value>
</data>
<data name="labelHit.Text" xml:space="preserve">
<value>Mouse-over an edge where a hosted sweep can be created, the edge will be highlighted in yellow.
Click on the highlighted edge to select it, or click again to un-select.
Rotate the geometry by holding the left mouse button and turning, or zoom by holding the right button to move.
Pressing arrow keys will also rotate the geometry. </value>
</data>
</root>
@@ -0,0 +1,74 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing.Design;
using System.Windows.Forms.Design;
using Autodesk.Revit.DB;
namespace Revit.SDK.Samples.NewHostedSweep.CS
{
/// <summary>
/// This class is intent to provide a model dialog in property grid control.
/// </summary>
class EdgeFormUITypeEditor : UITypeEditor
{
/// <summary>
/// Return the Modal style.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override UITypeEditorEditStyle GetEditStyle(
System.ComponentModel.ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.Modal;
}
/// <summary>
/// Show a form to add or remove edges from hosted sweep, and also can change the
/// type of hosted sweep.
/// </summary>
/// <param name="context"></param>
/// <param name="provider"></param>
/// <param name="value"></param>
/// <returns></returns>
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context,
IServiceProvider provider, object value)
{
IWindowsFormsEditorService winSrv = (IWindowsFormsEditorService)provider.
GetService(typeof(IWindowsFormsEditorService));
CreationData creationData = value as CreationData;
creationData.BackUp();
using (EdgeFetchForm form = new EdgeFetchForm(creationData))
{
if (winSrv.ShowDialog(form) == System.Windows.Forms.DialogResult.OK)
creationData.Update();
else
creationData.Restore();
}
return creationData;
}
}
}
@@ -0,0 +1,114 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
namespace Revit.SDK.Samples.NewHostedSweep.CS
{
partial class HostedSweepModifyForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HostedSweepModifyForm));
this.buttonOK = new System.Windows.Forms.Button();
this.imageList1 = new System.Windows.Forms.ImageList(this.components);
this.propertyGrid = new System.Windows.Forms.PropertyGrid();
this.SuspendLayout();
//
// buttonOK
//
this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonOK.Location = new System.Drawing.Point(110, 451);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 23);
this.buttonOK.TabIndex = 2;
this.buttonOK.Text = "&OK";
this.buttonOK.UseVisualStyleBackColor = true;
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
//
// imageList1
//
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
this.imageList1.Images.SetKeyName(0, "icon_zoomOut.gif");
this.imageList1.Images.SetKeyName(1, "icon_zoomIn.gif");
this.imageList1.Images.SetKeyName(2, "nav_band_contract.gif");
this.imageList1.Images.SetKeyName(3, "nav_band_expand.gif");
//
// propertyGrid
//
this.propertyGrid.Location = new System.Drawing.Point(10, 12);
this.propertyGrid.Name = "propertyGrid";
this.propertyGrid.Size = new System.Drawing.Size(295, 433);
this.propertyGrid.TabIndex = 4;
//
// HostedSweepModify
//
this.AcceptButton = this.buttonOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.buttonOK;
this.ClientSize = new System.Drawing.Size(315, 486);
this.Controls.Add(this.propertyGrid);
this.Controls.Add(this.buttonOK);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "HostedSweepModify";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Modify Hosted Sweep";
this.Load += new System.EventHandler(this.HostedSweepModify_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button buttonOK;
private System.Windows.Forms.ImageList imageList1;
private System.Windows.Forms.PropertyGrid propertyGrid;
}
}
@@ -0,0 +1,87 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Autodesk.Revit;
using Autodesk.Revit.DB;
using System.Drawing.Drawing2D;
namespace Revit.SDK.Samples.NewHostedSweep.CS
{
/// <summary>
/// This form contains a property grid control to modify the property of hosted sweep.
/// </summary>
public partial class HostedSweepModifyForm : System.Windows.Forms.Form
{
/// <summary>
/// Data for modification.
/// </summary>
private ModificationData m_modificationData;
/// <summary>
/// Default constructor.
/// </summary>
public HostedSweepModifyForm()
{
InitializeComponent();
}
/// <summary>
/// Customize constructor contains a parameter ModificationData.
/// </summary>
/// <param name="modificationData"></param>
public HostedSweepModifyForm(ModificationData modificationData)
: this()
{
m_modificationData = modificationData;
this.Text = "Modify " + m_modificationData.CreatorName;
}
/// <summary>
/// OK button, exit this form with DialogResult.OK.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonOK_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
this.Close();
}
/// <summary>
/// Load event, set the data source for property-grid.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void HostedSweepModify_Load(object sender, EventArgs e)
{
propertyGrid.SelectedObject = m_modificationData;
m_modificationData.ShowElement();
}
}
}
@@ -0,0 +1,196 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="imageList1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="imageList1.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABo
DwAAAk1TRnQBSQFMAgEBBAEAAQkBAAEEAQABEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA
AwABIAMAAQEBAAEgBgABIP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8AtgABKwIBAUABKwIB
AUABKwIBAUABKwIBAUABKwIBAUABKwIBAUABKwIBAUAkAAErAgEBQAErAgEBQAErAgEBQAErAgEBQAEr
AgEBQAErAgEBQAErAgEBQEAAAUgCAgGAAUgCAgGAASsCAQFANAABSAICAYABSAICAYABKwIBAUAUAAFI
AgIBgAP+Af8D9wH/A/MB/wPzAf8D8wH/A/UB/wP9Af8BSAICAYAcAAFIAgIBgAP+Af8D9wH/A/MB/wPz
Af8D8wH/A/UB/wP9Af8BSAICAYA4AAFOAgIBjwFbAXQBgQH/AUIBawGEAf8BSAICAYAwAAFOAgIBjwFb
AXQBgQH/AUIBawGEAf8BSAICAYAQAAFOAgIBjwP9Af8D8gH/A+oB/wPnAf8D5gH/A+cB/wPpAf8D7AH/
A/0B/wFOAgIBjxQAAU4CAgGPA/0B/wPyAf8D6gH/A+cB/wPmAf8D5wH/A+kB/wPsAf8D/QH/AU4CAgGP
M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sCAQFAASsCAQFAASsCAQFAASsCAQFAJAABKwIBAUABKwIBAUABKwIBAUABKwIBAUABKwIBAUABKwIB
AUABKwIBAUD/ABEAAUIBTQE+BwABPgMAASgDAAFAAwABIAMAAQEBAAEBBgABARYAA/+BAAT/AfgBDwH4
AQ8B/wHxAf8B8QHwAQcB8AEHAf8B4QH/AeEB4AEDAeABAwH/AcEB/wHBAcABAQHAAQEB4AEDAeABAwGA
AQABgAEAAcABBwHAAQcBgAEAAYABAAGAAQ8BgAEPAYABAAGAAQABgAEPAYABDwGAAQABgAEAAYABDwGA
AQ8BgAEAAYABAAGAAQ8BgAEPAYABAAGAAQABgAEPAYABDwGAAQABgAEAAYABDwGAAQ8BwAEBAcABAQHA
AQ8BwAEPAeABAwHgAQMB4AEfAeABHwHwAQcB8AEHAfABPwHwAT8B+AEPAfgBDwj/Cw==
</value>
</data>
</root>
+174
View File
@@ -0,0 +1,174 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
namespace Revit.SDK.Samples.NewHostedSweep.CS
{
partial class MainForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.buttonCreate = new System.Windows.Forms.Button();
this.buttonModify = new System.Windows.Forms.Button();
this.listBoxCreatedHostedSweeps = new System.Windows.Forms.ListBox();
this.buttonOK = new System.Windows.Forms.Button();
this.comboBoxHostedSweepType = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// buttonCreate
//
this.buttonCreate.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.buttonCreate.Location = new System.Drawing.Point(12, 295);
this.buttonCreate.Name = "buttonCreate";
this.buttonCreate.Size = new System.Drawing.Size(68, 23);
this.buttonCreate.TabIndex = 1;
this.buttonCreate.Text = "&Create...";
this.buttonCreate.UseVisualStyleBackColor = true;
this.buttonCreate.Click += new System.EventHandler(this.buttonCreate_Click);
//
// buttonModify
//
this.buttonModify.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.buttonModify.Enabled = false;
this.buttonModify.Location = new System.Drawing.Point(86, 295);
this.buttonModify.Name = "buttonModify";
this.buttonModify.Size = new System.Drawing.Size(68, 23);
this.buttonModify.TabIndex = 3;
this.buttonModify.Text = "&Modify...";
this.buttonModify.UseVisualStyleBackColor = true;
this.buttonModify.Click += new System.EventHandler(this.buttonModify_Click);
//
// listBoxCreatedHostedSweeps
//
this.listBoxCreatedHostedSweeps.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.listBoxCreatedHostedSweeps.FormattingEnabled = true;
this.listBoxCreatedHostedSweeps.Location = new System.Drawing.Point(12, 87);
this.listBoxCreatedHostedSweeps.Name = "listBoxCreatedHostedSweeps";
this.listBoxCreatedHostedSweeps.Size = new System.Drawing.Size(216, 199);
this.listBoxCreatedHostedSweeps.TabIndex = 4;
this.listBoxCreatedHostedSweeps.SelectedValueChanged += new System.EventHandler(this.listBoxHostedSweeps_SelectedValueChanged);
//
// buttonOK
//
this.buttonOK.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonOK.Location = new System.Drawing.Point(160, 295);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(68, 23);
this.buttonOK.TabIndex = 5;
this.buttonOK.Text = "&OK";
this.buttonOK.UseVisualStyleBackColor = true;
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
//
// comboBoxHostedSweepType
//
this.comboBoxHostedSweepType.FormattingEnabled = true;
this.comboBoxHostedSweepType.Location = new System.Drawing.Point(12, 31);
this.comboBoxHostedSweepType.Name = "comboBoxHostedSweepType";
this.comboBoxHostedSweepType.Size = new System.Drawing.Size(216, 21);
this.comboBoxHostedSweepType.TabIndex = 6;
this.comboBoxHostedSweepType.SelectedIndexChanged += new System.EventHandler(this.comboBoxHostedSweepType_SelectedIndexChanged);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(9, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(141, 13);
this.label1.TabIndex = 7;
this.label1.Text = "Select a hosted sweep type:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 66);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(202, 13);
this.label2.TabIndex = 8;
this.label2.Text = "Select a created hosted sweep to modify:";
//
// MainForm
//
this.AcceptButton = this.buttonOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.buttonOK;
this.ClientSize = new System.Drawing.Size(240, 330);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.listBoxCreatedHostedSweeps);
this.Controls.Add(this.comboBoxHostedSweepType);
this.Controls.Add(this.buttonOK);
this.Controls.Add(this.buttonModify);
this.Controls.Add(this.buttonCreate);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "MainForm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Hosted Sweep";
this.Load += new System.EventHandler(this.MainForm_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button buttonCreate;
private System.Windows.Forms.Button buttonModify;
private System.Windows.Forms.Button buttonOK;
private System.Windows.Forms.ListBox listBoxCreatedHostedSweeps;
private System.Windows.Forms.ComboBox comboBoxHostedSweepType;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
}
}
@@ -0,0 +1,175 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Revit.SDK.Samples.NewHostedSweep.CS
{
/// <summary>
/// This is the main form. It is the entry to create a new hosted sweep or to modify
/// a created hosted sweep.
/// </summary>
public partial class MainForm : System.Windows.Forms.Form
{
/// <summary>
/// Encapsulates the data source for a form.
/// </summary>
BindingSource m_binding;
/// <summary>
/// Creation manager, which collects all the creators.
/// </summary>
private CreationMgr m_creationMgr;
/// <summary>
/// Default constructor
/// </summary>
public MainForm()
{
InitializeComponent();
}
/// <summary>
/// Customize constructor.
/// </summary>
/// <param name="mgr"></param>
public MainForm(CreationMgr mgr): this()
{
m_creationMgr = mgr;
m_binding = new BindingSource();
}
/// <summary>
/// Show a form to fetch edges for hosted-sweep creation, and then create
/// the hosted-sweep.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonCreate_Click(object sender, EventArgs e)
{
HostedSweepCreator creator =
comboBoxHostedSweepType.SelectedItem as HostedSweepCreator;
CreationData creationData = new CreationData(creator);
using (EdgeFetchForm createForm = new EdgeFetchForm(creationData))
{
if (createForm.ShowDialog() == DialogResult.OK)
{
creator.Create(creationData);
RefreshListBox();
}
}
}
/// <summary>
/// Show a form to modify the created hosted-sweep.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonModify_Click(object sender, EventArgs e)
{
ModificationData modificationData = listBoxCreatedHostedSweeps.SelectedItem as ModificationData;
using(HostedSweepModifyForm modifyForm = new HostedSweepModifyForm(modificationData))
{
modifyForm.ShowDialog();
}
}
/// <summary>
/// Refresh list box data source.
/// </summary>
private void RefreshListBox()
{
HostedSweepCreator creator =
comboBoxHostedSweepType.SelectedItem as HostedSweepCreator;
m_binding.DataSource = creator.CreatedHostedSweeps;
listBoxCreatedHostedSweeps.DataSource = m_binding;
listBoxCreatedHostedSweeps.DisplayMember = "Name";
m_binding.ResetBindings(false);
}
/// <summary>
/// Initialize combobox data source.
/// </summary>
private void InitializeComboBox()
{
comboBoxHostedSweepType.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxHostedSweepType.Items.Add(m_creationMgr.FasciaCreator);
comboBoxHostedSweepType.Items.Add(m_creationMgr.GutterCreator);
comboBoxHostedSweepType.Items.Add(m_creationMgr.SlabEdgeCreator);
comboBoxHostedSweepType.SelectedIndex = 0;
comboBoxHostedSweepType.DisplayMember = "Name";
}
/// <summary>
/// Initialize combo-box.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void MainForm_Load(object sender, EventArgs e)
{
InitializeComboBox();
}
/// <summary>
/// Close this form.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonOK_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
this.Close();
}
/// <summary>
/// Update "Modify" button status according to the list-box selection item.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void listBoxHostedSweeps_SelectedValueChanged(object sender, EventArgs e)
{
if (listBoxCreatedHostedSweeps.SelectedItem != null)
buttonModify.Enabled = true;
else
buttonModify.Enabled = false;
}
/// <summary>
/// Update the list-box data source according to the combobox selection.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void comboBoxHostedSweepType_SelectedIndexChanged(object sender, EventArgs e)
{
RefreshListBox();
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>