static void Main(string[] args) { using (Mutex mutex = new Mutex(false, appGuid)) { bool waitOne = mutex.WaitOne(0, false); if (!waitOne) { MessageBox.Show("An instance of Battle Notifier is already running.", "Calm your horses", MessageBoxButtons.OK); return; } LaunchedViaStartup = args != null && args.Any(arg => arg.Equals("/startminimized", StringComparison.CurrentCultureIgnoreCase)); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); AppDomain.CurrentDomain.AssemblyResolve += (Object sender, ResolveEventArgs reargs) => { string thisExe = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name; System.Reflection.AssemblyName embeddedAssembly = new System.Reflection.AssemblyName(reargs.Name); string resourceName = thisExe + "." + embeddedAssembly.Name + ".dll"; using (var stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName)) { Byte[] assemblyData = new Byte[stream.Length]; stream.Read(assemblyData, 0, assemblyData.Length); return System.Reflection.Assembly.Load(assemblyData); } }; Main main = new Main(); Application.Run(main); main.DisposeBattleNotification(); if (mutex != null && waitOne) mutex.ReleaseMutex(); } }
public static void InitializeConfigStorageBroker(Main mainView, MainPanel mainPanel, SettingsPanel settingsPanel) { if (instance == null) instance = new UserSettings(mainView, mainPanel, settingsPanel); }
private UserSettings(Main mainView, MainPanel mainPanel, SettingsPanel settingsPanel) { this.mainView = mainView; this.mainPanel = mainPanel; this.settingsPanel = settingsPanel; }