void TaskPanel_MouseMove(object sender, MouseEventArgs e) { int taskIndex = -1; IRuntimeActivity act = GetActivityAtPosition(e.X, e.Y, out taskIndex); if (act != null) { if (!act.Equals(lastActivity)) { string res = ""; foreach (string key in act.Reservations.Keys) { for (int i = 0; i < act.Reservations[key].Length; i++) { res += " " + key + "(" + (act.Reservations[key][i]) + ")\n"; } } if (res.Length == 0) { res = "no resource used"; } string str = string.Format("Activity: {0}\nStatus: {6}\n Duration: {1}\n Ellapse: {2} / Remaining: {3}\n Resource:\n{4}Task: {5}", act.Name, formatTimeScaleText(act.Duration), FormatTime(act.PlannedStart), FormatTime(act.PlannedStart + act.PlannedDuration), res, tasks[taskIndex].Name, act.Status); tooltip.SetToolTip(TaskPanel, str); lastActivity = act; } } else { tooltip.SetToolTip(TaskPanel, null); lastActivity = null; } }
void ResourcePanel_MouseMove(object sender, MouseEventArgs e) { int unit = -1; string name = null; int taskIndex = -1; IRuntimeActivity res = GetResourceActivityAtPosition(e.X, e.Y, out name, out unit, out taskIndex); if (res != null) { if (!res.Equals(lastResourceActivity)) { string t = string.Format("Resource {0}({1})\n Duration: {2}\n Ellapse: {3} / Remainning: {4}\nActivity: {5}\nTask: {6}", name, unit, formatTimeScaleText(res.Duration), FormatTime(res.PlannedStart), FormatTime(res.PlannedStart + res.PlannedDuration), res.Name, tasks[taskIndex].Name); lastResourceActivity = res; tooltip.SetToolTip(ResourcePanel, t); } } else { lastResourceActivity = null; tooltip.SetToolTip(ResourcePanel, null); } }