Ejemplo n.º 1
0
        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))
            });
        }
Ejemplo n.º 2
0
        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!");
            }
        }
Ejemplo n.º 3
0
        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();
            }
        }
Ejemplo n.º 4
0
        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();
        }
Ejemplo n.º 5
0
        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();
            }
        }
Ejemplo n.º 6
0
        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);
                }
            };
        }
Ejemplo n.º 7
0
 private void EnvironmentExit(ExitApplication exitApplication)
 {
     Environment.Exit(exitApplication.ExitCode);
 }
Ejemplo n.º 8
0
 private void OnExitApplication()
 {
     ExitApplication?.Invoke(this, EventArgs.Empty);
 }
Ejemplo n.º 9
0
 private void ButtonExit_Click(object sender, RoutedEventArgs e)
 {
     ExitApplication?.Invoke(sender, EventArgs.Empty);
 }
Ejemplo n.º 10
0
 public void OnExitApplication()
 {
     ExitApplication?.Invoke();
 }
Ejemplo n.º 11
0
        private void ExitToolsStripMenuItem_Click(object sender, EventArgs e)
        {
            ExitApplication frm = new ExitApplication();

            frm.ShowDialog();
        }
Ejemplo n.º 12
0
 // Use this for initialization
 void Start()
 {
     iclickable = new ExitApplication();
     Initialize();
 }
Ejemplo n.º 13
0
 protected virtual void OnExitApplication(EventArgs e)
 {
     ExitApplication?.Invoke(this, e);
 }