Example #1
0
        public ProcessSetForm(ProcessSet procSet)
        {
            InitializeComponent();

            _procSet = procSet;

            this.Tag  = _procSet;
            this.Text = _procSet.Name;
        }
        public static TreeNode Create(ProcessSet procSet)
        {
            var treeNode = new TreeNode();

            treeNode.Tag              = procSet;
            treeNode.Text             = $"{procSet.Name} [{procSet.ProcSetID}]";
            treeNode.Name             = procSet.FullName;
            treeNode.ImageKey         = Constants.ImageName.ProcSet;
            treeNode.SelectedImageKey = Constants.ImageName.ProcSet;

            return(treeNode);
        }
Example #3
0
        static void Main(string[] args)
        {
            var  processSet = new ProcessSet();
            bool result     = processSet.Refresh();

            if (!result)
            {
                Console.WriteLine("Get process error");
            }
            var processes = processSet.GetProcesses();

            //foreach(var elem in processes)
            //{
            //    Console.WriteLine("{0} {1}",elem.Name,elem.Id);
            //}
            processSet.RefreshOwnedHandles();
            var handles = processSet.GetAllHandles();

            var handlesSet = from elem in handles
                             where elem.UniqueProcessId.ToInt64() == 17896 || elem.UniqueProcessId.ToInt64() == 10716
                             select elem;
            var sameAddressHandles = from elem in handlesSet
                                     group elem by elem.ObjectAddress.ToInt64();

            foreach (var addresses in sameAddressHandles)
            {
                foreach (var elem in addresses)
                {
                    Console.WriteLine("0x{0:x} {1} {2}",
                                      elem.ObjectAddress.ToInt64(),
                                      elem.UniqueProcessId.ToInt64(),
                                      elem.HandleValue.ToInt64());
                }
                Console.WriteLine();
            }

            //foreach(var elem in handlesSet)
            //{
            //    Console.WriteLine("0x{0:x} {1} {2}",
            //        elem.ObjectAddress.ToInt64(),
            //        elem.UniqueProcessId.ToInt64(),
            //        elem.HandleValue.ToInt64());
            //}

            //foreach (var elem in handles)
            //{
            //    if(elem.UniqueProcessId.ToInt64()==17896||elem.UniqueProcessId.ToInt64()==10716)
            //    Console.WriteLine("0x{0:x} {1} {2}",
            //        elem.ObjectAddress.ToInt64(),
            //        elem.UniqueProcessId.ToInt64(),
            //        elem.HandleValue.ToInt64());
            //}
        }
Example #4
0
        public RemResMessage GetProcessList(RemResMessage message)
        {
            ProcessSet     resultList = new ProcessSet();
            GetProcessList convertedMessage;
            int            minRamBytes;

            List <System.Diagnostics.Process> lstProcess;

            if (!(message is GetProcessList))
            {
                throw new InvalidOperationException("The message type for this messagehandler method is invalid.");
            }

            convertedMessage = message as GetProcessList;

            minRamBytes = convertedMessage.RAMOver;

            if (minRamBytes == 0)
            {
                lstProcess = System.Diagnostics.Process.GetProcesses().ToList();
            }
            else
            {
                lstProcess = System.Diagnostics.Process.GetProcesses().Where(p => p.WorkingSet64 >= minRamBytes).ToList();
            }

            foreach (var proc in lstProcess)
            {
                try
                {
                    resultList.Add(new Process
                    {
                        PID          = proc.Id,
                        ProcessName  = proc.ProcessName,
                        ProcessTitle = proc.MainWindowTitle,
                        Responding   = proc.Responding,
                        RAM          = (int)(proc.WorkingSet64)
                    });
                }
                catch (Exception ex)
                {
                    _log.Debug("Error during accesing the proccess list - " +
                               ex.Message);
                }
            }

            return(new GetProcessListResult()
            {
                ProcessSet = resultList
            });
        }
Example #5
0
        public void ProcessData()
        {
            // Get the specified process set
            ProcessSet procSet = ManagementServer.GetProcSet(1);

            //Load the processes in the process set
            procSet.Processes = ManagementServer.GetProcessVersions(procSet.ProcSetID);
            // Gets the Process of the procset based on the ProcID/Index
            Process process = procSet.Processes[1];
            //OR
            Processes processes = ManagementServer.GetProcesses(procSet.ProcSetID);

            // Gets all the Process Instances for this process
            ProcessInstances processInstances = ManagementServer.GetProcessInstances(process.ProcID);
        }
