2023-01-22 18:35:57 +00:00
using Processor ;
namespace UI_WinForms.Components ;
2022-07-09 13:06:30 +00:00
public partial class Main : UserControl
{
public Main ( )
{
this . InitializeComponent ( ) ;
2022-09-20 19:36:45 +00:00
Program . RestartMainApp = false ;
2023-01-22 18:35:57 +00:00
// Register the something changed event to trigger the export:
AppEvents . WhenSomethingChanged + = async ( _ , _ ) = > await ExportProcessor . TriggerExport ( ) ;
2022-09-20 19:36:45 +00:00
}
private void tabControl_SelectedIndexChanged ( object sender , EventArgs e )
{
if ( this . settings . NeedRestart ( ) )
{
var result = MessageBox . Show ( "You need to restart the app for the changes to take effect. Do you want to restart?" , "Restart required" , MessageBoxButtons . YesNo , MessageBoxIcon . Question , MessageBoxDefaultButton . Button1 ) ;
if ( result = = DialogResult . Yes )
{
Program . RestartMainApp = true ;
2022-11-01 11:26:31 +00:00
AppEvents . ResetAllSubscriptions ( ) ;
2022-09-20 19:36:45 +00:00
this . ParentForm ! . Close ( ) ;
}
}
2022-07-09 13:06:30 +00:00
}
}