using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace HardwareShopView { public partial class MainWorker : Form { public MainWorker() { InitializeComponent(); } private void goodsToolStripMenuItem_Click(object sender, EventArgs e) { var service = Program.ServiceProvider?.GetService(typeof(Form1)); if (service is Form1 form) { form.ShowDialog(); } } } }