public virtual void Start() { AppDomain.CurrentDomain.AssemblyResolve += AssemblyHelper.ResolveAssembly; string tempPath = Path.GetTempPath(); TempFolder = Path.Combine(tempPath, "dynamoTmp"); if (!Directory.Exists(TempFolder)) { Directory.CreateDirectory(TempFolder); } else { EmptyTempFolder(TempFolder); } // Setup Temp PreferenceSetting Location for testing PreferenceSettings.DYNAMO_TEST_PATH = Path.Combine(TempFolder, "UserPreferenceTest.xml"); Controller = DynamoController.MakeSandbox(); DynamoController.IsTestMode = true; //create the view Ui = new DynamoView(); Ui.DataContext = Controller.DynamoViewModel; Vm = Controller.DynamoViewModel; Model = Controller.DynamoModel; Controller.UIDispatcher = Ui.Dispatcher; Ui.Show(); SynchronizationContext.SetSynchronizationContext(new SynchronizationContext()); }
private void RestartTestSetup() { // Shutdown Dynamo and restart it Ui.Close(); if (Controller != null) { Controller.ShutDown(false); Controller = null; } // Setup Temp PreferenceSetting Location for testing PreferenceSettings.DYNAMO_TEST_PATH = Path.Combine(TempFolder, "UserPreferenceTest.xml"); Controller = DynamoController.MakeSandbox(); DynamoController.IsTestMode = true; //create the view Ui = new DynamoView(); Ui.DataContext = Controller.DynamoViewModel; Vm = Controller.DynamoViewModel; Controller.UIDispatcher = Ui.Dispatcher; Ui.Show(); SynchronizationContext.SetSynchronizationContext(new SynchronizationContext()); }
public void Start() { AppDomain.CurrentDomain.AssemblyResolve += AssemblyHelper.CurrentDomain_AssemblyResolve; Controller = DynamoController.MakeSandbox(); //create the view Ui = new DynamoView(); Ui.DataContext = Controller.DynamoViewModel; Vm = Controller.DynamoViewModel; Model = Controller.DynamoModel; Controller.UIDispatcher = Ui.Dispatcher; Ui.Show(); SynchronizationContext.SetSynchronizationContext(new SynchronizationContext()); string tempPath = Path.GetTempPath(); TempFolder = Path.Combine(tempPath, "dynamoTmp"); if (!Directory.Exists(TempFolder)) { Directory.CreateDirectory(TempFolder); } else { EmptyTempFolder(); } }
public static Application MakeSandboxAndRun(string commandFilePath) { var controller = DynamoController.MakeSandbox(commandFilePath); var app = new Application(); //create the view var ui = new DynamoView(); ui.DataContext = controller.DynamoViewModel; controller.UIDispatcher = ui.Dispatcher; app.Run(ui); return(app); }
public static Application MakeSandboxAndRun(string commandFilePath, bool turnOnServer) { var controller = DynamoController.MakeSandbox(commandFilePath); var app = new Application(); //create the view var ui = new DynamoView(); ui.DataContext = controller.DynamoViewModel; controller.UIDispatcher = ui.Dispatcher; if (turnOnServer) { var webSocketServer = new WebServer(); webSocketServer.Start(); webSocketServer.ReceivedMessage += new MessageEventHandler(dynSettings.Controller.DynamoViewModel.ExecuteMessageFromSocket); webSocketServer.Info += (infoMessage) => { if (dynSettings.DynamoLogger != null) { dynSettings.DynamoLogger.Log(infoMessage); } }; webSocketServer.Error += (errorMessage) => { if (dynSettings.DynamoLogger != null) { dynSettings.DynamoLogger.LogError(errorMessage); } }; dynSettings.Controller.RequestComputationCompleted += (nodes) => { // TODO: Send nodes instead of nodes GUIDs List <Guid> guidsList = nodes.Select(nodeModel => nodeModel.GUID).ToList(); webSocketServer.SendResponse(new ComputationResponse() { Status = ResponceStatuses.Success, Nodes = guidsList.ToArray() }, dynSettings.Controller.SessionId); }; } app.Run(ui); return(app); }
private void RunCommandsFromFile(string commandFileName) { string commandFilePath = DynamoTestUI.GetTestDirectory(); commandFilePath = Path.Combine(commandFilePath, @"core\recorded\"); commandFilePath = Path.Combine(commandFilePath, commandFileName); // Create the controller to run alongside the view. controller = DynamoController.MakeSandbox(commandFilePath); // Create the view. var dynamoView = new DynamoView(); dynamoView.DataContext = controller.DynamoViewModel; controller.UIDispatcher = dynamoView.Dispatcher; dynamoView.ShowDialog(); Assert.IsNotNull(controller); Assert.IsNotNull(controller.DynamoModel); Assert.IsNotNull(controller.DynamoModel.CurrentWorkspace); workspace = controller.DynamoModel.CurrentWorkspace; }
protected void RunCommandsFromFile(string commandFileName, bool autoRun = false, CommandCallback commandCallback = null) { string commandFilePath = DynamoTestUI.GetTestDirectory(ExecutingDirectory); commandFilePath = Path.Combine(commandFilePath, @"core\recorded\"); commandFilePath = Path.Combine(commandFilePath, commandFileName); if (this.Controller != null) { var message = "Multiple DynamoController detected!"; throw new InvalidOperationException(message); } // Create the controller to run alongside the view. this.Controller = DynamoController.MakeSandbox(commandFilePath); var controller = this.Controller; controller.DynamoViewModel.DynamicRunEnabled = autoRun; DynamoController.IsTestMode = true; RegisterCommandCallback(commandCallback); // Create the view. var dynamoView = new DynamoView(); dynamoView.DataContext = controller.DynamoViewModel; controller.UIDispatcher = dynamoView.Dispatcher; dynamoView.ShowDialog(); Assert.IsNotNull(controller); Assert.IsNotNull(controller.DynamoModel); Assert.IsNotNull(controller.DynamoModel.CurrentWorkspace); workspace = controller.DynamoModel.CurrentWorkspace; workspaceViewModel = controller.DynamoViewModel.CurrentSpaceViewModel; }