Beispiel #1
0
        public Form1()
        {
            //
            // Requis pour la prise en charge du Concepteur Windows Forms
            //
            InitializeComponent();

            textBoxContent.Text="This is a sample content, it can spread on multiple lines";
            textBoxTitle.Text="Title";
            textBoxDelayShowing.Text="500";
            textBoxDelayStaying.Text="3000";
            textBoxDelayHiding.Text="500";
            checkBoxSelectionRectangle.Checked=true;
            checkBoxTitleClickable.Checked=false;
            checkBoxContentClickable.Checked=true;
            checkBoxCloseClickable.Checked=true;
            checkBoxKeepVisibleOnMouseOver.Checked = true;		// Added Rev 002
            checkBoxReShowOnMouseOver.Checked = false;			// Added Rev 002

            taskbarNotifier1=new TaskbarNotifier();
            taskbarNotifier1.SetBackgroundBitmap(new Bitmap(GetType(),"skin.bmp"),Color.FromArgb(255,0,255));
            taskbarNotifier1.SetCloseBitmap(new Bitmap(GetType(),"close.bmp"),Color.FromArgb(255,0,255),new Point(127,8));
            taskbarNotifier1.TitleRectangle=new Rectangle(40,9,70,25);
            taskbarNotifier1.ContentRectangle=new Rectangle(8,41,133,68);
            taskbarNotifier1.TitleClick+=new EventHandler(TitleClick);
            taskbarNotifier1.ContentClick+=new EventHandler(ContentClick);
            taskbarNotifier1.CloseClick+=new EventHandler(CloseClick);

            taskbarNotifier2=new TaskbarNotifier();
            taskbarNotifier2.SetBackgroundBitmap(new Bitmap(GetType(),"skin2.bmp"),Color.FromArgb(255,0,255));
            taskbarNotifier2.SetCloseBitmap(new Bitmap(GetType(),"close2.bmp"),Color.FromArgb(255,0,255),new Point(300,74));
            taskbarNotifier2.TitleRectangle=new Rectangle(123,80,176,16);
            taskbarNotifier2.ContentRectangle=new Rectangle(116,97,197,22);
            taskbarNotifier2.TitleClick+=new EventHandler(TitleClick);
            taskbarNotifier2.ContentClick+=new EventHandler(ContentClick);
            taskbarNotifier2.CloseClick+=new EventHandler(CloseClick);

            // Added Rev 002
            taskbarNotifier3=new TaskbarNotifier();
            taskbarNotifier3.SetBackgroundBitmap(new Bitmap(GetType(),"skin3.bmp"),Color.FromArgb(255,0,255));
            taskbarNotifier3.SetCloseBitmap(new Bitmap(GetType(),"close.bmp"),Color.FromArgb(255,0,255),new Point(280,57));
            taskbarNotifier3.TitleRectangle=new Rectangle(150, 57, 125, 28);
            taskbarNotifier3.ContentRectangle=new Rectangle(75, 92, 215, 55);
            taskbarNotifier3.TitleClick+=new EventHandler(TitleClick);
            taskbarNotifier3.ContentClick+=new EventHandler(ContentClick);
            taskbarNotifier3.CloseClick+=new EventHandler(CloseClick);
        }
        public MesajeApplication()
        {
            InitializeComponent();

            notifyIcon = new NotifyIcon();
            contextMenu = new ContextMenu();
            exitMenuItem = new MenuItem();
            newMessageMenuItem = new MenuItem();
            optionsMenuItem = new MenuItem();

            // set up the Message Updater
            backWorker.WorkerReportsProgress = true;
            backWorker.WorkerSupportsCancellation = true;
            backWorker.DoWork += new DoWorkEventHandler(bw_DoWork);
            //backWorker.ProgressChanged += new ProgressChangedEventHandler(bw_ProgressChanged);
            backWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);

            // initialize the context menu
            contextMenu.MenuItems.AddRange(new MenuItem[] { exitMenuItem, optionsMenuItem, newMessageMenuItem });

            // initialize the menu items
            exitMenuItem.Index = 2;
            exitMenuItem.Text = "E&xit";
            exitMenuItem.Click += new EventHandler(exitMenuItem_Click);

            optionsMenuItem.Index = 1;
            optionsMenuItem.Text = "&Options";
            optionsMenuItem.Click += new EventHandler(optionsMenuItem_Click);

            newMessageMenuItem.Index = 0;
            newMessageMenuItem.Text = "Arata mesaj &nou";
            newMessageMenuItem.Click += new EventHandler(newMessageMenuItem_Click);

            // create the notification icon
            notifyIcon = new NotifyIcon();
            notifyIcon.Icon = Resource.Application;

            notifyIcon.ContextMenu = contextMenu;
            notifyIcon.Text = "Mesaje diverse";
            notifyIcon.BalloonTipIcon = ToolTipIcon.Info;
            notifyIcon.BalloonTipText = "Apasati pe icoana pentru mesaje diverse.";
            notifyIcon.BalloonTipTitle = "Mesaje diverse";
            notifyIcon.Visible = true;
            notifyIcon.DoubleClick += new EventHandler(notifyIcon_DoubleClick);

            // add the resize event
            this.Resize += new EventHandler(MesajeApplication_Resize);
            notifyIcon.Visible = true;
            notifyIcon.DoubleClick += new EventHandler(notifyIcon_DoubleClick);

            AppSettingsReader appSettings = new AppSettingsReader();
            // set the timer
            messageDisplayTimer = new Timer();
            messageDisplayTimer.Interval = Config.Instance.PublishInterval;
            messageDisplayTimer.Tick += new EventHandler(MessageTimeout);
            messageDisplayTimer.Enabled = true;
            messageDisplayTimer.Start();

            messageUpdateTimer = new Timer();
            messageUpdateTimer.Interval = Config.Instance.MessageUpdateInterval;
            messageUpdateTimer.Tick += new EventHandler(UpdateMessagesTimeout);
            messageUpdateTimer.Enabled = true;
            messageUpdateTimer.Start();

            // initialize the Notification windows
            taskbarNotifier1 = new TaskbarNotifier();
            taskbarNotifier1.SetBackgroundBitmap(Resource.skin, Color.FromArgb(255, 0, 255));
            taskbarNotifier1.SetCloseBitmap(Resource.close, Color.FromArgb(255, 0, 255), new Point(280, 57));
            taskbarNotifier1.TitleRectangle = new Rectangle(150, 57, 125, 28);
            taskbarNotifier1.ContentRectangle = new Rectangle(75, 92, 215, 55);
            taskbarNotifier1.TitleClick += new EventHandler(TitleClick);
            taskbarNotifier1.ContentClick += new EventHandler(ContentClick);
            taskbarNotifier1.CloseClick += new EventHandler(CloseClick);
            taskbarNotifier1.EnableSelectionRectangle = true;
            taskbarNotifier1.KeepVisibleOnMousOver = true;
            taskbarNotifier1.ReShowOnMouseOver = true;

            taskbarNotifier2 = new TaskbarNotifier();
            taskbarNotifier2.SetBackgroundBitmap(Resource.skin2, Color.FromArgb(255, 0, 255));
            taskbarNotifier2.SetCloseBitmap(Resource.close2, Color.FromArgb(255, 0, 255), new Point(280, 57));
            taskbarNotifier2.TitleRectangle = new Rectangle(150, 57, 125, 28);
            taskbarNotifier2.ContentRectangle = new Rectangle(75, 92, 215, 55);
            taskbarNotifier2.TitleClick += new EventHandler(TitleClick);
            taskbarNotifier2.ContentClick += new EventHandler(ContentClick);
            taskbarNotifier2.CloseClick += new EventHandler(CloseClick);
            taskbarNotifier2.EnableSelectionRectangle = true;
            taskbarNotifier2.KeepVisibleOnMousOver = true;
            taskbarNotifier2.ReShowOnMouseOver = true;

            taskbarNotifier3 = new TaskbarNotifier();
            taskbarNotifier3.SetBackgroundBitmap(Resource.skin3, Color.FromArgb(255, 0, 255));
            taskbarNotifier3.SetCloseBitmap(Resource.close, Color.FromArgb(255, 0, 255), new Point(280, 57));
            taskbarNotifier3.TitleRectangle = new Rectangle(150, 57, 125, 28);
            taskbarNotifier3.ContentRectangle = new Rectangle(75, 92, 215, 55);
            taskbarNotifier3.TitleClick += new EventHandler(TitleClick);
            taskbarNotifier3.ContentClick += new EventHandler(ContentClick);
            taskbarNotifier3.CloseClick += new EventHandler(CloseClick);
            taskbarNotifier3.EnableSelectionRectangle = true;
            taskbarNotifier3.KeepVisibleOnMousOver = true;
            taskbarNotifier3.ReShowOnMouseOver = true;

            //LoadItems();
            //MessageManagement.UpdateXml();
            // start updating the message list
            UpdateMessagesTimeout(null, null);

            // add a dummy item
            Mesaje.Data.Message dummy = new Data.Message();
            dummy.ID = 1;
            dummy.Body = "Dummy body,the red cow is crossing the street.";
            dummy.Title = "Dummy title";
            lock (lockMessages)
            {
                messages.Add(dummy);
            }

            this.WindowState = FormWindowState.Minimized;
        }
        private TaskbarNotifier CreateNotificationWindow(int winId)
        {
            TaskbarNotifier notify = new TaskbarNotifier();

            switch (winId)
            {
                case 1:
                    // skin 1
                    notify.SetBackgroundBitmap(Resource.skin, Color.FromArgb(255, 0, 255));
                    notify.SetCloseBitmap(Resource.close, Color.FromArgb(255, 0, 255), new Point(280, 57));
                    notify.TitleRectangle = new Rectangle(150, 57, 125, 28);
                    notify.ContentRectangle = new Rectangle(75, 92, 215, 55);
                    break;
                case 2:
                    //skin 2
                    notify.SetBackgroundBitmap(Resource.skin2, Color.FromArgb(255, 0, 255));
                    notify.SetCloseBitmap(Resource.close2, Color.FromArgb(255, 0, 255), new Point(280, 57));
                    notify.TitleRectangle = new Rectangle(150, 57, 125, 28);
                    notify.ContentRectangle = new Rectangle(75, 92, 215, 55);
                    break;
                case 3:
                default:
                    //skin 3
                    notify.SetBackgroundBitmap(Resource.skin3, Color.FromArgb(255, 0, 255));
                    notify.SetCloseBitmap(Resource.close, Color.FromArgb(255, 0, 255), new Point(280, 57));
                    notify.TitleRectangle = new Rectangle(150, 57, 125, 28);
                    notify.ContentRectangle = new Rectangle(75, 92, 215, 55);
                    break;
            }

            notify.CloseClickable = true;
            notify.TitleClickable = false;
            notify.ContentClickable = false;
            notify.EnableSelectionRectangle = true;
            notify.KeepVisibleOnMousOver = true;
            notify.ReShowOnMouseOver = true;

            return notify;
        }
