protected virtual void OnQuit() { if (Quit != null) { Quit.Invoke(this, EventArgs.Empty); } }
/// <summary> /// Sleep up to <paramref name="milliSeconds"/> milliseconds, waking to process events /// </summary> /// <param name="milliSeconds"></param> public void SleepUntilInput(int milliSeconds) { InputSystem.ProcessEvents(milliSeconds); var snapshot = InputSystem.Snapshot; for (var i = 0; i < snapshot.Events.Count; ++i) { var sdlEvent = snapshot.Events[i]; switch (sdlEvent.type) { case SDL.SDL_EventType.SDL_WINDOWEVENT: { Window.ProcessEvent(ref sdlEvent); break; } case SDL.SDL_EventType.SDL_QUIT: { Quit?.Invoke(); break; } } } }
public static void RunUpdate() { while (IsCleaning) { ; } try { using (Stream stream = Application.GetResourceStream(new Uri(UpdaterUri, UriKind.Relative)).Stream) { using (FileStream fileStream = new FileStream(UpdaterPath, FileMode.OpenOrCreate, FileAccess.Write)) { stream.CopyTo(fileStream); } } Process.Start(UpdaterPath, string.Format("\"{0}\"", Process.GetCurrentProcess().MainModule.FileName)); } catch (UnauthorizedAccessException) { ProcessStartInfo processStartInfo = new ProcessStartInfo(Process.GetCurrentProcess().MainModule.FileName, "-update") { Verb = "runas" }; Process.Start(processStartInfo); } Quit?.Invoke(); }
public MainNotifyIcon() { icon = new NotifyIcon(); icon.BalloonTipTitle = Resources.AppName; icon.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location); var strip = new ContextMenuStrip(); ToolStripItem closeAll = new ToolStripMenuItem(Resources.NotifyIcon_CloseAllWindows); closeAll.Click += (s, e) => CloseAll?.Invoke(s, e); strip.Items.Add(closeAll); ToolStripItem quit = new ToolStripMenuItem(Resources.NotifyIcon_Quit); quit.Click += (s, e) => Quit?.Invoke(s, e); strip.Items.Add(quit); strip.Items.Add(new ToolStripSeparator()); icon.ContextMenuStrip = strip; icon.Visible = true; icon.Click += (s, e) => { /* * For some reason there are no public methods on NotifyIcon or ContextMenuStrip * to show the menu "for the taskbar" with the same behavior as a right click. * This private method does the job and it's pretty safe to expect it to exist since it's * been around forever and win forms is already old and not going to change. * We check for null anyway just in case. */ typeof(NotifyIcon) .GetMethod("ShowContextMenu", BindingFlags.Instance | BindingFlags.NonPublic) ?.Invoke(icon, null); }; }
public static void OnQuit() => Quit?.Invoke();
public void Exit() { Quit?.Invoke(); Quit = null; }
internal void OnQuit(QuitMessage message) => Quit?.Invoke(message);
public static void RaiseQuitEvent() { Log.Message("[GameLoopManager] RaiseQuitEvent"); Quit?.Invoke(); }
private void LoginForm_FormClosing(object sender, FormClosingEventArgs e) { Quit?.Invoke(sender, e); }
/// <summary> /// Raises the <see cref="Quit"/> event /// </summary> protected void OnQuit() { Quit?.Invoke(this, EventArgs.Empty); }
protected void OnQuit() { Quit?.Invoke(); }
void OnApplicationQuit() { onQuitPause?.Invoke(); }