Example #6
0
        public void DeleteWorkflowReportingSmartObjects(ProcessSet processSet)
        {
            var smartObjectManagementServer = this.GetServer();

            using (smartObjectManagementServer.Connection)
            {
                var serviceObjectName = $"Rpt_{SmartObjectDefinition.GetNameFromDisplay(processSet.FullName)}";

                var smartObjects = from smo in smartObjectManagementServer.GetSmartObjects(Constants.ServiceInstance.WorkflowReporting).SmartObjectList
                                   from se in smo.Metadata.ServiceElements.Cast <ServiceElementInfo>()
                                   where se.Name == "serviceobject" && se.Value == serviceObjectName
                                   select smo;

                foreach (var smartobject in smartObjects)
                {
                    smartObjectManagementServer.DeleteSmartObject(smartobject.Guid, true);
                }
            }
        }
Example #7
0
        private async Task <int> GetProcessSetIdAsync(int currentRow)
        {
            var processSetNameVal = _currentWorkSheet.Cells[currentRow, variableXlsDescription.ProcessSetCol].Value;

            if (processSetNameVal == null)
            {
                return(0);
            }
            var processSetName = processSetNameVal.ToString();
            var processSet     = await _excelImportDataService.ProcessSetRepository.GetProcessSetByName(processSetName);

            if (processSet == null)
            {
                processSet = new ProcessSet {
                    Name = processSetName
                };
                _excelImportDataService.ProcessSetRepository.Add(processSet);
                await _excelImportDataService.UnitOfWork.CompleteAsync();
            }
            return(processSet.Id);
        }
Example #8
0
        private void RefreshValues()
        {
            Action action = () =>
            {
                folioTextBox.Text = DateTime.Now.ToString("s");

                _processSet = K2Client.Instance.WorkflowManager.GetProcessSet(_procSetId);
                _dataFields = K2Client.Instance.WorkflowManager.GetDataFields(_processSet.ProcID);

                dataFieldsScrollableControl.Controls.Clear();

                var panelColor = this.BackColor;

                foreach (var dataField in _dataFields)
                {
                    var dataFieldPanel = new Panel();
                    dataFieldPanel.Tag = dataField;

                    var dataFieldLabel = new Label();
                    dataFieldLabel.AutoSize = true;
                    dataFieldLabel.Text     = dataField.Name;

                    if (dataField.FieldType == DataField.ProcessXMLField)
                    {
                        dataFieldLabel.Text += $" ( {dataField.FieldType} ) ";
                    }

                    dataFieldLabel.Dock = DockStyle.Left;
                    dataFieldPanel.Controls.Add(dataFieldLabel);

                    var dataFieldTextBox = new TextBox();
                    dataFieldTextBox.Dock = DockStyle.Fill;

                    var textButton = new Button();
                    textButton.Text         = Resources.Edit;
                    textButton.AutoSize     = true;
                    textButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;
                    textButton.Dock         = DockStyle.Right;
                    textButton.BackColor    = this.BackColor;

                    dataFieldPanel.Controls.Add(textButton);
                    textButton.Click += new EventHandler(textButton_Click);

                    dataFieldPanel.Controls.Add(dataFieldTextBox);
                    dataFieldPanel.Height    = dataFieldTextBox.Height;
                    dataFieldPanel.BackColor = panelColor;

                    panelColor = (panelColor == this.BackColor) ? Color.Silver : this.BackColor;

                    dataFieldTextBox.BringToFront();
                    dataFieldTextBox.DataBindings.Add(new Binding("Text", dataField, "Value", false, DataSourceUpdateMode.OnPropertyChanged));

                    dataFieldsScrollableControl.Controls.Add(dataFieldPanel);
                    dataFieldPanel.Dock = DockStyle.Top;
                    dataFieldPanel.BringToFront();
                }

                var labels = (from c in dataFieldsScrollableControl.Controls.OfType <Panel>()
                              from l in c.Controls.OfType <Label>()
                              select l)
                             .EmptyIfNull()
                             .ToArray();

                var maxWidth = labels.Length == 0 ? 0 : labels.Max(i => i.Width);

                // Set the labels to have same width
                foreach (var label in labels)
                {
                    label.AutoSize = false;
                    label.Width    = maxWidth;
                }
            };

            this.Draw(action);
        }
Example #9
0
 public void Remove(ProcessSet ProcessSet)
 {
     context.Remove(ProcessSet);
 }
Example #10
0
 public void Add(ProcessSet ProcessSet)
 {
     context.ProcessSet.Add(ProcessSet);
 }