Beispiel #4
0
        private void Aviso(string descripcion, string archivo, string direccion)
        {
            if (chkEmail.Checked)
            {
                if (txtServidor.Text != "" && txtEmail.Text!="")
                {
                    SmtpClient client = new SmtpClient(txtServidor.Text);
                    client.Credentials = new NetworkCredential("HMOMARTINREA\\ecarrillo", "Troya2016");

                    MailMessage mail = new MailMessage("[email protected]", txtEmail.Text);

                    mail.Subject = "Archivo " + descripcion + ": " + archivo ;

                    mail.Body = direccion;
                    mail.BodyEncoding = Encoding.UTF8;
                    mail.IsBodyHtml = false;
                    try
                    {
                        client.Send(mail);
                    }
                    catch (Exception ex)
                    {
                        string es = ex.ToString();
                    }
                }

            }
            if (chkAlerta.Checked)
            {
                TaskbarNotifier tn = new TaskbarNotifier();
                tn.SetBackgroundBitmap("skin.bmp",
                        Color.FromArgb(255, 0, 255));
                tn.SetCloseBitmap("close.bmp",
                        Color.FromArgb(255, 0, 255), new Point(127, 8));
                tn.TitleRectangle = new Rectangle(40, 9, 70, 25);
                tn.ContentRectangle = new Rectangle(8, 20, 133, 88);
                tn.ReShowOnMouseOver = true;
                tn.StackPosition = position++;
                tn.ContentClick += new EventHandler(Notifier_ContentClick);
                tn.VisibleChanged += new EventHandler(Notifier_VisibleChanged);
                tn.Tag = direccion;
                tn.Visible = true;
                tn.Show(descripcion , archivo
                    , 250, 1500000000, 250);
                Thread.Sleep(1000);
            }
            if (chkSonido.Checked)
            {
                WSounds ws = new WSounds();
                ws.Play("beep.wav", ws.SND_FILENAME | ws.SND_ASYNC);
            }
        }
        private void MantisNotifyForm_Load(object sender, System.EventArgs e)
        {
            Hide();

            NameValueCollection appSettings = ConfigurationManager.AppSettings;
            checkMantisTimer.Interval = Convert.ToInt32(appSettings["CheckForNewIssuesEverySecs"]) * 1000;
            timeToShowNotificationInMs = Convert.ToInt32(appSettings["TimeToShowNotificationSecs"]) * 1000;
            timeToStayNotificationInMs = Convert.ToInt32(appSettings["TimeToStayNotificationSecs"]) * 1000;
            timeToHideNotificationInMs = Convert.ToInt32(appSettings["TimeToHideNotificationSecs"]) * 1000;

            taskbarNotifier = new TaskbarNotifier();
            taskbarNotifier.SetBackgroundBitmap( new Bitmap( GetType(), "skin.bmp"), Color.FromArgb( 255, 0, 255 ) );
            taskbarNotifier.SetCloseBitmap( new Bitmap( GetType(), "close.bmp" ), Color.FromArgb( 255, 0, 255 ), new Point( 280, 55 ) );
            taskbarNotifier.TitleRectangle = new Rectangle( 150, 57, 125, 28 );
            taskbarNotifier.ContentRectangle = new Rectangle( 75, 92, 215, 55 );
            taskbarNotifier.TitleClick += new EventHandler( TitleClick );
            taskbarNotifier.ContentClick += new EventHandler( ContentClick );
            taskbarNotifier.CloseClick += new EventHandler( CloseClick );

            Connect();

            checkMantisTimer.Enabled = true;
        }
