Inheritance: RaumfeldNET.Base.Base
Beispiel #1
0
        private Zone createZoneForXMLNode(XmlNode _zoneNode)
        {
            if (_zoneNode == null)
                return null;

            try
            {
                Zone newZone = new Zone();
                ZoneTrackMediaList mediaList;
                XmlNodeList nodesAssignedRooms;
                Room newRoom;

                newZone.udn = xmlDocumentHelper.getNodeAttributeValue(_zoneNode, "udn");
                newZone.uuid = newZone.udn.Substring(5);

                mediaList = Global.getZoneTitleListManager().getListForZone(newZone.udn);
                if (mediaList != null)
                    newZone.trackListId = mediaList.listId;

                if (String.IsNullOrWhiteSpace(newZone.udn))
                    throw new Exception("Zone hat keinen UDN Identifier");

                nodesAssignedRooms = _zoneNode.SelectNodes("room");
                if (nodesAssignedRooms != null)
                {
                    foreach (XmlNode nodeRoom in nodesAssignedRooms)
                    {
                        newRoom = this.createRoomForXMLNode(nodeRoom);
                        newRoom.zoneUDN = newZone.udn;
                        rooms.Add(newRoom.udn, newRoom);
                        this.writeLog(LogType.Info, String.Format("Raum '{0}' in Zone '{1}' gefunden", newRoom.name, newZone.udn));
                        this.linkRoomToRoomRenderer(newRoom);
                        newZone.roomUDNs.Add(newRoom.udn);
                    }
                }

                newZone.createZoneNameFromRooms();

                this.writeLog(LogType.Info, String.Format("Zone UDN: '{0}' erstellt", newZone.udn));
                return newZone;
            }
            catch (Exception e)
            {
                this.writeLog(LogType.Error, "Fehler beim erstellen von Zone aus XML-Knoten", e, _zoneNode.InnerXml);
                return null;
            }
        }
        protected void showAvailableZonesPopup(Control _object, String _callerZoneUDN)
        {
            List<String> zoneOptions = new List<string>();
            Zone zoneDummy;
            MenuItem menuItem;

            if (_object != null)
            {
                _object.ContextMenu = new ContextMenu();

                if (String.IsNullOrEmpty(_callerZoneUDN))
                {
                    zoneDummy = new Zone();
                    zoneDummy.name = "Neue Zone erstellen...";
                    zoneDummy.uuid = "NEW";
                }
                else
                {
                    zoneDummy = new Zone();
                    zoneDummy.name = "Von Zone entfernen...";
                    zoneDummy.uuid = "REMOVE";
                }

                menuItem = new MenuItem();
                menuItem.DataContext = zoneDummy;
                menuItem.Tag = _object;
                menuItem.Header = zoneDummy.name;
                menuItem.Click += menuItemRoomAdd_ClickSink;

                _object.ContextMenu.Items.Add(menuItem);
                foreach (var zone in rfController.zoneManager.getZones())
                {
                    if (String.IsNullOrWhiteSpace(_callerZoneUDN) && _callerZoneUDN == zone.uuid)
                        continue;
                    if (!String.IsNullOrEmpty(zone.udn))
                    {
                        menuItem = new MenuItem();
                        menuItem.DataContext = zone;
                        menuItem.Tag = _object;
                        menuItem.Header = zone.name;
                        menuItem.Click += menuItemRoomAdd_ClickSink;
                        _object.ContextMenu.Items.Add(menuItem);
                    }

                }

                _object.ContextMenu.PlacementTarget = this;
                _object.ContextMenu.IsOpen = true;
            }
        }
Beispiel #3
0
        public void linkZoneToVirtualRenderer(Zone _zone, Boolean _unlink = false, Boolean _crossLink = true)
        {
            RendererManager rendererManager = Global.getRendererManager();
            RendererVirtual renderer;

            // renderer UDN's are stored without 'uuid:' so we have to search with the uuid value cause this is the udn of the renderer
            renderer = (RendererVirtual)rendererManager.getRenderer(_zone.uuid);
            if (renderer != null)
            {
                if (_unlink)
                    renderer.zoneUDN = String.Empty;
                else
                    renderer.zoneUDN = _zone.udn;
                renderer.zoneLinked();
                //rendererManager.updateRenderersValue(renderer);
                if(_crossLink)
                    rendererManager.linkVirtualRendererToZone(renderer, _unlink, false);

                this.checkAllRenderersLinked();

                if (_unlink == true)
                    this.writeLog(LogType.Info, String.Format("Zone '{0}' wurde von Renderer '{1}' entfernt", _zone.udn, renderer.udn));
                else
                    this.writeLog(LogType.Info, String.Format("Zone '{0}' wurde zu Renderer '{1}' zugeordnet", _zone.udn, renderer.udn));
            }
            else
                this.writeLog(LogType.Warning, String.Format("Kein Virtueller Renderer für Zone '{0}' für Zuordnung gefunden", _zone.udn));
        }