示例#1
0
        public MainUI()
        {
            InitializeComponent();

            SetDllDirectoryW(EventManager.InstallPath);

            EventManager.NotifyNewEvent += DisplayNewEvent;
            EventManager.Initialize();
            MonitoredProcesses.Initialize();
            RealtimeLog.NewLogEntryMethod += DisplayRealtimeLogEvent;
            RealtimeLog.Initialize();
        }
示例#2
0
        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("Do you wish to exit Crystal AEP? Unless disabled, protection will continue even if the application is closed.", "Exit Program?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dr == System.Windows.Forms.DialogResult.Yes)
            {
                MonitoredProcesses.TerminateThread();
                RealtimeLog.TerminateThread();
                MainUI.ShuttingDownProcess = true;
                Application.Exit();
            }
        }
示例#3
0
        private void tvMonProc_AfterSelect(object sender, TreeViewEventArgs e)
        {
            // preserve selected image icon
            tvMonProc.SelectedImageKey = (string)tvMonProc.Nodes[tvMonProc.SelectedNode.Index].Tag;

            TreeNode       tn = tvMonProc.Nodes[tvMonProc.SelectedNode.Index];
            WatchedProcess wp = null;

            if (!MonitoredProcesses.Processes.TryGetValue((string)tn.Tag, out wp))
            {
                return;
            }

            // update enabled features checkboxes
            RefreshEnabledFeatures(NativeMethods.GetProcessFeatures((uint)wp.PID));

            // update realtime log
            RealtimeLog.Pause();

            // save off the currently displayed logs for the previously selected process
            if (lvRealtime.Items.Count != 0)
            {
                ListViewItem[] rgSavedtems = new ListViewItem[lvRealtime.Items.Count];
                lvRealtime.Items.CopyTo(rgSavedtems, 0);
                perProcessRtLogs[(int)RealtimeLog.SelectedPid] = rgSavedtems;
            }

            // reload the previously displayed logs for the currently selected process
            lvRealtime.Items.Clear();

            if (perProcessRtLogs.ContainsKey(wp.PID))
            {
                ListViewItem[] rgSavedtems = perProcessRtLogs[wp.PID];
                AddAlertListViewItemArray(rgSavedtems);
            }

            RealtimeLog.SelectedPid = (uint)wp.PID;

            RealtimeLog.Resume();
        }