Ejemplo n.º 1
0
        private void chooseProcessButton_Click(object sender, EventArgs e)
        {
            var processChooseDialog = new ProcessChooseDialog();

            processChooseDialog.ShowDialog();
            process = processChooseDialog.SelectedProcess;
            if (process == null)
            {
                return;
            }
            processNameTextBox.Text = process.Name;
            RefreshGrid();
        }
Ejemplo n.º 2
0
        private List <WcfServiceProcess> GetWcfServiceProcesses(
            IReadOnlyList <ProcessInfo> processInfo)
        {
            var connection = new ConnectionOptions
            {
                Authentication = AuthenticationLevel.PacketPrivacy
            };

            const string wcfNamespace = @"\\localhost\Root\ServiceModel";

            var scope = new ManagementScope(wcfNamespace, connection);

            scope.Connect();

            var oQuery   = new ObjectQuery("SELECT * FROM AppDomainInfo");
            var searcher = new ManagementObjectSearcher(scope, oQuery);

            var listOfProcesses = new List <WcfServiceProcess>();

            try
            {
                foreach (ManagementObject mo in searcher.Get())
                {
                    int pid = (int)mo["ProcessId"];

                    var serviceProcess =
                        listOfProcesses.FirstOrDefault(x => x.Process.ProcessId == pid);
                    if (serviceProcess == null)
                    {
                        serviceProcess = new WcfServiceProcess
                        {
                            Process = processInfo.First(x => x.ProcessId == pid)
                        };
                        listOfProcesses.Add(serviceProcess);
                    }

                    var instance = new WcfServiceAppDomain(mo);
                    serviceProcess.Services.Add(instance);
                }
            }
            catch (ManagementException)
            {
            }
            return(listOfProcesses);
        }
Ejemplo n.º 3
0
 private void ProcessChooseDialog_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     SelectedProcess = processes[processList.SelectedIndex];
     this.Close();
 }
Ejemplo n.º 4
0
 private void selectButton_Click(object sender, EventArgs e)
 {
     SelectedProcess = processes[processList.SelectedIndex];
     this.Close();
 }