本文整理汇总了C#中Dynamo.Models.DynamoModel.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# DynamoModel.GetType方法的具体用法?C# DynamoModel.GetType怎么用?C# DynamoModel.GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dynamo.Models.DynamoModel
的用法示例。
在下文中一共展示了DynamoModel.GetType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteCommand
public void ExecuteCommand(DynamoModel.RecordableCommand command, string uniqueId, string extensionName)
{
// log that the command is being executed
if (dynamoModel.DebugSettings.VerboseLogging)
{
dynamoModel.Logger.Log("Command: " + command);
}
var extnDetails = string.Format(
"ExtensionCommandExecutive ( UniqueId: {0}, Name: {1}, commandTypeName: {2} )",
uniqueId, extensionName, command.GetType().Name);
Log(LogMessage.Info(extnDetails));
try
{
// run the command
dynamoModel.ExecuteCommand(command);
}
catch (Exception e)
{
// clean up or show failure messages
Log(LogMessage.Error(string.Format("{0}, from {1}", e.Message, extnDetails)));
}
}
示例2: ExecuteCommand
public void ExecuteCommand(DynamoModel.RecordableCommand command, string uniqueId, string extensionName)
{
var extnDetails = string.Format(
"ViewExtensionCommandExecutive ( UniqueId: {0}, Name: {1}, commandTypeName: {2} )",
uniqueId, extensionName, command.GetType().Name);
Log(LogMessage.Info(extnDetails));
try
{
// run the command
dynamoViewModel.ExecuteCommand(command);
}
catch (Exception e)
{
// clean up or show failure messages
Log(LogMessage.Error(string.Format("{0}, from {1}", e.Message, extnDetails)));
}
}
示例3: OnModelCommandCompleted
void OnModelCommandCompleted(DynamoModel.RecordableCommand command)
{
var name = command.GetType().Name;
switch (name)
{
case "OpenFileCommand":
this.AddToRecentFiles((command as DynamoModel.OpenFileCommand).XmlFilePath);
this.VisualizationManager.UnPause();
break;
case "MutateTestCommand":
var mutatorDriver = new Dynamo.TestInfrastructure.MutatorDriver(this);
mutatorDriver.RunMutationTests();
break;
case "SelectInRegionCommand":
var selectC = command as DynamoModel.SelectInRegionCommand;
CurrentSpaceViewModel.SelectInRegion(selectC.Region, selectC.IsCrossSelection);
break;
case "DragSelectionCommand":
var dragC = command as DynamoModel.DragSelectionCommand;
if (DynamoModel.DragSelectionCommand.Operation.BeginDrag == dragC.DragOperation)
CurrentSpaceViewModel.BeginDragSelection(dragC.MouseCursor);
else
CurrentSpaceViewModel.EndDragSelection(dragC.MouseCursor);
break;
case "DeleteModelCommand":
case "CreateNodeCommand":
case "CreateNoteCommand":
case "UndoRedoCommand":
case "ModelEventCommand":
case "UpdateModelValueCommand":
case "ConvertNodesToCodeCommand":
UndoCommand.RaiseCanExecuteChanged();
RedoCommand.RaiseCanExecuteChanged();
break;
case "SwitchTabCommand":
if (command.IsInPlaybackMode)
RaisePropertyChanged("CurrentWorkspaceIndex");
break;
case "RunCancelCommand":
case "ForceRunCancelCommand":
case "SelectModelCommand":
case "MakeConnectionCommand":
case "CreateCustomNodeCommand":
// for this commands there is no need
// to do anything after execution
break;
default:
throw new InvalidOperationException("Unhandled command name");
}
}
示例4: OnModelCommandStarting
void OnModelCommandStarting(DynamoModel.RecordableCommand command)
{
var name = command.GetType().Name;
switch (name)
{
case "OpenFileCommand":
this.VisualizationManager.Pause();
break;
case "MakeConnectionCommand":
MakeConnectionImpl(command as DynamoModel.MakeConnectionCommand);
break;
case "RunCancelCommand":
case "ForceRunCancelCommand":
case "CreateNodeCommand":
case "CreateNoteCommand":
case "SelectModelCommand":
case "SelectInRegionCommand":
case "DragSelectionCommand":
case "DeleteModelCommand":
case "UndoRedoCommand":
case "ModelEventCommand":
case "UpdateModelValueCommand":
case "ConvertNodesToCodeCommand":
case "CreateCustomNodeCommand":
case "SwitchTabCommand":
case "MutateTestCommand":
// for this commands there is no need
// to do anything before execution
break;
default:
throw new InvalidOperationException("Unhandled command name");
}
}
示例5: RecordCommand
internal void RecordCommand(DynamoModel.RecordableCommand command)
{
// In the playback mode 'this.recordedCommands' will be
// 'null' so that the incoming command will not be recorded.
if (null != recordedCommands)
{
if (command.Redundant && (recordedCommands.Count > 0))
{
// If a command is being marked "Redundant", then we will
// only be interested in the most recent one. If we already
// have another instance recorded immediately prior to this,
// then replace the old instance with the new (for details,
// see "RecordableCommand.Redundant" property).
//
var previousCommand = recordedCommands.Last();
if (previousCommand.GetType() != command.GetType())
recordedCommands.Add(command);
else
{
// Replace the existing command instead of adding.
recordedCommands[recordedCommands.Count - 1] = command;
}
}
else
recordedCommands.Add(command);
}
}