My question about title. I created a steam application and I use Steamworks.NET
for steam initialization. Site says:
Open the Visual Studio solution (.sln) file, build both targets one for Windows and one for OSX & Linux. (Optional if you downloaded a prebuilt version) Reference the built assembly (Steamworks.NET.dll) in your project. Start coding! Call SteamAPI.Init() before initializing your renderer.
And I tried to call it with load event but it crashed every time.
Here my calling code:
private void MainWindow_OnLoaded(object sender, RoutedEventArgs e) {
SteamAPI.Init();
SteamAPI.RestartAppIfNecessary(new AppId_t(911310));
}
And I tried:
public MainWindow()
{
SteamAPI.Init();
InitializeComponent();
}
How can I call that method before rendering?
Solved with using different SDK.
Use the Application.Startup
event.
You can attach it in the "App.xaml" file like this:
<Application
x:Class="SomeApp.App.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:SomeApp.App"
Startup="App_OnStartup">
<Application.Resources>
</Application.Resources>
</Application>
Then add the handler in "App.xaml.cs":
public partial class App : Application
{
private void App_OnStartup(object sender, StartupEventArgs e)
{
SteamAPI.Init();
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.