//
// (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 TaskDialog = Autodesk.Revit.UI.TaskDialog;
namespace Revit.SDK.Samples.Loads.CS
{
///
/// The map class which store the data and display in usageDataGridView
///
public class UsageMap
{
// Private Members
Loads m_dataBuffer; // A reference of Loads
Boolean m_set; // Indicate the set column of Usage DataGridView control
String m_name; // Indicate the name column of Usage DataGridView control
///
/// is selected in Usage DataGridView control
///
public Boolean Set
{
get
{
return m_set;
}
set
{
m_set = value;
}
}
///
/// usage name
///
public String Name
{
get
{
return m_name;
}
set
{
if (null == value)
{
TaskDialog.Show("Revit", "The usage name should not be null.");
return;
}
if (null == m_name)
{
m_name = value;
return;
}
Boolean canModify = m_dataBuffer.ModifyUsageName(m_name, value);
if (canModify)
{
m_name = value;
}
}
}
///
/// Constructor with Set = false, Name="",
/// This should not be called.
///
/// The reference of Loads
public UsageMap(Loads dataBuffer)
{
m_dataBuffer = dataBuffer;
}
///
/// constructor with Set = false
///
/// The reference of Loads
/// The value set to Name property
public UsageMap(Loads dataBuffer, String name)
{
m_dataBuffer = dataBuffer;
m_set = false;
m_name = name;
}
///
/// constructor
///
/// The reference of Loads
/// The value set to Set property
/// The value set to Name property
public UsageMap(Loads dataBuffer, Boolean set, String name)
{
m_dataBuffer = dataBuffer;
m_set = set;
m_name = name;
}
}
}