Beispiel #6
0
 private TaskbarNotifier InitTaskBarNotifier(TaskbarNotifier notifier)
 {
     notifier.Base = m_ColToast;
     notifier.SetCloseBitmap(new Bitmap(GetType(), "close.bmp"), Color.FromArgb(255, 0, 255), new Point(230, 8));
     notifier.TitleRectangle = new Rectangle(45, 9, 200, 25);
     notifier.ContentRectangle = new Rectangle(45, 40, 220, 68);
     notifier.ContentTextAlignement = ContentAlignment.TopLeft;
     notifier.CloseClickable = true;
     notifier.TitleClickable = false;
     notifier.ContentClickable = false;
     notifier.EnableSelectionRectangle = false;
     notifier.KeepVisibleOnMousOver = true;
     notifier.ReShowOnMouseOver = true;
     notifier.Padding = 0;
     return notifier;
 }
Beispiel #7
0
        public Form1()
        {
            InitializeComponent();
            System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;

            this.conf = new VilcomConfiguration();
            this.conf = this.conf.loadFromFile();

            this.excludes = new VilcomExcludes();
            this.excludes = this.excludes.loadFromFile();

            timer1.Enabled = true;

            Client = new UdpClient(conf.port);

            //загрузим парсер
            try
            {

                parseConf = new Parser();

                parseConf.loadFromFile();
                foreach (ParserRule ruleConf in parseConf.ruleList)
                {
                    TrapGrid.Columns.Add(ruleConf.param, ruleConf.name);
                }
                _debug("Конфигурация парсера загружена!");
            }
            catch (Exception excp)
            {
                //MessageBox.Show("Внимание! Файл конфигурации парсера не найден или был утерян");
            }

            //попытаемся подгрузить данные из трапа
            if (File.Exists("state.data"))
            {
                tList.loadFromFile();

                foreach (Trap trapTemp in tList.dataList)
                {
                    addTrapToGrid(trapTemp);
                }
            }

            taskbarNotifier = new TaskbarNotifier();
            taskbarNotifier.SetBackgroundBitmap("notifyback.bmp",
                               Color.FromArgb(255, 0, 255));
            taskbarNotifier.SetCloseBitmap("close.bmp",
                    Color.FromArgb(255, 0, 255), new Point(220, 8));
            taskbarNotifier.TitleRectangle = new Rectangle(20, 9, 70, 2);
            taskbarNotifier.ContentRectangle = new Rectangle(8, 20, 200, 68);
            taskbarNotifier.NormalContentFont = new Font("Arial",9);
            //taskbarNotifier.TitleClick += new EventHandler(TitleClick);
            //taskbarNotifier.ContentClick += new EventHandler(ContentClick);
            taskbarNotifier.CloseClick += new EventHandler(Close2Click);
        }
