public List<Interfaces.IDisplayViewer> addGroup(DisplayGroupNode node) { List<Interfaces.IDisplayViewer> retValue = new List<IDisplayViewer>(); List<Display> displays = DisplayController.Instance.ForceCheckGroup(node); foreach (Display disp in displays) { if (!m_Viewers.ContainsKey(disp.Type.Name)) { DisplayViewer viewer = new DisplayViewer(disp) { Pos = getPosition(disp) }; m_Viewers.Add(disp.Type.Name, viewer); retValue.Add(viewer); } } PresentationController.Instance.NotifyMonitorListChanged(from pair in m_Viewers select pair.Value.Display); return retValue; }
public void LoadPositions(String path) { if (!File.Exists(path)) return; try { System.Xml.Serialization.XmlSerializer ser = new System.Xml.Serialization.XmlSerializer(typeof(MonitoringSaver[])); MonitoringSaver[] rects = (MonitoringSaver[])ser.Deserialize(new FileStream(path, FileMode.Open)); foreach (var r in rects) { Display disp = DisplayController.Instance.UngrouppedDisplays().Where(x => x.Type.Name == r.Name).FirstOrDefault(); if (disp == null) disp = (from gr in DisplayController.Instance.GrouppedDisplays() from d in gr.Value where d.Type.Name == r.Name select d).FirstOrDefault(); if (disp == null) continue; DisplayViewer viewer = new DisplayViewer(disp) { Pos = r.Pos, IsTransformed = true }; m_Viewers.Add(r.Name, viewer); DisplayController.Instance.ForceCheckDisplay(r.Name, true); if (OnViewerAdded != null) OnViewerAdded(viewer); } PresentationController.Instance.NotifyMonitorListChanged(from pair in m_Viewers select pair.Value.Display); } catch (Exception /*ex*/) { // не ломаем ничего если не получилось загрузить позиции } }
/// <summary> /// Создать новый DisplayViewer при переносе мышкой дисплея на область мониторинга /// </summary> /// <param name="node"></param> /// <returns></returns> public Interfaces.IDisplayViewer addViewer(UI.PresentationDesign.DesignUI.Controls.DisplayList.DisplayNode node) { if (m_Viewers.ContainsKey(node.Display.Type.Name)) return null; DisplayViewer viewer = new DisplayViewer(node.Display) { Pos = getPosition(node.Display) }; m_Viewers.Add(node.Display.Type.Name, viewer); DisplayController.Instance.ForceCheckDisplay(viewer.Name, true); PresentationController.Instance.NotifyMonitorListChanged(from pair in m_Viewers select pair.Value.Display); return viewer; }
/// <summary> /// Обрабочик включения/выключения галочки в списке дисплеев /// </summary> /// <param name="disp">Измененный дисплей</param> /// <param name="isChecked">Новое значение галочки</param> /// <returns>true, если данный дисплей можно включить</returns> bool Instance_OnDisplayChecked(TechnicalServices.Persistence.SystemPersistence.Presentation.Display disp, bool isChecked) { if (isChecked) { DisplayViewer viewer = new DisplayViewer(disp) { Pos = getPosition(disp) }; m_Viewers.Add(disp.Type.Name, viewer); if (OnViewerAdded != null) OnViewerAdded(viewer); } else if (OnViewerRemoved != null) { m_Viewers.Remove(disp.Type.Name); OnViewerRemoved(new DisplayViewer(disp) { Pos = defaultPos }); } PresentationController.Instance.NotifyMonitorListChanged(from pair in m_Viewers select pair.Value.Display); return true; }