本文整理汇总了C#中ModelBase类的典型用法代码示例。如果您正苦于以下问题:C# ModelBase类的具体用法?C# ModelBase怎么用?C# ModelBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModelBase类属于命名空间,在下文中一共展示了ModelBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AbstractModelLoader
public AbstractModelLoader(string modelFileName)
{
m_Model = new ModelBase(modelFileName);
m_ModelFileName = modelFileName;
m_ModelPath = Path.GetDirectoryName(m_ModelFileName);
}
示例2: SerializeModel
/// <summary>
/// Serializes the <paramref name="model" />.
/// </summary>
private unsafe void SerializeModel(BinaryWriter writer, ModelBase model, Formula[] formulas)
{
// Collect all objects contained in the model
var objectTable = CreateObjectTable(model, formulas);
// Prepare the serialization of the model's initial state
lock (_syncObject)
{
_stateVector = SerializationRegistry.Default.GetStateVectorLayout(model, objectTable, SerializationMode.Full);
_deserializer = null;
}
var stateVectorSize = _stateVector.SizeInBytes;
var serializer = _stateVector.CreateSerializer(objectTable);
// Serialize the object table
SerializeObjectTable(objectTable, writer);
// Serialize the object identifier of the model itself and the formulas
writer.Write(objectTable.GetObjectIdentifier(model));
writer.Write(formulas.Length);
foreach (var formula in formulas)
writer.Write(objectTable.GetObjectIdentifier(formula));
// Serialize the initial state
var serializedState = stackalloc byte[stateVectorSize];
serializer(serializedState);
// Copy the serialized state to the stream
writer.Write(stateVectorSize);
for (var i = 0; i < stateVectorSize; ++i)
writer.Write(serializedState[i]);
}
示例3: configure
public void configure(int controllerID, ControllerBase controller, ModelBase model, ViewBase view)
{
addControllerRoute(new RouteBase(controllerID, controller));
controller.configure(view, model);
model.configure();
view.configure(model);
}
示例4: AbstractModelWriter
public AbstractModelWriter(ModelBase model, string modelFileName)
{
m_Model = model;
m_ModelFileName = modelFileName;
m_ModelPath = Path.GetDirectoryName(m_ModelFileName);
}
示例5: Populate
public override void Populate(ModelBase obj)
{
CodigoIso newProps = obj as CodigoIso;
Codigo = newProps.Codigo;
Nome = newProps.Nome;
}
示例6: DynamoNodeButton
public DynamoNodeButton(ModelBase model, string eventName)
: this()
{
this.model = model;
this.eventName = eventName;
Click += OnDynamoNodeButtonClick;
}
示例7: SerializedRuntimeModel
/// <param name="model">A copy of the original model the runtime model was generated from.</param>
/// <param name="buffer">The buffer the model was deserialized from.</param>
/// <param name="objectTable">The table of objects referenced by the model.</param>
/// <param name="formulas">The formulas that are checked on the model.</param>
internal SerializedRuntimeModel(ModelBase model, byte[] buffer, ObjectTable objectTable, Formula[] formulas)
{
Model = model;
Buffer = buffer;
ObjectTable = objectTable;
Formulas = formulas;
}
示例8: Save
/// <summary>
/// Returns the serialized <paramref name="model" /> and the <paramref name="formulas" />.
/// </summary>
/// <param name="model">The model that should be serialized.</param>
/// <param name="formulas">The formulas that should be serialized.</param>
public static byte[] Save(ModelBase model, params Formula[] formulas)
{
var serializer = new RuntimeModelSerializer();
serializer.Serialize(model, formulas);
lock (serializer._syncObject)
return serializer._serializedModel;
}
示例9: Simulator
/// <summary>
/// Initializes a new instance.
/// </summary>
/// <param name="model">The model that should be simulated.</param>
/// <param name="formulas">The formulas that can be evaluated on the model.</param>
public Simulator(ModelBase model, params Formula[] formulas)
{
Requires.NotNull(model, nameof(model));
Requires.NotNull(formulas, nameof(formulas));
_runtimeModel = RuntimeModel.Create(model, formulas);
Reset();
}
示例10: InitializeModel
/// <summary>
/// Initizializes the model that should be analyzed.
/// </summary>
/// <param name="configuration">The configuration that should be used for the analyses.</param>
/// <param name="model">The model that should be analyzed.</param>
/// <param name="hazard">The hazard that should be analyzed.</param>
internal void InitializeModel(AnalysisConfiguration configuration, ModelBase model, Formula hazard)
{
Model = model;
ForcedFaults = new FaultSet(Model.Faults.Where(fault => fault.Activation == Activation.Forced));
SuppressedFaults = new FaultSet(Model.Faults.Where(fault => fault.Activation == Activation.Suppressed));
InitializeModel(configuration, hazard);
}
示例11: MaximalSafeSetHeuristic
/// <summary>
/// Initializes a new instance.
/// </summary>
/// <param name="model">The model the heuristic is created for.</param>
/// <param name="cardinalityLevel">The cardinality level where the first suggestions should be made.</param>
public MaximalSafeSetHeuristic(ModelBase model, uint cardinalityLevel = 3)
{
Requires.NotNull(model, nameof(model));
_model = model;
_cardinalityLevel = cardinalityLevel;
_allFaults = new FaultSet(model.Faults.Where(fault => fault.Activation != Activation.Suppressed).ToArray());
}
示例12: BookingView
public BookingView(BookingViews type, ModelBase model = null, bool IsDuplicate = false)
{
InitializeComponent();
if (model != null)
this.Header = "Edit Booking";
DataContext = ViewModel = new BookingViewModel(type, model,IsDuplicate);
Owner = Application.Current.MainWindow;
}
示例13: SetModel
public void SetModel(ModelBase model, params Formula[] formulas)
{
_formulas = formulas;
_model = model;
foreach (var fault in _model.Faults)
fault.Activation = Activation.Suppressed;
SetSimulator(new Simulator(_model, formulas));
}
示例14: ExportTextureToPNG
protected static void ExportTextureToPNG(string destDir, ModelBase.TextureDefBase texture)
{
try
{
ExportTextureToPNG(destDir, texture.m_ID, texture.GetBitmap());
}
catch (IOException)
{
Console.Write("Cannot write image for texture: " + texture.m_ID);
}
}
示例15: SafetyAnalysisResults
/// <summary>
/// Initializes a new instance.
/// </summary>
/// <param name="model">The <see cref="Model" /> instance the safety analysis was conducted for.</param>
/// <param name="hazard">The hazard the analysis was conducated for.</param>
/// <param name="suppressedFaults">The faults whose activations have been completely suppressed during analysis.</param>
/// <param name="forcedFaults">The faults whose activations have been forced during analysis.</param>
/// <param name="heuristics">The heuristics that are used during the analysis.</param>
/// <param name="activationBehavior">The fault acitvation behavior used during the analysis.</param>
internal SafetyAnalysisResults(ModelBase model, Formula hazard, IEnumerable<Fault> suppressedFaults,
IEnumerable<Fault> forcedFaults, IEnumerable<IFaultSetHeuristic> heuristics,
FaultActivationBehavior activationBehavior)
{
Model = model;
Hazard = hazard;
SuppressedFaults = suppressedFaults;
ForcedFaults = forcedFaults;
Heuristics = heuristics.ToArray(); // make a copy so that later changes to the heuristics don't affect the results
FaultActivationBehavior = activationBehavior;
}