public int UpdateProcess(ProcessListModel model) { var process = this.db .TblProcess .Where(i => i.IdProcess == model.IdProcess) .FirstOrDefault(); process.Process = model.Process; process.FunctionName = model.FunctionName; process.ProcessMap = model.ProcessMap; process.Mnc = model.Mnc; process.SlaType = model.SlaType; process.SlaTarget = model.SlaTarget; process.Level2Taxonomy = model.Level2Taxonomy; process.Level3Taxonomy = model.Level3Taxonomy; process.Pid = model.Pid; process.NiceQueue = model.NiceQueue; process.Group = model.Group; process.SpphIdProcess = model.SpphIdProcess; this.db.TblProcess.Update(process); this.db.SaveChanges(); return(process.IdProcess); }
public static ProcessListModel GetProccesses() { ProcessListModel processes = new ProcessListModel(); EnumWindowsDelegate enumCallback = new EnumWindowsDelegate(EnumWindowsCallBack); EnumWindows(enumCallback, processes); return(processes); }
internal static bool EnumWindowsCallBack(int Hwnd, ProcessListModel Processes) { ProcessModel model = new ProcessModel(); // Visible != Minimized (I think) if (!IsWindowVisible(Hwnd)) { return(true); } // Can the Window be shown by using alt-tab if (IsAltTabWindow(Hwnd)) { model.WindowsHandle = Hwnd; try { int pid = 0; Program.GetWindowThreadProcessId(Hwnd, out pid); if (pid > 0) { try { model.ProcessID = pid; Process p = Process.GetProcessById(pid); if (p != null) { string filename = p.MainModule.FileName; filename = System.IO.Path.GetFileName(filename); model.Filename = filename; StringBuilder windowText = new StringBuilder(256); Program.GetWindowText(Hwnd, windowText, 256); model.WindowText = windowText.ToString(); if (filename.Contains("explorer.exe")) { model.IsWindowsExplorer = true; } Processes.Items.Add(model); } } // Do something or not, // catch probably if window process // is closed while querying info catch { } } } // Do something or not, // catch probably if window process // is closed while querying info catch { } } return(true); }
static void Main(string[] args) { ProcessListModel processes = Program.GetProccesses(); foreach (ProcessModel process in processes.Items) { Console.WriteLine("Program: " + process.Filename + "[" + process.IsWindowsExplorer.ToString() + "]"); Console.WriteLine("- Window Text: " + process.WindowText); } Console.ReadKey(); }
public int AddProcess(ProcessListModel model) { var process = new tbl_Process() { Process = model.Process, FunctionName = model.FunctionName, ProcessMap = model.ProcessMap, Mnc = model.Mnc, SlaType = model.SlaType, SlaTarget = model.SlaTarget, Level2Taxonomy = model.Level2Taxonomy, Level3Taxonomy = model.Level3Taxonomy, Pid = model.Pid, NiceQueue = model.NiceQueue, Group = model.Group, SpphIdProcess = model.SpphIdProcess }; this.db.TblProcess.Add(process); this.db.SaveChanges(); return(process.IdProcess); }
public ViewModel() { ProcessListModel = new ProcessListModel(); CurrentProcesses = ProcessListModel.SingleProcessesList; ProcessListModel.PropertyChanged += EventHandler; }
public static extern int EnumWindows(EnumWindowsDelegate CallBack, ProcessListModel Processes);