Beispiel #8
0
        void webBrowser_NavigateComplete2(object pDisp, ref object URL)
        {
            // If the site or url is null, do not continue
            if (pDisp == null || URL == null) return;

            // Access both the web browser object and the url passed
            // to this event handler
            SHDocVw.WebBrowser browser = (SHDocVw.WebBrowser)pDisp;
            // 웹브라우저가 페이지 이동 중에 만드는 웹브라우저 메소드(webBrowser와 browser은 페이지 이동 중에 딱 한 번 일치한다.)
            // 이를 이용해 한번만 검사하도록 변경한게 if (webBrowser.LocationURL.Equals(browser.LocationURL))
            string url = URL.ToString();
            int rating = 0;
            IHTMLDocument2 document = null;
            if (webBrowser.LocationURL.Equals(browser.LocationURL) && check)
                // 현재 이동하는 페이지가 사용자가 URL창에 입력한 주소와 동일한지 체크
                // 혹은 이미 체크했는지 체크(안하면 차단 페이지에 못들어가고
                // 원래 URL -> 차단 페이지의 버튼 누르면 들어가지는 URL(php 페이지의 burl)의 변수로 들어감 -> 또들어감 -> 또들어감 의 반복
            {
                /* 6월 18~19일 내용 수정
                 * 차단 php 페이지 띄우도록 변경
                 */
                // Grab the document object off of the Web Browser control
                document = (IHTMLDocument2)webBrowser.Document;
                if (document == null) return;

                rating = DBConnector.GetSiteInfo(url);
                if (rating > 0)
                {
                    check = false;
                }
            }
            if (rating <= 0)
            {
                // This is Safe Site.
                // Pass the current URL to the broker
                PassUrlToBroker(url);
            }
            else if (rating >= 1 && rating <= 25)
            {
                // 낮은 점수의 페이지에 접근하면 화면 오른쪽 하단에서 메신저
                // 알림 올라오듯이 만드려고 한거, 근데 작동안함, 하지만 에러가 아예 없어 뭐가 문제인지 파악불가
                // This is Reported Site. But Not Blocked Site
                // Pass the current URL to the broker
                TaskbarNotifier tNotify = new TaskbarNotifier();
                tNotify.SetBackgroundBitmap("popup.bmp", Color.FromArgb(0, 0, 0));
                tNotify.SetCloseBitmap("close.bmp", Color.FromArgb(0, 0, 0), new Point(127, 8));
                tNotify.TitleRectangle = new Rectangle(40, 9, 70, 25);
                tNotify.ContentRectangle = new Rectangle(8, 41, 133, 68);
                tNotify.TitleClick += new EventHandler(TitleClick);
                tNotify.ContentClick += new EventHandler(ContentClick);
                tNotify.CloseClick += new EventHandler(CloseClick);
                tNotify.Show("경고", "신고된 페이지입니다. 주의하여 사용해주세요", 100, 300, 100);
                // 수정이 필요하면 이 위에까지 잘라내고 새로 넣어도 무방함. 아래는 페이지를 띄워주는 코드이므로 안됨
                PassUrlToBroker(url);
            }
            else if (rating >= 26 && rating <= 75)
            {
                // This is Reported Site.
                // Move to weak Blocked page
                // 점수가 그냥 높은 수준일 때 차단 페이지로 이동.
                // webBrowser.LocationURL : URL을 직접 입력, 혹은 Navigate2로 이동할 때 기록되는 페이지
                // BeforeURL : 이전 주소
                browser.Stop();
                browser.Navigate2("http://siteblocker.iptime.org/blocked.php?lvl=0&url=" + webBrowser.LocationURL + "&burl=" + BeforeURL, true);
            }
            else if (rating >= 76 && rating <= 100)
            {
                // This is Reported Site.
                // Move to String Blocked Page
                browser.Stop();
                browser.Navigate2("http://siteblocker.iptime.org/blocked.php?lvl=1&url=" + webBrowser.LocationURL + "&burl=" + BeforeURL, true);
            }
            rating = 0;
        }