コード例 #1
0
 public ConfigurationBox(bool lTemCancel)
 {
     InitializeComponent();
     _configuration      = ConfigutarionManager.Instance();
     BtnCancelar.Visible = lTemCancel;
     PreencherCampos();
 }
コード例 #2
0
ファイル: ProcessIcon.cs プロジェクト: luizhj/FileMonitor
        private void DefineTimer()
        {
            var minutes     = TimeSpan.FromMinutes(ConfigutarionManager.Instance().Minutes_Refresh);
            var miliseconds = minutes.TotalMilliseconds;
            var timer       = new Timer
            {
                Interval = (int)miliseconds,
            };

            timer.Tick += Timer_Tick;
            timer.Start();
        }
コード例 #3
0
ファイル: ProcessIcon.cs プロジェクト: luizhj/FileMonitor
        /// <summary>
        /// Displays the icon in the system tray.
        /// </summary>
        public void Display()
        {
            // Put the icon in the system tray and allow it react to mouse clicks.
            ni.MouseClick     += new MouseEventHandler(MouseClick);
            ni.Icon            = Resources.StatusOKComplete;
            ni.BalloonTipTitle = "File Monitor";
            ni.Text            = "File  Monitor";
            ni.Visible         = true;

            // Attach a context menu.
            ni.ContextMenuStrip = new ContextMenus().Create();

            ConfigutarionManager.Instance().Icon = string.Empty;
            ConfigutarionManager.Save();

            while (string.IsNullOrEmpty(ConfigutarionManager.Instance().Folder))
            {
                new ConfigurationBox(false).ShowDialog();
            }

            RefreshStatus();
            DefineTimer();
        }
コード例 #4
0
 public ConfigurationBox()
 {
     InitializeComponent();
     _configuration = ConfigutarionManager.Instance();
     PreencherCampos();
 }
コード例 #5
0
ファイル: ProcessIcon.cs プロジェクト: luizhj/FileMonitor
        public bool RefreshStatus()
        {
            if (string.IsNullOrEmpty(ConfigutarionManager.Instance().Folder))
            {
                return(false);
            }
            var retorno    = false;
            var LastUpdate = GetLastUpdatedFile(ConfigutarionManager.Instance().Folder, ConfigutarionManager.Instance().SubFolder);
            var DifDate    = DateTime.Now - LastUpdate;
            int difdate    = (int)DifDate.TotalMinutes;

            var bkpicon = ConfigutarionManager.Instance().Icon;

            if ((int)DifDate.TotalMinutes > ConfigutarionManager.Instance().Minutes_Red)
            {
                ConfigutarionManager.Instance().Icon = "StatusError";
            }
            else if ((int)DifDate.TotalMinutes > ConfigutarionManager.Instance().Minutes_Yellow)
            {
                ConfigutarionManager.Instance().Icon = "StatusWarning";
            }
            else
            {
                ConfigutarionManager.Instance().Icon = "StatusOKComplete";
            }

            ConfigutarionManager.Instance().LastUpdate = LastUpdate;
            ConfigutarionManager.Save();

            switch (ConfigutarionManager.Instance().Icon)
            {
            case "StatusError":

                ni.Icon            = Resources.StatusError;
                ni.BalloonTipIcon  = ToolTipIcon.Error;
                ni.BalloonTipText  = "O serviço está sem receber arquivos há " + difdate.ToString() + " minutos ";
                ni.BalloonTipText += "(Tolerância " + ConfigutarionManager.Instance().Minutes_Red.ToString() + " minutos). ";
                ni.BalloonTipText += "\nData e Hora do ultimo recebimento: " + ConfigutarionManager.Instance().LastUpdate.ToString("dd/MM/yyyy HH:mm:ss");
                break;

            case "StatusWarning":
                ni.Icon            = Resources.StatusWarning;
                ni.BalloonTipIcon  = ToolTipIcon.Warning;
                ni.BalloonTipText  = "O serviço está sem receber arquivos há " + difdate.ToString() + " minutos ";
                ni.BalloonTipText += "(Tolerância = " + ConfigutarionManager.Instance().Minutes_Yellow.ToString() + " minutos). ";
                ni.BalloonTipText += "\nData e Hora do ultimo recebimento: " + ConfigutarionManager.Instance().LastUpdate.ToString("dd/MM/yyyy HH:mm:ss");
                break;

            default:
                ni.Icon            = Resources.StatusOKComplete;
                ni.BalloonTipIcon  = ToolTipIcon.Info;
                ni.BalloonTipText  = "Recebido um arquivo a " + difdate.ToString() + " minutos.\n";
                ni.BalloonTipText += "Alterado o status para 'OK' \n";
                ni.BalloonTipText += "Data e Hora do ultimo recebimento: " + ConfigutarionManager.Instance().LastUpdate.ToString("dd/MM/yyyy HH:mm:ss");
                break;
            }
            if (ConfigutarionManager.Instance().Icon == "StatusError")
            {
                MessageBox.Show(ni.BalloonTipText.Replace("\n", "\n\n"), "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                ni.ShowBalloonTip(5000);
            }
            retorno = true;
            return(retorno);
        }