private void LoadExcludedTasks() { // load the exclusion list ExcludedWindow[] ExclusionList = WindowsTaskManager.LoadExcludedClassWindows(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath), @"profiles\" + System.Environment.UserName + @"\ExcludedTasks.xml")); if (ExclusionList == null) { return; } // actually catalog them int i = 0; foreach (ExcludedWindow window in ExclusionList) { TaskItemControl tic = new TaskItemControl(); tic.ProcessName = window.ProcessName; tic.ClassName = window.ClassName; // try to find a currently running window that matches this spec IntPtr FoundWindow = FindFirstWindowLike(window); if (FoundWindow != IntPtr.Zero) { tic.WindowTitle = WindowsTaskManager.GetWindowText(FoundWindow); using (Bitmap shot = WindowsTaskManager.GetWindowBitmap(FoundWindow)) { tic.WindowScreenshot = ImageHelper.GetAspectThumbnail(shot, new Size(64, 64)); } } else { tic.WindowTitle = System.IO.Path.GetFileNameWithoutExtension(window.ProcessName); } // set this properties tic.Width = this.TasksListPanel.Width; tic.Anchor |= AnchorStyles.Right; tic.Top = tic.Height * i; // hook up events tic.RemoveLinkClicked += new EventHandler(tic_RemoveLinkClicked); this.TasksListPanel.Controls.Add(tic); i++; } }
/// <summary> /// Adds a window class name to the exclusion list /// </summary> public void IgnoreWindow() { // create the new excluded window ExcludedWindow me = new ExcludedWindow(WindowsTaskManager.GetWindowClass(Handle), System.IO.Path.GetFileName(WindowsTaskManager.GetExecutableName(Handle))); //System.Diagnostics.Debug.WriteLine("ignoring "+me.ClassName+" from "+me.ProcessName); // load the custom list ExcludedWindow[] CustomExcludeList = WindowsTaskManager.LoadExcludedClassWindows(Orbit.Configuration.ConfigurationInfo.LocationsConfig.GetExcludedTasksFilePath()); if (CustomExcludeList == null) { ExcludedWindow[] NewExcludedList = new ExcludedWindow[1]; NewExcludedList[0] = me; WindowsTaskManager.SaveExcludedClassWindows(Orbit.Configuration.ConfigurationInfo.LocationsConfig.GetExcludedTasksFilePath(), NewExcludedList); return; } // set our new list ExcludedWindow[] ExcludeList = new ExcludedWindow[CustomExcludeList.Length + 1]; // set our mandatory excluded tasks // add our new class ExcludeList[0] = me; // copy our custom exclusion list int i = 0; while (i < CustomExcludeList.Length) { ExcludeList[i + 1] = CustomExcludeList[i]; i++; } WindowsTaskManager.SaveExcludedClassWindows(Orbit.Configuration.ConfigurationInfo.LocationsConfig.GetExcludedTasksFilePath(), ExcludeList); }
private static ExcludedWindow[] LoadExcludedClassWindows() { // create orbit's own excluded window ExcludedWindow me = new ExcludedWindow("WindowsForms10.Window.8.app2", "Orbit.exe"); // load the list ExcludedWindow[] CustomExcludeList = WindowsTaskManager.LoadExcludedClassWindows(Orbit.Configuration.ConfigurationInfo.LocationsConfig.GetExcludedTasksFilePath()); if (CustomExcludeList == null) { return new ExcludedWindow[] { me } } ; // set our new list ExcludedWindow[] ExcludeList = new ExcludedWindow[CustomExcludeList.Length + 1]; // set our mandatory excluded tasks // excluding all orbit windows ExcludeList[0] = me; // copy our custom exclusion list int i = 0; while (i < CustomExcludeList.Length) { ExcludeList[i + 1] = CustomExcludeList[i]; i++; } return(ExcludeList); } #endregion }