DynamoDS / Dynamo

Open Source Graphical Programming for Design
https://dynamobim.org
Other
1.72k stars 633 forks source link

Start tab not closing #3788

Closed luxliber closed 8 years ago

luxliber commented 9 years ago

When i try to open workspace programmatically with DynamoModel.OpenFileFromPath() I see Start Page tab and it`s not closing automatically. I should manually close this tab for seeing workspace.

ikeough commented 9 years ago

@luxliber Thanks for the question. The visibility of the StartPage is bound to the ShowStartPage property on the DynamoViewModel. If you go to the DynamoViewModel and do a search for "ShowStartPage", you'll see all the places where it gets set. Take a look at the Open method on DynamoViewModel, which is the VM method for opening a workspace, and you'll see at the end of that method that we call this.ShowStartPage = false.

If you want to make the start page go away, then the easiest way is to call the Open method on DynamoViewModel, passing in the path to the workspace you want to open (.dyn, or .dyf). That method should take care of hiding the StartPage for you.

luxliber commented 9 years ago

Hi @ikeough ! Thank you. Yes, DynamoViewModel.Open() is solution but it is private and i dont see it from another assembly. And i have one more simular situation. I also need to call DynamoRevit addin external command with commandData parameters and "dynPath" string. After command executing, Dynamo model and view initializating addin call function TryOpenWorkspaceInCommandData(extCommandData) and open workspace with dynamoViewModel.Model.OpenFileFromPath(commandData.JournalData["dynPath"]). In this case Start tab dont go away.

My suggestion from your answer is using dynamoViewModel.Open(commandData.JournalData["dynPath"]) in DynamoRevit addin

Benglin commented 9 years ago

Hi @luxliber, the DynamoViewModel.Open is made private intentionally, you should instead go through command to do this:

if (dynamoViewModel.OpenCommand.CanExecute(files[0]))
    dynamoViewModel.OpenCommand.Execute(files[0]);
ikeough commented 9 years ago

Ha! Good point. Nothing like recommending private APIs :)

On Feb 26, 2015, at 5:56 AM, Ben Goh notifications@github.com<mailto:notifications@github.com> wrote:

Hi @luxliberhttps://github.com/luxliber, the DynamoViewModel.Open is made private intentionally, you should instead go through command to do this:

if (dynamoViewModel.OpenCommand.CanExecute(files[0])) dynamoViewModel.OpenCommand.Execute(files[0]);

— Reply to this email directly or view it on GitHubhttps://github.com/DynamoDS/Dynamo/issues/3788#issuecomment-76181377.

Benglin commented 9 years ago

Hi @luxliber, do you still have the issue with start page not hiding? If not we can close this issue for now, thanks!

luxliber commented 9 years ago

Hi @Benglin !

Thanks for the answer with OpenCommand method. This issue could be closed. But there is still issue with code in DynamoRevit.cs (see https://github.com/DynamoDS/DynamoRevit/blob/Revit2015/src/DynamoRevit/DynamoRevit.cs line 264)

In this line method of dynamoViewModel.Model is called (not dynamoViewModel method) and that is reason why start page is not closed after opening Dynamo window from Revit with some path in CommandData