Ejemplo n.º 1
0
 private void CreateTasks()
 {
     RemoveTasks();
     foreach (var window in windowManager.GetWindows())
     {
         Console.Out.WriteLine(window.Handler);
         var task = new Task(window);
         task.WindowSetActive += TaskWindowSetActive;
         TaskHolder.Children.Add(task);
     }
 }
Ejemplo n.º 2
0
        private void LoadWindows()
        {
            try
            {
                var           windows     = windowManager.GetWindows();// returns all the active windows
                List <Window> all_windows = new List <Window>();

                foreach (var window in windows)
                {
                    new Task(window);
                    Window win = new Window();
                    // path
                    int processid = 0;
                    GetWindowThreadProcessId((IntPtr)window.Handler, out processid);
                    string path = (Process.GetProcessById(processid)).Modules[0].FileName;

                    //icon
                    dynamic icon = BitmapFromSource(window.ProgramIcon);
                    icon = ScreenCapture.ImgtoBase64(icon);

                    win.id     = Guid.NewGuid().ToString();
                    win.handle = window.Handler.ToInt32();
                    win.title  = Task.checkTitle(window.Title, window.Handler);
                    win.path   = path;
                    win.icon   = icon;
                    if (window.Title != "")
                    {
                        all_windows.Add(win);
                    }
                }
                ((Func <object, Task <object> >)Main.callback)(all_windows);
            }
            catch (Exception e)
            {
                ((Func <object, Task <object> >)Main.callback)("Error: " + e.Message);
            }
        }