Пример #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var setting = ConfigurationManager.AppSettings["TestMode"];

            if (!String.IsNullOrEmpty(setting) && Convert.ToBoolean(setting) == true)
            {
                // Show the system tray icon.
                using (PolicyForm pf = new PolicyForm())
                {
                    pf.Show();

                    // Make sure the application runs!
                    Application.Run();
                }
            }
            else
            {
                // Show the system tray icon.
                using (ProcessIcon pi = new ProcessIcon())
                {
                    pi.Display();

                    // Make sure the application runs!
                    Application.Run();
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProcessIcon"/> class.
        /// </summary>
        public ProcessIcon()
        {
            _policyForm = new PolicyForm();
            _notifyIcon = new NotifyIcon();

            _storageDetector = new StorageDetector();
            _storageDetector.StorageDetected += Sd_StorageDetected;

            _notifyIcon.BalloonTipIcon  = ToolTipIcon.Info;
            _notifyIcon.BalloonTipTitle = ConfigurationManager.AppSettings["StorageAddedMessageTitle"];
            _notifyIcon.BalloonTipText  = ConfigurationManager.AppSettings["StorageAddedMessageMessage"];

            logger.Info("Created");
        }