本文整理汇总了C#中Dynamo.Models.DynamoModel类的典型用法代码示例。如果您正苦于以下问题:C# DynamoModel类的具体用法?C# DynamoModel怎么用?C# DynamoModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DynamoModel类属于Dynamo.Models命名空间,在下文中一共展示了DynamoModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: AbstractMutator
protected AbstractMutator(Random rand)
{
this.Rand = rand;
this.Controller = dynSettings.Controller;
this.DynamoViewModel = Controller.DynamoViewModel;
this.DynamoModel = Controller.DynamoModel;
}
示例3: DoPackageFileOperationsAndZip
private static string DoPackageFileOperationsAndZip(DynamoModel dynamoModel, Package pkg, List<string> files, PackageUploadHandle uploadHandle)
{
uploadHandle.UploadState = PackageUploadHandle.State.Copying;
DirectoryInfo rootDir, dyfDir, binDir, extraDir;
FormPackageDirectory(dynamoModel.Loader.PackageLoader.RootPackagesDirectory, pkg.Name, out rootDir, out dyfDir, out binDir, out extraDir); // shouldn't do anything for pkg versions
pkg.RootDirectory = rootDir.FullName;
WritePackageHeader(pkg.Header, rootDir);
CopyFilesIntoPackageDirectory(files, dyfDir, binDir, extraDir);
RemoveDyfFiles(files, dyfDir);
RemapCustomNodeFilePaths(dynamoModel.CustomNodeManager, files, dyfDir.FullName);
uploadHandle.UploadState = PackageUploadHandle.State.Compressing;
string zipPath;
FileInfo info;
try
{
zipPath = Greg.Utility.FileUtilities.Zip(rootDir.FullName);
info = new FileInfo(zipPath);
}
catch
{
// give nicer error
throw new Exception("Could not compress file. Is the file in use?");
}
if (info.Length > 15 * 1000000) throw new Exception("The package is too large! The package must be less than 15 MB!");
return zipPath;
}
示例4: Extract
public bool Extract(DynamoModel dynamoModel, string installDirectory, out Package pkg)
{
this.DownloadState = State.Installing;
// unzip, place files
var unzipPath = Greg.Utility.FileUtilities.UnZip(DownloadPath);
if (!Directory.Exists(unzipPath))
{
throw new Exception(Properties.Resources.PackageEmpty);
}
if (String.IsNullOrEmpty(installDirectory))
installDirectory = dynamoModel.PathManager.DefaultPackagesDirectory;
var installedPath = BuildInstallDirectoryString(installDirectory);
Directory.CreateDirectory(installedPath);
// Now create all of the directories
foreach (string dirPath in Directory.GetDirectories(unzipPath, "*", SearchOption.AllDirectories))
Directory.CreateDirectory(dirPath.Replace(unzipPath, installedPath));
// Copy all the files
foreach (string newPath in Directory.GetFiles(unzipPath, "*.*", SearchOption.AllDirectories))
File.Copy(newPath, newPath.Replace(unzipPath, installedPath));
// provide handle to installed package
pkg = new Package(installedPath, Header.name, VersionName, Header.license);
return true;
}
示例5: Start
//Service start
public static void Start(DynamoModel dynamoModel)
{
InstrumentationLogger.dynamoModel = dynamoModel;
if (IsAnalyticsEnabled)
{
string appVersion = dynamoModel.AppVersion;
var mc = new MeasurementConfiguration(ANALYTICS_PROPERTY,
"Dynamo", appVersion);
mc.AnonymizeIp = true;
sessionID = Guid.NewGuid().ToString();
loggerImpl = new Log("Dynamo", userID, sessionID);
AutoMeasurement.Start(mc);
client = AutoMeasurement.Client;
if (IS_VERBOSE_DIAGNOSTICS)
AutoMeasurement.DebugWriter = d => Debug.WriteLine(d);
started = true;
}
// The following starts the heartbeat, do not remove this
// because of the unreferenced "heartbeat" variable.
// ReSharper disable UnusedVariable
var heartbeat = Heartbeat.GetInstance(dynamoModel);
// ReSharper restore UnusedVariable
}
示例6: CustomNodeManager
/// <summary>
/// Class Constructor
/// </summary>
/// <param name="dynamoModel"></param>
/// <param name="searchPath">The path to search for definitions</param>
public CustomNodeManager(DynamoModel dynamoModel, string searchPath)
{
this.dynamoModel = dynamoModel;
SearchPath = new ObservableCollection<string> { searchPath };
NodeInfos = new ObservableDictionary<Guid, CustomNodeInfo>();
AddDirectoryToSearchPath(DynamoPathManager.Instance.CommonDefinitions);
}
示例7: CefCommands
public CefCommands(PackageLoader loader, DynamoModel model)
{
this.ProductName = !string.IsNullOrEmpty(model.HostName) ? model.HostName : "Dynamo";
this.Loader = loader;
this.Model = model;
this.Client = new DynamoPackagesUIClient();
}
示例8: Start
//Service start
public static void Start(DynamoModel dynamoModel)
{
string appVersion = Process.GetCurrentProcess().ProcessName + "-"
+ UpdateManager.UpdateManager.Instance.ProductVersion.ToString();
CSharpAnalytics.MeasurementConfiguration mc = new MeasurementConfiguration(ANALYTICS_PROPERTY,
"Dynamo", appVersion);
sessionID = Guid.NewGuid().ToString();
loggerImpl = new Log("Dynamo", userID, sessionID);
CSharpAnalytics.AutoMeasurement.Start(mc);
client = AutoMeasurement.Client;
if (IS_VERBOSE_DIAGNOSTICS)
{
AutoMeasurement.DebugWriter = d => Debug.WriteLine(d);
}
started = true;
// The following starts the heartbeat, do not remove this
// because of the unreferenced "heartbeat" variable.
// ReSharper disable UnusedVariable
var heartbeat = Heartbeat.GetInstance(dynamoModel);
// ReSharper restore UnusedVariable
}
示例9: EngineController
public EngineController(DynamoModel dynamoModel, string geometryFactoryFileName)
{
this.dynamoModel = dynamoModel;
// Create a core which is used for parsing code and loading libraries
libraryCore = new ProtoCore.Core(new Options()
{
RootCustomPropertyFilterPathName = string.Empty
});
libraryCore.Executives.Add(Language.kAssociative,new ProtoAssociative.Executive(libraryCore));
libraryCore.Executives.Add(Language.kImperative, new ProtoImperative.Executive(libraryCore));
libraryCore.ParsingMode = ParseMode.AllowNonAssignment;
libraryServices = new LibraryServices(libraryCore);
libraryServices.LibraryLoading += this.LibraryLoading;
libraryServices.LibraryLoadFailed += this.LibraryLoadFailed;
libraryServices.LibraryLoaded += this.LibraryLoaded;
liveRunnerServices = new LiveRunnerServices(dynamoModel, this, geometryFactoryFileName);
liveRunnerServices.ReloadAllLibraries(libraryServices.ImportedLibraries);
codeCompletionServices = new CodeCompletionServices(LiveRunnerCore);
astBuilder = new AstBuilder(dynamoModel, this);
syncDataManager = new SyncDataManager();
dynamoModel.NodeDeleted += NodeDeleted;
}
示例10: PackageManagerViewModel
/// <summary>
/// Constructor
/// </summary>
/// <param name="dynamoViewModel"></param>
/// <param name="model"></param>
/// <param name="address"></param>
public PackageManagerViewModel(PackageLoader loader, DynamoModel model, string address)
{
PkgMgrCommands = new PackageManagerCommands(loader, model);
var path = this.GetType().Assembly.Location;
var config = ConfigurationManager.OpenExeConfiguration(path);
this.Address = PACKAGE_MANAGER_URL + "/#/" + address;
}
示例11: ConvertNodesToCode
public static string ConvertNodesToCode(DynamoModel dynamoModel, IEnumerable<NodeModel> nodeList)
{
var astBuilder = new AstBuilder(dynamoModel, null);
var astNodes = astBuilder.CompileToAstNodes(nodeList, false);
string code = GraphToDSCompiler.GraphUtilities.ASTListToCode(astNodes);
return code;
}
示例12: ConvertNodesToCode
public static string ConvertNodesToCode(DynamoModel dynamoModel, IEnumerable<NodeModel> nodeList)
{
var astBuilder = new AstBuilder(dynamoModel, null);
var astNodes = astBuilder.CompileToAstNodes(nodeList, false);
var codeGen = new ProtoCore.CodeGenDS(astNodes);
return codeGen.GenerateCode();
}
示例13: Watch3DViewModelStartupParams
public Watch3DViewModelStartupParams(DynamoModel model)
{
Model = model;
Scheduler = model.Scheduler;
Logger = model.Logger;
Preferences = model.PreferenceSettings;
EngineControllerManager = model;
}
示例14: 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");
}
}
示例15: PublishCommands
public PublishCommands(PackageLoader loader, DynamoModel model)
{
fileCompressor = new MutatingFileCompressor();
//customNodeDefinitions = new List<CustomNodeDefinition>();
//Dependencies = new List<PackageDependency>();
//Assemblies = new List<PackageAssembly>();
//PackageAssemblyNodes = new List<TypeLoadData>();
//FilesToUpload = new List<string>();
}