Beispiel #1
0
 /// <summary>
 /// This method fires when the processes have been changed.
 /// </summary>
 /// <param name="e"> The process list. </param>
 protected virtual void FireOnProcessChanged(ProcessListEventArgs e)
 {
     if (this.OnProcessChanged != null)
     {
         this.OnProcessChanged(this, e);
     }
 }
        /// <summary>
        /// This method sends the process list to the clients.
        /// </summary>
        /// <param name="sender"> The object sender. </param>
        /// <param name="e"> The process list. </param>
        public void OnProcessChanged(object sender, ProcessListEventArgs e)
        {
            if (e.List.NewProcesses.Count == 0 && e.List.OldProcesses.Count == 0)
            {
                try
                {
                    var message = NetworkSerealizer.SerealizePing();
                    this.host.SendToClients(message);
                }
                catch (Exception ex)
                {
                    this.FireOnErrorMessagePrint(new StringEventArgs(ex.Message));
                }
            }
            else
            {
                try
                {
                    var message = NetworkSerealizer.Serealize(e.List, this.hostname);

                    this.host.SendToClients(message);
                }
                catch (Exception ex)
                {
                    this.FireOnErrorMessagePrint(new StringEventArgs(ex.Message));
                }
            }
        }
        /// <summary>
        /// This method updates the processes.
        /// </summary>
        /// <param name="sender"> The sender. </param>
        /// <param name="e"> The processes. </param>
        private void UpdateProcesses(object sender, ProcessListEventArgs e)
        {
            List <ProcessContainerVM> temp = new List <ProcessContainerVM>();

            foreach (var item in e.List.NewProcesses)
            {
                ProcessContainerVM processContainerVM = new ProcessContainerVM(item);
                foreach (var item2 in this.Processes)
                {
                    if (item.Id == item2.Id && item2.IsChecked == true)
                    {
                        processContainerVM.IsChecked = true;
                    }
                }

                processContainerVM.OnBoolChanged    += this.ChangeBoolOfProcesses;
                processContainerVM.OnModulesChanged += this.ChangeModulesOfProcesses;
                temp.Add(processContainerVM);
            }

            this.Processes.Clear();

            this.ProcessCount = this.Processes.Count;

            foreach (var item in temp)
            {
                this.Processes.Add(item);
            }

            if (this.isChecked == true)
            {
                this.FireOnIsChecked(new ProcessContainerVMEventArgs(this.Processes));
            }
        }
 /// <summary>
 /// This method fires when a byte message has been completed.
 /// </summary>
 /// <param name="e"> The process list. </param>
 protected virtual void FireOnMessageCompleted(ProcessListEventArgs e)
 {
     if (this.OnMessageCompleted != null)
     {
         this.OnMessageCompleted(this, e);
     }
 }
Beispiel #5
0
        /// <summary>
        /// This method updates the processes.
        /// </summary>
        /// <param name="sender"> The object sender. </param>
        /// <param name="e"> The process list. </param>
        private void GetNewProcesses(object sender, ProcessListEventArgs e)
        {
            List <ProcessContainer> temp = new List <ProcessContainer>();

            foreach (var item in this.Processes)
            {
                temp.Add(item);
            }

            if (this.Processes.Count > 0)
            {
                foreach (var item in e.List.OldProcesses)
                {
                    foreach (var oldProcesses in this.Processes)
                    {
                        if (item.Id == oldProcesses.Id)
                        {
                            temp.Remove(oldProcesses);
                        }
                    }
                }
            }

            this.Processes = temp;

            foreach (var item in e.List.NewProcesses)
            {
                this.Processes.Add(item);
            }

            ProcessListContainer container = new ProcessListContainer();

            foreach (var item in this.Processes)
            {
                container.NewProcesses.Add(item);
            }

            this.FireOnProcessChanged(new ProcessListEventArgs(container));
        }