2017-05-07 17:58:48 -04:00
|
|
|
|
using System.Collections.Generic;
|
2017-04-30 10:46:36 -04:00
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
|
2017-08-23 13:38:40 -04:00
|
|
|
|
namespace Histacom2.Engine
|
2017-04-30 10:46:36 -04:00
|
|
|
|
{
|
|
|
|
|
public class TaskBarController
|
|
|
|
|
{
|
2017-07-31 16:19:41 -04:00
|
|
|
|
|
|
|
|
|
public static int AvalibleApplicationID = 0;
|
2017-04-30 10:46:36 -04:00
|
|
|
|
|
2017-05-01 04:54:13 -04:00
|
|
|
|
public Panel AddTaskbarItem95(string ApplicationID, string ApplicationName, Image ApplicationIcon, UserControl taskbar_item, Panel oldPanel)
|
2017-04-30 10:46:36 -04:00
|
|
|
|
{
|
|
|
|
|
Panel returnPanel = oldPanel;
|
|
|
|
|
|
|
|
|
|
AvalibleApplicationID++;
|
|
|
|
|
|
|
|
|
|
taskbar_item.BackgroundImage = ApplicationIcon;
|
|
|
|
|
taskbar_item.Tag = ApplicationName;
|
2017-07-31 16:19:41 -04:00
|
|
|
|
if (AvalibleApplicationID == 1) taskbar_item.Dock = DockStyle.Left;
|
|
|
|
|
taskbar_item.Location = new Point(160 * returnPanel.Controls.Count, 0);
|
2017-04-30 10:46:36 -04:00
|
|
|
|
returnPanel.Controls.Add(taskbar_item);
|
|
|
|
|
|
|
|
|
|
return returnPanel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<Form> GetAllOpenApps()
|
|
|
|
|
{
|
|
|
|
|
List<Form> AppsList = new List<Form>();
|
|
|
|
|
foreach (Form form in Application.OpenForms)
|
|
|
|
|
{
|
2017-05-24 16:42:48 -04:00
|
|
|
|
try
|
2017-04-30 10:46:36 -04:00
|
|
|
|
{
|
2017-05-24 16:42:48 -04:00
|
|
|
|
if (form.Tag.ToString() != "ignoreFormOnTaskbar")
|
|
|
|
|
{
|
|
|
|
|
AppsList.Add(form);
|
|
|
|
|
}
|
|
|
|
|
} catch {
|
2017-04-30 10:46:36 -04:00
|
|
|
|
AppsList.Add(form);
|
2017-05-24 16:42:48 -04:00
|
|
|
|
}
|
2017-04-30 10:46:36 -04:00
|
|
|
|
}
|
|
|
|
|
return AppsList;
|
|
|
|
|
}
|
2017-05-01 04:54:13 -04:00
|
|
|
|
|
|
|
|
|
public void FocusAppFromID(string ApplicationID)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
foreach (Form form in Application.OpenForms)
|
|
|
|
|
{
|
|
|
|
|
if (form.Tag.ToString() == ApplicationID)
|
|
|
|
|
{
|
|
|
|
|
form.Show();
|
|
|
|
|
form.BringToFront();
|
|
|
|
|
form.Focus();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-04-30 10:46:36 -04:00
|
|
|
|
}
|
|
|
|
|
}
|