Skip to content

Commit 5452f99

Browse files
committed
fixup! feat: Implement Project selection/creation
1 parent bae4ebd commit 5452f99

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

sources/editor/Stride.Core.Assets.Editor.Avalonia/NewOrOpenSessionTemplateCollectionViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ private async Task BrowseForExistingProject()
2222
var filePath = await EditorDialogHelper.BrowseForExistingProject(serviceProvider);
2323
if (filePath != null)
2424
{
25-
SelectedTemplate = new ExistingProjectViewModel(ServiceProvider, filePath, RemoveExistingProjects);
25+
//SelectedTemplate = new ExistingProjectViewModel(ServiceProvider, filePath, RemoveExistingProjects);
2626
dialog?.RequestClose(DialogResult.Ok);
2727
}
2828
}

sources/editor/Stride.GameStudio.Avalonia/App.axaml.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public override void OnFrameworkInitializationCompleted()
103103

104104
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
105105
{
106-
desktop.MainWindow = new ProjectSelectionWindow();
106+
desktop.MainWindow = new MainWindow();
107107
}
108108
else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewPlatform)
109109
{
@@ -126,12 +126,11 @@ public void Restart(UFile? initialPath = null)
126126
}
127127
}
128128

129-
private static object InitializeMainViewModel(UFile? initialPath)
129+
private static MainViewModel InitializeMainViewModel(UFile? initialPath)
130130
{
131-
//Switch viewmodel depending the program arguments
132-
var viewmodel = new NewOrOpenSessionTemplateCollectionViewModel(InitializeServiceProvider());
133-
// if (initialPath is not null)
134-
// vm.OpenCommand.Execute(initialPath);
131+
var viewmodel = new MainViewModel(InitializeServiceProvider());
132+
if (initialPath is not null)
133+
viewmodel.OpenCommand.Execute(initialPath);
135134
return viewmodel;
136135
}
137136

sources/editor/Stride.GameStudio.Avalonia/Services/EditorDialogService.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using Stride.Core.Presentation.Services;
1010
using Stride.Core.Presentation.ViewModels;
1111
using Stride.GameStudio.Avalonia.Views;
12+
using Stride.Core.Assets.Editor.Avalonia;
1213

1314
namespace Stride.GameStudio.Avalonia.Services;
1415

@@ -91,6 +92,15 @@ public void ShowProgressWindow(WorkProgressViewModel workProgress)
9192
}
9293
}
9394

95+
public void ShowProjectSelectionWindow()
96+
{
97+
var project = new ProjectSelectionWindow()
98+
{
99+
DataContext = new NewOrOpenSessionTemplateCollectionViewModel(serviceProvider)
100+
};
101+
project.Show();
102+
}
103+
94104
public async Task ShowSettingsWindowAsync()
95105
{
96106
if (MainWindow is null) return;

sources/editor/Stride.GameStudio.Avalonia/ViewModels/MainViewModel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ public MainViewModel(IViewModelServiceProvider serviceProvider)
4848

4949
Status = new StatusViewModel(ServiceProvider);
5050
Status.PushStatus("Ready");
51+
52+
DialogService.ShowProjectSelectionWindow();
5153
}
5254

5355
public SessionViewModel? Session

0 commit comments

Comments
 (0)