public MainWindow(Verificacao verificacao)
        {
            this.verificacao = verificacao;
            InitializeComponent();

            /*configura o ícone na área de notificação e seus menus, adicionando ícone, menu com duas opções e tornando-as funcionais:
             * "Configurações" exibe a janela de mesmo nome e "Sair" fecha o programa*/
            notifyIcon1.Icon             = Properties.Resources.Icone_Q;
            notifyIcon1.ContextMenuStrip = contextMenu1;
            notifyIcon1.BalloonTipTitle  = "Mudanças";
            notifyIcon1.BalloonTipText   = "Foram detectadas mudanças na página verificada";
            notifyIcon1.Text             = "Iniciando...";
            contextMenu1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
                toolStripMenuItem1,
                toolStripMenuItem2
            });
            contextMenu1.Name         = "contextmenu1";
            contextMenu1.Size         = new System.Drawing.Size(152, 48);
            toolStripMenuItem1.Size   = new System.Drawing.Size(151, 22);
            toolStripMenuItem2.Size   = new System.Drawing.Size(151, 22);
            toolStripMenuItem1.Name   = "toolStripMenuItem1";
            toolStripMenuItem2.Name   = "toolStripMenuItem2";
            toolStripMenuItem1.Text   = "Configurações";
            toolStripMenuItem2.Text   = "Sair";
            toolStripMenuItem1.Click += new System.EventHandler(this.Mostrar);
            toolStripMenuItem2.Click += new System.EventHandler(this.Sair);
            notifyIcon1.Visible       = true;
            //esconde esta janela e exibe as configs salvas
            this.Hide();
            ExibirConfigsSalvas();
            //Roda a tarefa de iniciar a verificação
            Task.Run(() => IniciarVerificacao());
        }
Beispiel #2
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     this.Hide();
     verificacao            = new Verificacao(textbox1.Text, passwordbox1.Password);
     main                   = new MainWindow(verificacao);
     verificacao.MainWindow = main;
     textbox1.Text          = "";
     passwordbox1.Password  = "";
 }