private void CreateNotifyIcon() { _notifyIcon = new NotifyIcon(); StreamResourceInfo info = Application.GetResourceStream(new Uri("/Resources/google.ico", UriKind.Relative)); using (Stream iconStream = info.Stream) { _notifyIcon.Icon = new Icon(iconStream); } _notifyIcon.Visible = false; _notifyIcon.DoubleClick += (sender, args) => DisplaySplashScreen.Raise(this); ToolStripMenuItem toTheGoogleCaveMenuItem = new ToolStripMenuItem { Text = "To the GoogleCave!" }; toTheGoogleCaveMenuItem.Font = new Font(toTheGoogleCaveMenuItem.Font, FontStyle.Bold); toTheGoogleCaveMenuItem.Click += (sender, args) => DisplaySplashScreen.Raise(this); toTheGoogleCaveMenuItem.ShortcutKeyDisplayString = "Win+G"; _runAtStartupMenuItem = new ToolStripMenuItem(); _runAtStartupMenuItem.Text = "Start with Windows"; _runAtStartupMenuItem.Click += (sender, args) => ChangeRunAtStartup.Raise(this); _notifyIcon.ContextMenuStrip = new ContextMenuStrip(); _notifyIcon.ContextMenuStrip.Items.AddRange( new ToolStripItem[] { toTheGoogleCaveMenuItem, _runAtStartupMenuItem, new ToolStripMenuItem("About", null, (sender, args) => DisplayAboutDialog.Raise(this)), new ToolStripSeparator(), new ToolStripMenuItem("Exit", null, (sender, args) => ExitApplication.Raise(this)) }); }
public static void InvokeAction(string @event, params object[] args) { switch (@event.ToLower()) { case "clear": ClearPlace?.Invoke(); break; case "exit": ExitApplication?.Invoke(); break; case "ended": OnCommandEnded?.Invoke(args[0] as Socket); break; case "sleep": OnCommandSleep?.Invoke((Task)args[0]); break; case "before": CommandBeforeStart?.Invoke(); break; default: throw new Exception("Unknown action!"); } }
static void Main(string[] args) { try { Console.WriteLine("Welcome to BATTLESHIP"); Console.WriteLine(Environment.NewLine); DisplayGrid dg = new DisplayGrid(); /* display empty boards */ dg.ShowBoards(); PlaceBattleship pb = new PlaceBattleship(); /* place the battleship on board by getting input from the user */ int battleshiplen = pb.PlaceBattleShip(); /* display the boards with battleship on board */ dg.ShowBoards(); PlayGame pg = new PlayGame(); /* Play the game by getting the firing shot from the user */ pg.play(battleshiplen); } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { /* exit the application once game finished */ ExitApplication ea = new ExitApplication(); ea.ExitApp(); } }
public MainViewModel(IPortalPersistence model, PublisherDTO author) { _model = model ?? throw new ArgumentNullException("model"); _isLoaded = false; _publisher = author; EditArticleCommand = new DelegateCommand(param => EditArticleAction((int)param)); ExitCommand = new DelegateCommand(_ => ExitApplication?.Invoke(this, EventArgs.Empty)); CreateArticleCommand = new DelegateCommand(_ => CreateArticleAction()); Refresh(); }
private async Task PerformActionsOnVerifyClick(SmsFactorEnroll smsFactorEnrollObject) { this.formUtils.RemoveErrorMessageLabelAndAdjustPanelLocation(); if (this.passCodeTextBox.Text == Constants.ENTER_CODE || string.IsNullOrEmpty(this.passCodeTextBox.Text)) { this.CreateLabelAndDisplayErrorMessageForSms("This field cannot be left blank.", Constants.ALERT); } else { await smsFactorEnrollObject.VerifyAsync(this.passCodeTextBox.Text); ExitApplication.ExitAppWithSuccessCode(); } }
public Updater(string version, string projectId, string publicKey, string updateUrl) { _updateUrl = updateUrl; _version = version.ToString(); _projectId = projectId; _publicKey = publicKey; m_Controller = new updateController(_updateUrl, _version, _publicKey); m_Controller.projectId = _projectId; m_Controller.updateInstallerStarted += (s, e) => { if (ExitApplication != null) { ExitApplication.Invoke(this, EventArgs.Empty); } }; }
private void EnvironmentExit(ExitApplication exitApplication) { Environment.Exit(exitApplication.ExitCode); }
private void OnExitApplication() { ExitApplication?.Invoke(this, EventArgs.Empty); }
private void ButtonExit_Click(object sender, RoutedEventArgs e) { ExitApplication?.Invoke(sender, EventArgs.Empty); }
public void OnExitApplication() { ExitApplication?.Invoke(); }
private void ExitToolsStripMenuItem_Click(object sender, EventArgs e) { ExitApplication frm = new ExitApplication(); frm.ShowDialog(); }
// Use this for initialization void Start() { iclickable = new ExitApplication(); Initialize(); }
protected virtual void OnExitApplication(EventArgs e) { ExitApplication?.Invoke(this, e); }