Skip to content

Commit eda3c04

Browse files
committed
Fix unnecessary error log
1 parent 41b8959 commit eda3c04

File tree

2 files changed

+1
-19
lines changed

2 files changed

+1
-19
lines changed

NAPS2.Lib.WinForms/EtoForms/Ui/WinFormsDesktopForm.cs

-13
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ namespace NAPS2.EtoForms.Ui;
1616

1717
public class WinFormsDesktopForm : DesktopForm
1818
{
19-
public static WF.ApplicationContext? ApplicationContext { get; set; }
20-
2119
private readonly Dictionary<DesktopToolbarMenuType, WF.ToolStripSplitButton> _menuButtons = new();
2220
private readonly ToolbarFormatter _toolbarFormatter = new(new StringWrapper());
2321
private readonly WF.Form _form;
@@ -109,17 +107,6 @@ protected override LayoutElement GetZoomButtons()
109107

110108
private WF.ListView NativeListView => ((WinFormsListView<UiImage>) _listView).NativeControl;
111109

112-
protected override void SetMainForm(Form newMainForm)
113-
{
114-
base.SetMainForm(newMainForm);
115-
if (ApplicationContext == null)
116-
{
117-
Log.Error("ApplicationContext should not be null");
118-
return;
119-
}
120-
ApplicationContext.MainForm = newMainForm.ToSWF();
121-
}
122-
123110
protected override void SetCulture(string cultureId)
124111
{
125112
SaveToolStripLocation();

NAPS2.Lib/EtoForms/Ui/DesktopForm.cs

+1-6
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ protected virtual void SetCulture(string cultureId)
454454
FormStateController.DoSaveFormState();
455455
var newDesktop = FormFactory.Create<DesktopForm>();
456456
newDesktop.Show();
457-
SetMainForm(newDesktop);
457+
Application.Instance.MainForm = newDesktop;
458458
Close();
459459
}
460460
finally
@@ -464,11 +464,6 @@ protected virtual void SetCulture(string cultureId)
464464
// TODO: If we make any other forms non-modal, we will need to refresh them too
465465
}
466466

467-
protected virtual void SetMainForm(Form newMainForm)
468-
{
469-
Application.Instance.MainForm = newMainForm;
470-
}
471-
472467
protected virtual void UpdateToolbar()
473468
{
474469
// Top-level toolbar items

0 commit comments

Comments
 (0)