release/0.4.1.0217 #4
23
MainForm.cs
23
MainForm.cs
@ -6,7 +6,6 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using RokettoLaunch.Models.SaveFile;
|
||||
using RokettoLaunch.Windows.Forms;
|
||||
using RyzStudio;
|
||||
@ -18,7 +17,6 @@ namespace RokettoLaunch
|
||||
{
|
||||
public partial class MainForm : Form
|
||||
{
|
||||
private readonly IServiceProvider _provider;
|
||||
private readonly IFileSessionManager _fileSessionManager;
|
||||
|
||||
private bool _isBusy = false;
|
||||
@ -30,22 +28,10 @@ namespace RokettoLaunch
|
||||
InitializeComponent();
|
||||
|
||||
this.AutoScaleMode = AutoScaleMode.None;
|
||||
this.StartPosition = FormStartPosition.WindowsDefaultLocation;
|
||||
this.Text = Application.ProductName;
|
||||
|
||||
this.CurrentSession = new App4Options();
|
||||
|
||||
//#if DEBUG
|
||||
//flowLayoutPanel1.BackColor = Color.LightGreen;
|
||||
//#endif
|
||||
|
||||
notifyIcon1.Text = Application.ProductName;
|
||||
}
|
||||
|
||||
public MainForm(IServiceProvider provider, IFileSessionManager fileSessionManager) : this()
|
||||
{
|
||||
_provider = provider;
|
||||
_fileSessionManager = fileSessionManager;
|
||||
|
||||
_fileSessionManager = new FileSessionManager();
|
||||
_fileSessionManager.OpenFileDialog = openFileDialog1;
|
||||
_fileSessionManager.SaveFileDialog = saveFileDialog1;
|
||||
_fileSessionManager.OnNewing += fileSessionManager_OnNewSession;
|
||||
@ -53,6 +39,8 @@ namespace RokettoLaunch
|
||||
_fileSessionManager.OnSaving += fileSessionManager_OnSaveSession;
|
||||
_fileSessionManager.OnClearing += fileSessionManager_OnClearSession;
|
||||
_fileSessionManager.OnFilenameChanged += fileSessionManager_OnFilenameChanged;
|
||||
|
||||
notifyIcon1.Text = Application.ProductName;
|
||||
}
|
||||
|
||||
protected async override void OnShown(EventArgs e)
|
||||
@ -435,8 +423,7 @@ namespace RokettoLaunch
|
||||
|
||||
private async Task<bool> fileSessionManager_OnLoadSession(FileSessionManager sender, string filename, int formatType)
|
||||
{
|
||||
// Progress indicator
|
||||
var loadingForm = _provider.GetRequiredService<LoadingForm>();
|
||||
var loadingForm = new LoadingForm();
|
||||
var result = await loadingForm.ShowDialog(filename);
|
||||
if (result != DialogResult.OK)
|
||||
{
|
||||
|
||||
13
Program.cs
13
Program.cs
@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using RyzStudio.Windows.Forms;
|
||||
|
||||
namespace RokettoLaunch
|
||||
{
|
||||
@ -13,19 +11,10 @@ namespace RokettoLaunch
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
var services = new ServiceCollection();
|
||||
services.AddSingleton<IFileSessionManager, FileSessionManager>();
|
||||
services.AddTransient<MainForm>();
|
||||
services.AddTransient<LoadingForm>();
|
||||
|
||||
var provider = services.BuildServiceProvider();
|
||||
|
||||
Application.SetHighDpiMode(HighDpiMode.SystemAware);
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
//Application.Run(new MainForm());
|
||||
|
||||
Application.Run(provider.GetRequiredService<MainForm>());
|
||||
Application.Run(new MainForm());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,7 +79,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.7" />
|
||||
<PackageReference Include="RyzStudio" Version="10.1.0.128" />
|
||||
<PackageReference Include="RyzStudio.Windows.Forms" Version="10.1.0.140" />
|
||||
</ItemGroup>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user