Пример #1
0
        private void SaveExcludedTasks()
        {
            // copy to array
            ExcludedWindow[] ExcludedTasks = new ExcludedWindow[this.TasksListPanel.Controls.Count];
            int i = 0;

            while (i < ExcludedTasks.Length)
            {
                TaskItemControl tic = (TaskItemControl)this.TasksListPanel.Controls[i];
                ExcludedTasks[i] = new ExcludedWindow(tic.ClassName, tic.ProcessName);
                i++;
            }

            // save
            WindowsTaskManager.SaveExcludedClassWindows(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath), @"profiles\" + System.Environment.UserName + @"\ExcludedTasks.xml"), ExcludedTasks);
        }
Пример #2
0
        /// <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);
        }