public partial class Form1 : Form
{
private static System.Threading.Mutex mutex = new System.Threading.Mutex(false, "hoge");
public Form1() { new Class1(); } public static void reboot() { mutex.ReleaseMutex(); Application.Restart(); }
}
class Class1
{
public Class1()
{
main();
}
private async void main() { await Task.Run(() => { try { // 処理 } catch (Exception ex) { Form1.reboot(); } }); }
}
上記の様な場合、スレッドで例外が発生したとき再起動させたいのですが、どうするのがよいのでしょうか?
回答2件
あなたの回答
tips
プレビュー