public Tray()
        {
            InitializeComponent();

            FormClosing += Tray_FormClosing;

            Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
            WindowState = FormWindowState.Minimized;
            ShowInTaskbar = false;
            MinimizeBox = false;
            MaximizeBox = false;

            // Process any command line parameters
            ArgvConfigSource source = new ArgvConfigSource(Environment.GetCommandLineArgs());
            source.AddSwitch("Main", "watch-process", "p");
            source.AddSwitch("Main", "library", "l");

            // Create a watcher
            _watcher = new Watcher(source);
            _watcher.OnNotifyActivity += _watcher_OnNotifyActivity;
            _watcher.OnNotifyRestart += _watcher_OnNotifyRestart;
            _watcher.OnNotifyError += _watcher_OnNotifyError;

            // Start a thread for the watcher
            _watchThread = new Thread(new ThreadStart(_watcher.Run));
            _watchThread.Start();

            // Watch params
            libraryLabel.Text = source.Configs["Main"].GetString("library", Settings.Default.ClientLibrary);
            processLabel.Text = source.Configs["Main"].GetString("watch-process", Settings.Default.ProcessPath);
        }
        public Tray()
        {
            InitializeComponent();

            Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
            
            WindowState = FormWindowState.Minimized;
            ShowInTaskbar = false;
        
            // Start a thread for the watcher
            _watcher = new Watcher();
            _watchThread = new Thread(new ThreadStart(_watcher.Run));
            _watchThread.Start();
        }
Exemple #3
0
        public Tray()
        {
            InitializeComponent();

            // Create a notify icon
            this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
            this.notifyIcon.ContextMenuStrip = this.notifyContextMenu;
            this.notifyIcon.Icon             = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
            this.notifyIcon.Text             = "Watch Dog";
            this.notifyIcon.Visible          = true;

            FormClosing += Tray_FormClosing;

            Icon          = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
            WindowState   = FormWindowState.Minimized;
            ShowInTaskbar = false;
            MinimizeBox   = false;
            MaximizeBox   = false;

            // Process any command line parameters
            ArgvConfigSource source = new ArgvConfigSource(Environment.GetCommandLineArgs());

            source.AddSwitch("Main", "watch-process", "p");
            source.AddSwitch("Main", "library", "l");

            // Create a watcher
            _watcher = new Watcher(source);
            _watcher.OnNotifyActivity += _watcher_OnNotifyActivity;
            _watcher.OnNotifyRestart  += _watcher_OnNotifyRestart;
            _watcher.OnNotifyError    += _watcher_OnNotifyError;

            // Start a thread for the watcher
            _watchThread = new Thread(new ThreadStart(_watcher.Run));
            _watchThread.Start();

            // Watch params
            libraryLabel.Text = source.Configs["Main"].GetString("library", Settings.Default.ClientLibrary);
            processLabel.Text = source.Configs["Main"].GetString("watch-process", Settings.Default.ProcessPath);
        }