mirror of
https://github.com/jeremytammik/RevitSdkSamples.git
synced 2026-09-21 03:15:33 +00:00
added Revit 2020 SDK files
This commit is contained in:
@@ -0,0 +1,200 @@
|
||||
//
|
||||
// (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.CurtainSystem.CS.UI
|
||||
{
|
||||
partial class CreateCurtainSystemDialog
|
||||
{
|
||||
/// <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.byFaceArrayCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.facesLabel = new System.Windows.Forms.Label();
|
||||
this.selectNoneButton = new System.Windows.Forms.Button();
|
||||
this.createCSButton = new System.Windows.Forms.Button();
|
||||
this.selectAllButton = new System.Windows.Forms.Button();
|
||||
this.facesCheckedListBox = new System.Windows.Forms.CheckedListBox();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.reverseSelButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// byFaceArrayCheckBox
|
||||
//
|
||||
this.byFaceArrayCheckBox.AutoSize = true;
|
||||
this.byFaceArrayCheckBox.Location = new System.Drawing.Point(147, 145);
|
||||
this.byFaceArrayCheckBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.byFaceArrayCheckBox.Name = "byFaceArrayCheckBox";
|
||||
this.byFaceArrayCheckBox.Size = new System.Drawing.Size(159, 21);
|
||||
this.byFaceArrayCheckBox.TabIndex = 2;
|
||||
this.byFaceArrayCheckBox.Text = "Create by &face array";
|
||||
this.byFaceArrayCheckBox.UseVisualStyleBackColor = true;
|
||||
this.byFaceArrayCheckBox.CheckedChanged += new System.EventHandler(this.byFaceArrayCheckBox_CheckedChanged);
|
||||
//
|
||||
// facesLabel
|
||||
//
|
||||
this.facesLabel.AutoSize = true;
|
||||
this.facesLabel.Location = new System.Drawing.Point(12, 16);
|
||||
this.facesLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.facesLabel.Name = "facesLabel";
|
||||
this.facesLabel.Size = new System.Drawing.Size(127, 17);
|
||||
this.facesLabel.TabIndex = 21;
|
||||
this.facesLabel.Text = "Faces of the mass:";
|
||||
//
|
||||
// selectNoneButton
|
||||
//
|
||||
this.selectNoneButton.Location = new System.Drawing.Point(147, 75);
|
||||
this.selectNoneButton.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.selectNoneButton.Name = "selectNoneButton";
|
||||
this.selectNoneButton.Size = new System.Drawing.Size(159, 28);
|
||||
this.selectNoneButton.TabIndex = 4;
|
||||
this.selectNoneButton.Text = "Select &None";
|
||||
this.selectNoneButton.UseVisualStyleBackColor = true;
|
||||
this.selectNoneButton.Click += new System.EventHandler(this.clearButton_Click);
|
||||
//
|
||||
// createCSButton
|
||||
//
|
||||
this.createCSButton.Location = new System.Drawing.Point(122, 197);
|
||||
this.createCSButton.Margin = new System.Windows.Forms.Padding(7, 7, 4, 7);
|
||||
this.createCSButton.Name = "createCSButton";
|
||||
this.createCSButton.Size = new System.Drawing.Size(88, 28);
|
||||
this.createCSButton.TabIndex = 6;
|
||||
this.createCSButton.Text = "OK";
|
||||
this.createCSButton.UseVisualStyleBackColor = true;
|
||||
this.createCSButton.Click += new System.EventHandler(this.createCSButton_Click);
|
||||
//
|
||||
// selectAllButton
|
||||
//
|
||||
this.selectAllButton.Location = new System.Drawing.Point(147, 42);
|
||||
this.selectAllButton.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.selectAllButton.Name = "selectAllButton";
|
||||
this.selectAllButton.Size = new System.Drawing.Size(158, 28);
|
||||
this.selectAllButton.TabIndex = 3;
|
||||
this.selectAllButton.Text = "&Select All";
|
||||
this.selectAllButton.UseVisualStyleBackColor = true;
|
||||
this.selectAllButton.Click += new System.EventHandler(this.selectAllButton_Click);
|
||||
//
|
||||
// facesCheckedListBox
|
||||
//
|
||||
this.facesCheckedListBox.CheckOnClick = true;
|
||||
this.facesCheckedListBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.facesCheckedListBox.FormattingEnabled = true;
|
||||
this.facesCheckedListBox.Items.AddRange(new object[] {
|
||||
"Face 0",
|
||||
"Face 1",
|
||||
"Face 2",
|
||||
"Face 3",
|
||||
"Face 4",
|
||||
"Face 5"});
|
||||
this.facesCheckedListBox.Location = new System.Drawing.Point(16, 42);
|
||||
this.facesCheckedListBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.facesCheckedListBox.Name = "facesCheckedListBox";
|
||||
this.facesCheckedListBox.Size = new System.Drawing.Size(123, 124);
|
||||
this.facesCheckedListBox.TabIndex = 1;
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelButton.Location = new System.Drawing.Point(218, 197);
|
||||
this.cancelButton.Margin = new System.Windows.Forms.Padding(4, 7, 7, 7);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(88, 28);
|
||||
this.cancelButton.TabIndex = 7;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// reverseSelButton
|
||||
//
|
||||
this.reverseSelButton.Location = new System.Drawing.Point(147, 111);
|
||||
this.reverseSelButton.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.reverseSelButton.Name = "reverseSelButton";
|
||||
this.reverseSelButton.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
this.reverseSelButton.Size = new System.Drawing.Size(158, 28);
|
||||
this.reverseSelButton.TabIndex = 22;
|
||||
this.reverseSelButton.Text = "&Reverse Selection";
|
||||
this.reverseSelButton.UseVisualStyleBackColor = true;
|
||||
this.reverseSelButton.Click += new System.EventHandler(this.reverseSelButton_Click);
|
||||
//
|
||||
// CreateCurtainSystemDialog
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.cancelButton;
|
||||
this.ClientSize = new System.Drawing.Size(318, 241);
|
||||
this.Controls.Add(this.reverseSelButton);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.byFaceArrayCheckBox);
|
||||
this.Controls.Add(this.facesLabel);
|
||||
this.Controls.Add(this.selectNoneButton);
|
||||
this.Controls.Add(this.createCSButton);
|
||||
this.Controls.Add(this.selectAllButton);
|
||||
this.Controls.Add(this.facesCheckedListBox);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "CreateCurtainSystemDialog";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Create Curtain System";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CreateCurtainSystemDialog_FormClosing);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.CheckBox byFaceArrayCheckBox;
|
||||
private System.Windows.Forms.Label facesLabel;
|
||||
private System.Windows.Forms.Button selectNoneButton;
|
||||
private System.Windows.Forms.Button createCSButton;
|
||||
private System.Windows.Forms.Button selectAllButton;
|
||||
private System.Windows.Forms.CheckedListBox facesCheckedListBox;
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
private System.Windows.Forms.Button reverseSelButton;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
using Revit.SDK.Samples.CurtainSystem.CS.Data;
|
||||
|
||||
namespace Revit.SDK.Samples.CurtainSystem.CS.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// the winForm for user to create a new curtain system
|
||||
/// </summary>
|
||||
public partial class CreateCurtainSystemDialog : System.Windows.Forms.Form
|
||||
{
|
||||
MyDocument m_mydocument;
|
||||
// the flag for curtain system creation, if it's true, the curtain system
|
||||
// will be created by face array (can't add/remove curtain grids on this kind of curtain system)
|
||||
// otherwise be created by reference array
|
||||
bool m_byFaceArray;
|
||||
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
/// <param name="mydoc">
|
||||
/// the document of the sample
|
||||
/// </param>
|
||||
public CreateCurtainSystemDialog(MyDocument mydoc)
|
||||
{
|
||||
m_mydocument = mydoc;
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
//
|
||||
// initialize data
|
||||
//
|
||||
// by default, create the curtain system by reference array
|
||||
m_byFaceArray = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// check/uncheck the "by face array" flag
|
||||
/// </summary>
|
||||
/// <param name="sender">
|
||||
/// object who sent this event
|
||||
/// </param>
|
||||
/// <param name="e">
|
||||
/// event args
|
||||
/// </param>
|
||||
private void byFaceArrayCheckBox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
m_byFaceArray = byFaceArrayCheckBox.Checked;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// select all the faces
|
||||
/// </summary>
|
||||
/// <param name="sender">
|
||||
/// object who sent this event
|
||||
/// </param>
|
||||
/// <param name="e">
|
||||
/// event args
|
||||
/// </param>
|
||||
private void selectAllButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i < facesCheckedListBox.Items.Count; i++)
|
||||
{
|
||||
facesCheckedListBox.SetItemChecked(i, true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// reverse the selection
|
||||
/// </summary>
|
||||
/// <param name="sender">
|
||||
/// object who sent this event
|
||||
/// </param>
|
||||
/// <param name="e">
|
||||
/// event args
|
||||
/// </param>
|
||||
private void reverseSelButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i < facesCheckedListBox.Items.Count; i++)
|
||||
{
|
||||
bool itemChecked = facesCheckedListBox.GetItemChecked(i);
|
||||
// toggle the checked status
|
||||
facesCheckedListBox.SetItemChecked(i, !itemChecked);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// clear the selected faces
|
||||
/// </summary>
|
||||
/// <param name="sender">
|
||||
/// object who sent this event
|
||||
/// </param>
|
||||
/// <param name="e">
|
||||
/// event args
|
||||
/// </param>
|
||||
private void clearButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i < facesCheckedListBox.Items.Count; i++)
|
||||
{
|
||||
facesCheckedListBox.SetItemChecked(i, false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// create a new curtain system by the selected faces
|
||||
/// </summary>
|
||||
/// <param name="sender">
|
||||
/// object who sent this event
|
||||
/// </param>
|
||||
/// <param name="e">
|
||||
/// event args
|
||||
/// </param>
|
||||
private void createCSButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
// step 1: get the faces for curtain system creation
|
||||
List<int> checkedIndices = new List<int>();
|
||||
for (int i = 0; i < facesCheckedListBox.Items.Count; i++)
|
||||
{
|
||||
bool itemChecked = facesCheckedListBox.GetItemChecked(i);
|
||||
|
||||
if (true == itemChecked)
|
||||
{
|
||||
checkedIndices.Add(i);
|
||||
}
|
||||
}
|
||||
|
||||
// step 2: create the new curtain system
|
||||
m_mydocument.SystemData.CreateCurtainSystem(checkedIndices, m_byFaceArray);
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void CreateCurtainSystemDialog_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
// just refresh the main UI
|
||||
m_mydocument.SystemData.CreateCurtainSystem(null, m_byFaceArray);
|
||||
}
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void reverseSelection_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}// end of class
|
||||
}
|
||||
@@ -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>
|
||||
+272
@@ -0,0 +1,272 @@
|
||||
//
|
||||
// (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.CurtainSystem.CS.UI
|
||||
{
|
||||
partial class CurtainForm
|
||||
{
|
||||
/// <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.createCSButton = new System.Windows.Forms.Button();
|
||||
this.cgCheckedListBox = new System.Windows.Forms.CheckedListBox();
|
||||
this.addCGButton = new System.Windows.Forms.Button();
|
||||
this.cgLabel = new System.Windows.Forms.Label();
|
||||
this.removeCGButton = new System.Windows.Forms.Button();
|
||||
this.facesLabel = new System.Windows.Forms.Label();
|
||||
this.facesCheckedListBox = new System.Windows.Forms.CheckedListBox();
|
||||
this.exitButton = new System.Windows.Forms.Button();
|
||||
this.statusStrip = new System.Windows.Forms.StatusStrip();
|
||||
this.operationStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.deleteCSButton = new System.Windows.Forms.Button();
|
||||
this.csListBox = new System.Windows.Forms.CheckedListBox();
|
||||
this.mainPanel = new System.Windows.Forms.Panel();
|
||||
this.csLabel = new System.Windows.Forms.Label();
|
||||
this.statusStrip.SuspendLayout();
|
||||
this.mainPanel.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// createCSButton
|
||||
//
|
||||
this.createCSButton.Image = global::Revit.SDK.Samples.CurtainSystem.CS.Properties.Resources._new;
|
||||
this.createCSButton.Location = new System.Drawing.Point(16, 192);
|
||||
this.createCSButton.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.createCSButton.Name = "createCSButton";
|
||||
this.createCSButton.Size = new System.Drawing.Size(32, 30);
|
||||
this.createCSButton.TabIndex = 2;
|
||||
this.createCSButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
|
||||
this.createCSButton.UseVisualStyleBackColor = true;
|
||||
this.createCSButton.Click += new System.EventHandler(this.createCSButton_Click);
|
||||
//
|
||||
// cgCheckedListBox
|
||||
//
|
||||
this.cgCheckedListBox.CheckOnClick = true;
|
||||
this.cgCheckedListBox.FormattingEnabled = true;
|
||||
this.cgCheckedListBox.Location = new System.Drawing.Point(454, 27);
|
||||
this.cgCheckedListBox.Margin = new System.Windows.Forms.Padding(4, 3, 4, 4);
|
||||
this.cgCheckedListBox.Name = "cgCheckedListBox";
|
||||
this.cgCheckedListBox.Size = new System.Drawing.Size(144, 157);
|
||||
this.cgCheckedListBox.TabIndex = 7;
|
||||
this.cgCheckedListBox.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.cgCheckedListBox_ItemCheck);
|
||||
//
|
||||
// addCGButton
|
||||
//
|
||||
this.addCGButton.Location = new System.Drawing.Point(348, 67);
|
||||
this.addCGButton.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.addCGButton.Name = "addCGButton";
|
||||
this.addCGButton.Size = new System.Drawing.Size(98, 32);
|
||||
this.addCGButton.TabIndex = 5;
|
||||
this.addCGButton.Text = "&Add >>";
|
||||
this.addCGButton.UseVisualStyleBackColor = true;
|
||||
this.addCGButton.Click += new System.EventHandler(this.addCGButton_Click);
|
||||
//
|
||||
// cgLabel
|
||||
//
|
||||
this.cgLabel.AutoSize = true;
|
||||
this.cgLabel.Location = new System.Drawing.Point(451, 7);
|
||||
this.cgLabel.Margin = new System.Windows.Forms.Padding(4, 7, 4, 0);
|
||||
this.cgLabel.Name = "cgLabel";
|
||||
this.cgLabel.Size = new System.Drawing.Size(95, 17);
|
||||
this.cgLabel.TabIndex = 8;
|
||||
this.cgLabel.Text = "Curtain Grids:";
|
||||
//
|
||||
// removeCGButton
|
||||
//
|
||||
this.removeCGButton.Location = new System.Drawing.Point(348, 107);
|
||||
this.removeCGButton.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.removeCGButton.Name = "removeCGButton";
|
||||
this.removeCGButton.Size = new System.Drawing.Size(98, 32);
|
||||
this.removeCGButton.TabIndex = 6;
|
||||
this.removeCGButton.Text = "<< &Remove";
|
||||
this.removeCGButton.UseVisualStyleBackColor = true;
|
||||
this.removeCGButton.Click += new System.EventHandler(this.removeCGButton_Click);
|
||||
//
|
||||
// facesLabel
|
||||
//
|
||||
this.facesLabel.AutoSize = true;
|
||||
this.facesLabel.Location = new System.Drawing.Point(193, 7);
|
||||
this.facesLabel.Margin = new System.Windows.Forms.Padding(4, 7, 4, 0);
|
||||
this.facesLabel.Name = "facesLabel";
|
||||
this.facesLabel.Size = new System.Drawing.Size(123, 17);
|
||||
this.facesLabel.TabIndex = 0;
|
||||
this.facesLabel.Text = "Uncovered Faces:";
|
||||
//
|
||||
// facesCheckedListBox
|
||||
//
|
||||
this.facesCheckedListBox.CheckOnClick = true;
|
||||
this.facesCheckedListBox.FormattingEnabled = true;
|
||||
this.facesCheckedListBox.Location = new System.Drawing.Point(196, 27);
|
||||
this.facesCheckedListBox.Margin = new System.Windows.Forms.Padding(4, 3, 4, 4);
|
||||
this.facesCheckedListBox.Name = "facesCheckedListBox";
|
||||
this.facesCheckedListBox.Size = new System.Drawing.Size(144, 157);
|
||||
this.facesCheckedListBox.TabIndex = 4;
|
||||
this.facesCheckedListBox.SelectedIndexChanged += new System.EventHandler(this.facesCheckedListBox_SelectedIndexChanged);
|
||||
//
|
||||
// exitButton
|
||||
//
|
||||
this.exitButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
|
||||
this.exitButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.exitButton.Location = new System.Drawing.Point(510, 241);
|
||||
this.exitButton.Margin = new System.Windows.Forms.Padding(7);
|
||||
this.exitButton.Name = "exitButton";
|
||||
this.exitButton.Size = new System.Drawing.Size(88, 28);
|
||||
this.exitButton.TabIndex = 8;
|
||||
this.exitButton.Text = "&Close";
|
||||
this.exitButton.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// statusStrip
|
||||
//
|
||||
this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.operationStatusLabel});
|
||||
this.statusStrip.Location = new System.Drawing.Point(0, 276);
|
||||
this.statusStrip.Name = "statusStrip";
|
||||
this.statusStrip.Padding = new System.Windows.Forms.Padding(1, 0, 19, 0);
|
||||
this.statusStrip.Size = new System.Drawing.Size(614, 22);
|
||||
this.statusStrip.SizingGrip = false;
|
||||
this.statusStrip.Stretch = false;
|
||||
this.statusStrip.TabIndex = 12;
|
||||
//
|
||||
// operationStatusLabel
|
||||
//
|
||||
this.operationStatusLabel.Name = "operationStatusLabel";
|
||||
this.operationStatusLabel.Size = new System.Drawing.Size(0, 17);
|
||||
//
|
||||
// deleteCSButton
|
||||
//
|
||||
this.deleteCSButton.Image = global::Revit.SDK.Samples.CurtainSystem.CS.Properties.Resources.delete;
|
||||
this.deleteCSButton.Location = new System.Drawing.Point(56, 192);
|
||||
this.deleteCSButton.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.deleteCSButton.Name = "deleteCSButton";
|
||||
this.deleteCSButton.Size = new System.Drawing.Size(32, 30);
|
||||
this.deleteCSButton.TabIndex = 3;
|
||||
this.deleteCSButton.UseVisualStyleBackColor = true;
|
||||
this.deleteCSButton.Click += new System.EventHandler(this.deleteCSButton_Click);
|
||||
//
|
||||
// csListBox
|
||||
//
|
||||
this.csListBox.FormattingEnabled = true;
|
||||
this.csListBox.Location = new System.Drawing.Point(16, 27);
|
||||
this.csListBox.Margin = new System.Windows.Forms.Padding(7, 3, 7, 4);
|
||||
this.csListBox.Name = "csListBox";
|
||||
this.csListBox.Size = new System.Drawing.Size(169, 157);
|
||||
this.csListBox.TabIndex = 1;
|
||||
this.csListBox.SelectedIndexChanged += new System.EventHandler(this.csListBox_SelectedIndexChanged);
|
||||
//
|
||||
// mainPanel
|
||||
//
|
||||
this.mainPanel.Controls.Add(this.csListBox);
|
||||
this.mainPanel.Controls.Add(this.deleteCSButton);
|
||||
this.mainPanel.Controls.Add(this.statusStrip);
|
||||
this.mainPanel.Controls.Add(this.exitButton);
|
||||
this.mainPanel.Controls.Add(this.facesCheckedListBox);
|
||||
this.mainPanel.Controls.Add(this.facesLabel);
|
||||
this.mainPanel.Controls.Add(this.removeCGButton);
|
||||
this.mainPanel.Controls.Add(this.cgLabel);
|
||||
this.mainPanel.Controls.Add(this.addCGButton);
|
||||
this.mainPanel.Controls.Add(this.csLabel);
|
||||
this.mainPanel.Controls.Add(this.cgCheckedListBox);
|
||||
this.mainPanel.Controls.Add(this.createCSButton);
|
||||
this.mainPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.mainPanel.Location = new System.Drawing.Point(0, 0);
|
||||
this.mainPanel.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.mainPanel.Name = "mainPanel";
|
||||
this.mainPanel.Size = new System.Drawing.Size(614, 298);
|
||||
this.mainPanel.TabIndex = 0;
|
||||
this.mainPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.mainPanel_Paint);
|
||||
//
|
||||
// csLabel
|
||||
//
|
||||
this.csLabel.AutoSize = true;
|
||||
this.csLabel.Location = new System.Drawing.Point(13, 7);
|
||||
this.csLabel.Margin = new System.Windows.Forms.Padding(4, 7, 4, 0);
|
||||
this.csLabel.Name = "csLabel";
|
||||
this.csLabel.Size = new System.Drawing.Size(114, 17);
|
||||
this.csLabel.TabIndex = 0;
|
||||
this.csLabel.Text = "Curtain Systems:";
|
||||
this.csLabel.Click += new System.EventHandler(this.csLabel_Click);
|
||||
//
|
||||
// CurtainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.exitButton;
|
||||
this.ClientSize = new System.Drawing.Size(614, 298);
|
||||
this.Controls.Add(this.mainPanel);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "CurtainForm";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Curtain System";
|
||||
this.statusStrip.ResumeLayout(false);
|
||||
this.statusStrip.PerformLayout();
|
||||
this.mainPanel.ResumeLayout(false);
|
||||
this.mainPanel.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button createCSButton;
|
||||
private System.Windows.Forms.CheckedListBox cgCheckedListBox;
|
||||
private System.Windows.Forms.Button addCGButton;
|
||||
private System.Windows.Forms.Label cgLabel;
|
||||
private System.Windows.Forms.Button removeCGButton;
|
||||
private System.Windows.Forms.Label facesLabel;
|
||||
private System.Windows.Forms.CheckedListBox facesCheckedListBox;
|
||||
private System.Windows.Forms.Button exitButton;
|
||||
private System.Windows.Forms.StatusStrip statusStrip;
|
||||
private System.Windows.Forms.ToolStripStatusLabel operationStatusLabel;
|
||||
private System.Windows.Forms.Button deleteCSButton;
|
||||
private System.Windows.Forms.CheckedListBox csListBox;
|
||||
private System.Windows.Forms.Panel mainPanel;
|
||||
private System.Windows.Forms.Label csLabel;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,489 @@
|
||||
//
|
||||
// (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.DB;
|
||||
using Autodesk.Revit.UI;
|
||||
using Revit.SDK.Samples.CurtainSystem.CS.Data;
|
||||
|
||||
namespace Revit.SDK.Samples.CurtainSystem.CS.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// the main window form for UI operations
|
||||
/// </summary>
|
||||
public partial class CurtainForm : System.Windows.Forms.Form
|
||||
{
|
||||
// the document containing all the data used in the sample
|
||||
MyDocument m_mydocument;
|
||||
|
||||
/// <summary>
|
||||
/// constructor
|
||||
/// </summary>
|
||||
/// <param name="mydoc">
|
||||
/// the data used in the sample
|
||||
/// </param>
|
||||
public CurtainForm(MyDocument mydoc)
|
||||
{
|
||||
m_mydocument = mydoc;
|
||||
|
||||
InitializeComponent();
|
||||
// initialize some controls manually
|
||||
InitializeCustomComponent();
|
||||
// register the customized events
|
||||
RegisterEvents();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// initialize some controls manually
|
||||
/// </summary>
|
||||
private void InitializeCustomComponent()
|
||||
{
|
||||
this.deleteCSButton.Enabled = false;
|
||||
this.addCGButton.Enabled = false;
|
||||
this.removeCGButton.Enabled = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// register the customized events
|
||||
/// </summary>
|
||||
private void RegisterEvents()
|
||||
{
|
||||
m_mydocument.FatalErrorEvent += new MyDocument.FatalErrorHandler(m_document_FatalErrorEvent);
|
||||
m_mydocument.SystemData.CurtainSystemChanged += new CurtainSystem.SystemData.CurtainSystemChangedHandler(m_document_SystemData_CurtainSystemChanged);
|
||||
// moniter the sample message change status
|
||||
m_mydocument.MessageChanged += new MyDocument.MessageChangedHandler(m_document_MessageChanged);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fatal error occurs, close the sample dialog directly
|
||||
/// </summary>
|
||||
/// <param name="errorMsg">
|
||||
/// the error hint shown to user
|
||||
/// </param>
|
||||
void m_document_FatalErrorEvent(string errorMsg)
|
||||
{
|
||||
// hang the sample and shown the error hint to users
|
||||
TaskDialogResult result = TaskDialog.Show(Properties.Resources.TXT_DialogTitle, errorMsg, TaskDialogCommonButtons.Ok, TaskDialogResult.Ok);
|
||||
// the user has read the hint and clicked the "OK" button, close the dialog
|
||||
if (TaskDialogResult.Ok == result)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// curtain system changed(added/removed), refresh the lists
|
||||
/// </summary>
|
||||
void m_document_SystemData_CurtainSystemChanged()
|
||||
{
|
||||
// clear the out-of-date values
|
||||
csListBox.Items.Clear();
|
||||
facesCheckedListBox.Items.Clear();
|
||||
cgCheckedListBox.Items.Clear();
|
||||
|
||||
List<CurtainSystem.SystemInfo> csInfos = m_mydocument.SystemData.CurtainSystemInfos;
|
||||
|
||||
// no curtain system available, disable the "Delete Curtain System"
|
||||
// "Add curtain grid" and "remove curtain grid" buttons
|
||||
if (null == csInfos ||
|
||||
0 == csInfos.Count)
|
||||
{
|
||||
this.deleteCSButton.Enabled = false;
|
||||
this.addCGButton.Enabled = false;
|
||||
this.removeCGButton.Enabled = false;
|
||||
this.Show();
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (CurtainSystem.SystemInfo info in csInfos)
|
||||
{
|
||||
csListBox.Items.Add(info);
|
||||
}
|
||||
|
||||
// activate the last one
|
||||
CurtainSystem.SystemInfo csInfo = csInfos[csInfos.Count - 1];
|
||||
// this will invoke the selectedIndexChanged event, then to update the other 2 list boxes
|
||||
csListBox.SetSelected(csInfos.Count - 1, true);
|
||||
// enable the buttons and show the dialog
|
||||
this.deleteCSButton.Enabled = true;
|
||||
// only curtain system which created by reference array supports curtain grid operations
|
||||
if (false == csInfo.ByFaceArray)
|
||||
{
|
||||
this.addCGButton.Enabled = true;
|
||||
this.removeCGButton.Enabled = true;
|
||||
}
|
||||
this.Show();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// update the status hints in the status strip
|
||||
/// </summary>
|
||||
void m_document_MessageChanged()
|
||||
{
|
||||
//if it's an error / warning message, set the color of the text to red
|
||||
KeyValuePair<string, bool> message = m_mydocument.Message;
|
||||
if (true == message.Value)
|
||||
{
|
||||
this.operationStatusLabel.ForeColor = System.Drawing.Color.Red;
|
||||
}
|
||||
// it's a common hint message, set the color to black
|
||||
else
|
||||
{
|
||||
this.operationStatusLabel.ForeColor = System.Drawing.Color.Black;
|
||||
}
|
||||
this.operationStatusLabel.Text = message.Key;
|
||||
this.statusStrip.Refresh();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// "Create curtain system" button clicked, hide the main form,
|
||||
/// pop up the create curtain system dialog to let user add a new curtain system.
|
||||
/// After the curtain system created, close the dialog and show the main form again
|
||||
/// </summary>
|
||||
/// <param name="sender">
|
||||
/// object who sent this event
|
||||
/// </param>
|
||||
/// <param name="e">
|
||||
/// event args
|
||||
/// </param>
|
||||
private void createCSButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
|
||||
// show the "create curtain system" dialog
|
||||
using (CreateCurtainSystemDialog dlg = new CreateCurtainSystemDialog(m_mydocument))
|
||||
{
|
||||
dlg.ShowDialog(this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// delete the checked curtain systems in the curtain system list box
|
||||
/// </summary>
|
||||
/// <param name="sender">
|
||||
/// object who sent this event
|
||||
/// </param>
|
||||
/// <param name="e">
|
||||
/// event args
|
||||
/// </param>
|
||||
private void deleteCSButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
// no curtain system available, ask sample user to create some curtain systems first
|
||||
if (null == csListBox.Items ||
|
||||
0 == csListBox.Items.Count)
|
||||
{
|
||||
string hint = Properties.Resources.HINT_CreateCSFirst;
|
||||
m_mydocument.Message = new KeyValuePair<string, bool>(hint, true);
|
||||
return;
|
||||
}
|
||||
|
||||
// get the checked curtain sytems
|
||||
List<int> checkedIndices = new List<int>();
|
||||
for (int i = 0; i < csListBox.Items.Count; i++)
|
||||
{
|
||||
bool itemChecked = csListBox.GetItemChecked(i);
|
||||
|
||||
if (true == itemChecked)
|
||||
{
|
||||
checkedIndices.Add(i);
|
||||
}
|
||||
}
|
||||
|
||||
// no curtain system available or no curtain system selected for deletion
|
||||
// update the status hints
|
||||
if (null == checkedIndices ||
|
||||
0 == checkedIndices.Count)
|
||||
{
|
||||
string hint = Properties.Resources.HINT_SelectCSFirst;
|
||||
m_mydocument.Message = new KeyValuePair<string, bool>(hint, true);
|
||||
return;
|
||||
}
|
||||
|
||||
// delete them
|
||||
m_mydocument.SystemData.DeleteCurtainSystem(checkedIndices);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// the selected curtain system changed, update the "Curtain grid" and
|
||||
/// "Uncovered faces" list boxes of the selected curtain system
|
||||
/// </summary>
|
||||
/// <param name="sender">
|
||||
/// object who sent this event
|
||||
/// </param>
|
||||
/// <param name="e">
|
||||
/// event args
|
||||
/// </param>
|
||||
private void csListBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
List<CurtainSystem.SystemInfo> csInfos = m_mydocument.SystemData.CurtainSystemInfos;
|
||||
|
||||
// data verification
|
||||
if (null == csInfos ||
|
||||
0 == csInfos.Count)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// step 1: activate the selected one
|
||||
//
|
||||
CurtainSystem.SystemInfo csInfo = csInfos[csListBox.SelectedIndex];
|
||||
// update the curtain grid list box
|
||||
cgCheckedListBox.Items.Clear();
|
||||
foreach (int index in csInfo.GridFacesIndices)
|
||||
{
|
||||
CurtainSystem.GridFaceInfo gridFaceInfo = new CurtainSystem.GridFaceInfo(index);
|
||||
cgCheckedListBox.Items.Add(gridFaceInfo);
|
||||
}
|
||||
// update the uncovered face list box
|
||||
facesCheckedListBox.Items.Clear();
|
||||
foreach (int index in csInfo.UncoverFacesIndices)
|
||||
{
|
||||
CurtainSystem.UncoverFaceInfo uncoverFaceInfo = new CurtainSystem.UncoverFaceInfo(index);
|
||||
facesCheckedListBox.Items.Add(uncoverFaceInfo);
|
||||
}
|
||||
//
|
||||
// step 2: enable/disable some buttons and refresh the status hints
|
||||
//
|
||||
// the selected curtain system is created by face array
|
||||
// it's not allowed to modify its curtain grids data
|
||||
if (true == csInfo.ByFaceArray)
|
||||
{
|
||||
// disable the buttons
|
||||
this.addCGButton.Enabled = false;
|
||||
this.removeCGButton.Enabled = false;
|
||||
this.facesCheckedListBox.Enabled = false;
|
||||
this.cgCheckedListBox.Enabled = false;
|
||||
// update the status hints
|
||||
string hint = Properties.Resources.HINT_CSIsByFaceArray;
|
||||
m_mydocument.Message = new KeyValuePair<string, bool>(hint, false);
|
||||
}
|
||||
// the selected curtain system is created by references of the faces
|
||||
// it's allowed to modify its curtain grids data
|
||||
else
|
||||
{
|
||||
// enable the buttons
|
||||
if (null == facesCheckedListBox.Items ||
|
||||
0 == facesCheckedListBox.Items.Count)
|
||||
{
|
||||
this.addCGButton.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.addCGButton.Enabled = true;
|
||||
}
|
||||
// at least one curtain grid must be kept
|
||||
if (null == cgCheckedListBox.Items ||
|
||||
2 > cgCheckedListBox.Items.Count)
|
||||
{
|
||||
this.removeCGButton.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.removeCGButton.Enabled = true;
|
||||
}
|
||||
this.facesCheckedListBox.Enabled = true;
|
||||
this.cgCheckedListBox.Enabled = true;
|
||||
// update the status hints
|
||||
string hint = "";
|
||||
m_mydocument.Message = new KeyValuePair<string, bool>(hint, false);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// add curtain grids to the checked faces
|
||||
/// </summary>
|
||||
/// <param name="sender">
|
||||
/// object who sent this event
|
||||
/// </param>
|
||||
/// <param name="e">
|
||||
/// event args
|
||||
/// </param>
|
||||
private void addCGButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
// step 1: get the curtain system
|
||||
List<CurtainSystem.SystemInfo> csInfos = m_mydocument.SystemData.CurtainSystemInfos;
|
||||
|
||||
// no curtain system available, ask sample user to create some curtain systems first
|
||||
if (null == csInfos || 0 == csInfos.Count)
|
||||
{
|
||||
string hint = Properties.Resources.HINT_CreateCSFirst;
|
||||
m_mydocument.Message = new KeyValuePair<string, bool>(hint, true);
|
||||
return;
|
||||
}
|
||||
CurtainSystem.SystemInfo csInfo = csInfos[csListBox.SelectedIndex];
|
||||
// if the curtain system is created by face array, it's forbidden to make other operations on it
|
||||
if (true == csInfo.ByFaceArray)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// step 2: find out the faces to be covered
|
||||
List<int> faceIndices = new List<int>();
|
||||
for (int i = 0; i < facesCheckedListBox.Items.Count; i++)
|
||||
{
|
||||
bool itemChecked = facesCheckedListBox.GetItemChecked(i);
|
||||
if (true == itemChecked)
|
||||
{
|
||||
CurtainSystem.UncoverFaceInfo info = facesCheckedListBox.Items[i] as CurtainSystem.UncoverFaceInfo;
|
||||
faceIndices.Add(info.Index);
|
||||
}
|
||||
}
|
||||
|
||||
// no uncovered faces selected, warn the sample user
|
||||
if (null == faceIndices ||
|
||||
0 == faceIndices.Count)
|
||||
{
|
||||
string hint = Properties.Resources.HINT_SelectFaceFirst;
|
||||
m_mydocument.Message = new KeyValuePair<string, bool>(hint, true);
|
||||
return;
|
||||
}
|
||||
|
||||
// step 3: cover the selected faces with curtain grids
|
||||
csInfo.AddCurtainGrids(faceIndices);
|
||||
// step 4: update the UI list boxes
|
||||
csListBox_SelectedIndexChanged(null, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// remove the checked curtain grids from the curtain system
|
||||
/// Note: curtain system must have at least one curtain grid
|
||||
/// so sample users can't remove all the curtain grids away
|
||||
/// </summary>
|
||||
/// <param name="sender">
|
||||
/// object who sent this event
|
||||
/// </param>
|
||||
/// <param name="e">
|
||||
/// event args
|
||||
/// </param>
|
||||
private void removeCGButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
// step 1: get the curtain system
|
||||
List<CurtainSystem.SystemInfo> csInfos = m_mydocument.SystemData.CurtainSystemInfos;
|
||||
|
||||
// no curtain system available, ask sample user to create some curtain systems first
|
||||
if (null == csInfos || 0 == csInfos.Count)
|
||||
{
|
||||
string hint = Properties.Resources.HINT_CreateCSFirst;
|
||||
m_mydocument.Message = new KeyValuePair<string, bool>(hint, true);
|
||||
return;
|
||||
}
|
||||
|
||||
CurtainSystem.SystemInfo csInfo = csInfos[csListBox.SelectedIndex];
|
||||
// if the curtain system is created by face array, it's forbidden to make other operations on it
|
||||
if (true == csInfo.ByFaceArray)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// step 2: find out the curtain grids to be removed
|
||||
List<int> faceIndices = new List<int>();
|
||||
for (int i = 0; i < cgCheckedListBox.Items.Count; i++)
|
||||
{
|
||||
bool itemChecked = cgCheckedListBox.GetItemChecked(i);
|
||||
if (true == itemChecked)
|
||||
{
|
||||
CurtainSystem.GridFaceInfo info = cgCheckedListBox.Items[i] as CurtainSystem.GridFaceInfo;
|
||||
faceIndices.Add(info.FaceIndex);
|
||||
}
|
||||
}
|
||||
|
||||
// no curtain grids selected, warn the sample user
|
||||
if (null == faceIndices ||
|
||||
0 == faceIndices.Count)
|
||||
{
|
||||
string hint = Properties.Resources.HINT_SelectCGFirst;
|
||||
m_mydocument.Message = new KeyValuePair<string, bool>(hint, true);
|
||||
return;
|
||||
}
|
||||
|
||||
// step 3: remove the selected curtain grids
|
||||
csInfo.RemoveCurtainGrids(faceIndices);
|
||||
// step 4: update the UI list boxes
|
||||
csListBox_SelectedIndexChanged(null, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// check the curtain grids to delete them, if user wants to check all the curtain
|
||||
/// grids for deletion, prohibit it (must keep at least one curtain grid)
|
||||
/// </summary>
|
||||
/// <param name="sender">
|
||||
/// object who sent this event
|
||||
/// </param>
|
||||
/// <param name="e">
|
||||
/// event args
|
||||
/// </param>
|
||||
private void cgCheckedListBox_ItemCheck(object sender, ItemCheckEventArgs e)
|
||||
{
|
||||
List<int> indices = new List<int>();
|
||||
// get all the unchecked curtain grids
|
||||
for (int i = 0; i < cgCheckedListBox.Items.Count; i++)
|
||||
{
|
||||
bool itemChecked = cgCheckedListBox.GetItemChecked(i);
|
||||
if (false == itemChecked)
|
||||
{
|
||||
indices.Add(i);
|
||||
}
|
||||
}
|
||||
|
||||
// for curtain system, we must keep at least one curtain grid
|
||||
// so it's not allowed to select all the curtain grids to remove
|
||||
if (indices.Count <= 1 &&
|
||||
CheckState.Unchecked == e.CurrentValue)
|
||||
{
|
||||
e.NewValue = CheckState.Unchecked;
|
||||
|
||||
// update the status hints
|
||||
string hint = Properties.Resources.HINT_KeepOneCG;
|
||||
m_mydocument.Message = new KeyValuePair<string, bool>(hint, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// update the status hints
|
||||
string hint = "";
|
||||
m_mydocument.Message = new KeyValuePair<string, bool>(hint, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void facesCheckedListBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void mainPanel_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void csLabel_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
} // end of class
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
<?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="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
Reference in New Issue
Block a user