Exemplo n.º 1
0
        private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            DialogResult dr = MessageBox.Show("Do you want to minimize the program instead of closing it?", "Exit or minified", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);

            if (dr == DialogResult.Yes)
            {
                this.WindowState = FormWindowState.Minimized;
                hideToolStripMenuItemNotifyIcon.Text = "Show";
                this.ShowInTaskbar         = false;
                notifyIcon.BalloonTipIcon  = ToolTipIcon.Info;
                notifyIcon.BalloonTipTitle = "CinaRAT is now minified";
                notifyIcon.BalloonTipText  = "CinaRAT still running in background." +
                                             Environment.NewLine +
                                             "If you want to close the program, right click the icon and choose close.";
                notifyIcon.ShowBalloonTip(5000);
                e.Cancel = true;
            }
            else if (dr == DialogResult.No)
            {
                ListenServer.Disconnect();
                UPnP.DeletePortMap(Settings.ListenPort);
                notifyIcon.Visible = false;
                notifyIcon.Dispose();
                Instance = null;
            }
            else if (dr == DialogResult.Cancel)
            {
                e.Cancel = true;
            }
        }
Exemplo n.º 2
0
 private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     ListenServer.Disconnect();
     UPnP.DeletePortMap(Settings.ListenPort);
     notifyIcon.Visible = false;
     notifyIcon.Dispose();
     Instance = null;
 }