コード例 #1
0
 /// <summary>
 /// Constructor to create the zone user control event argument.
 /// </summary>
 /// <param name="senderZoneUserControl">This pointer, to the source zone user control.</param>
 /// <param name="currentSelectedZone">Selected Zone, as zone enumeration.</param>
 /// <param name="prevZoneState">Previous zone state, before changing the selection.</param>
 public ZoneUserControlEventArgs(ZoneUserControl senderZoneUserControl, ENuvoEssentiaZones currentSelectedZone, ZoneState prevZoneState)
 {
     _senderZoneUserControl = senderZoneUserControl;
     _currentSelectedZone   = currentSelectedZone;
     _prevSelectedZone      = currentSelectedZone; // set previous selected zone
     _prevZoneState         = prevZoneState;
 }
コード例 #2
0
 /// <summary>
 /// Public constructor, setting the Zone id, Source id and volume level.
 /// </summary>
 /// <param name="zone">Zone id.</param>
 /// <param name="source">Source id.</param>
 /// <param name="volume">Volume Level.</param>
 public NuvoEssentiaCommand(ENuvoEssentiaZones zone, ENuvoEssentiaSources source, int volume)
 {
     initMembers();
     _zoneId   = zone;
     _sourceId = source;
     _volume   = limitVolume2NuvoEssentia(volume);
 }
コード例 #3
0
 /// <summary>
 /// Sets the Zone State for the corresponding index. One-Based, using the
 /// enumeration <see cref="ENuvoEssentiaZones"/>.!
 /// </summary>
 /// <param name="zoneId">Zone Id. One-Based!</param>
 /// <param name="newZoneState">New zone state.</param>
 public void setZoneState(ENuvoEssentiaZones zoneId, ZoneState newZoneState)
 {
     if (ENuvoEssentiaZones.NoZone != zoneId)
     {
         ZoneState oldState = new ZoneState(_zoneState[(int)zoneId - 1]);
         _zoneState[(int)zoneId - 1] = newZoneState;
         notifyZoneStateSubscribers(zoneId, oldState, newZoneState);
     }
 }
コード例 #4
0
        public void parseCommandForZoneTest()
        {
            string incomingCommand = "Z04PWRON,SRC2,GRP0,VOL-50";
            NuvoEssentiaSingleCommand_Accessor target = new NuvoEssentiaSingleCommand_Accessor(incomingCommand);
            ENuvoEssentiaZones actual = NuvoEssentiaSingleCommand_Accessor.parseCommandForZone(incomingCommand, target._incomingCommandTemplate);

            Assert.AreEqual(ENuvoEssentiaCommands.ReadStatusCONNECT, target._command);
            Assert.AreEqual(ENuvoEssentiaZones.Zone4, actual);
        }
コード例 #5
0
 /// <summary>
 /// Changes the selected zone.
 /// This raises the changed event, and sets the state of this user control,
 /// according to the selected zone.
 /// </summary>
 /// <param name="zone">Zone, which shall be selected</param>
 public void SetSelectedZone(ENuvoEssentiaZones zone)
 {
     if ((cmbZoneSelect != null) && (cmbZoneSelect.Items.Count > 0))
     {
         if (GetSelectedZone() != zone)
         {
             cmbZoneSelect.SelectedIndex = (int)zone - 1;
         }
     }
 }
コード例 #6
0
 /// <summary>
 /// Private method to notify the subscribers about changes in the zone state.
 /// </summary>
 /// <param name="zoneId">Zone Id, of the changed zone. One-Based enumeration.</param>
 /// <param name="oldZoneState">Old Zone State.</param>
 /// <param name="newZoneState">New Zone State.</param>
 private void notifyZoneStateSubscribers(ENuvoEssentiaZones zoneId, ZoneState oldZoneState, ZoneState newZoneState)
 {
     _log.Trace(m => m("Zone State with zoneId='{0}' has changed, notify the subscribers. oldState='{1}' newState='{2}'.", zoneId.ToString(), oldZoneState.ToString(), newZoneState.ToString()));
     if (onZoneUpdated != null)
     {
         if (oldZoneState != newZoneState)
         {
             onZoneUpdated(this, new ZoneStateEventArgs(zoneId, oldZoneState, newZoneState));
         }
     }
 }
コード例 #7
0
 /// <summary>
 /// Private method, which handles the event in case another zone has been
 /// selected in the zone combo box.
 /// </summary>
 /// <param name="sender">This pointer, to the combo box</param>
 /// <param name="e">Event argument, passed by the combo box</param>
 private void cmbZoneSelect_SelectedIndexChanged(object sender, EventArgs e)
 {
     if ((_selectedZone != GetSelectedZone()) &&
         (cmbZoneSelect.SelectedIndex < 12))
     {
         if (onZoneChanged != null)
         {
             onZoneChanged(this, new ZoneUserControlEventArgs(this, GetSelectedZone(), _selectedZone));
         }
         _selectedZone = GetSelectedZone();
     }
 }
コード例 #8
0
        /// <summary>
        /// Comperes the zon eids.
        /// </summary>
        /// <param name="zone1">First zone to compare the id.</param>
        /// <param name="zone2">Second zone to compare the id.</param>
        /// <returns>Returns true, if the zone ids are the same.</returns>
        public static bool compareZoneIds(ENuvoEssentiaZones zone1, ENuvoEssentiaZones zone2)
        {
            if ((zone1 != ENuvoEssentiaZones.NoZone) && (zone2 != ENuvoEssentiaZones.NoZone))
            {
                if (zone1 != zone2)
                {
                    // Zone ids are not the same
                    return(false);
                }
            }

            // Either the zone ids are the same, or ...
            // At least one zone is not defined, so we can't compare them
            // return in this case 'true'
            return(true);
        }
コード例 #9
0
 /// <summary>
 /// Constructor to create a zone event argument.
 /// </summary>
 /// <param name="ZoneId">Zone id of the zone. Enumeration!</param>
 /// <param name="prevZoneState">Previous Zone State</param>
 /// <param name="newZoneState">New Zone State</param>
 public ZoneStateEventArgs(ENuvoEssentiaZones ZoneId, ZoneState prevZoneState, ZoneState newZoneState)
 {
     _prevZoneState = prevZoneState;
     _newZoneState  = newZoneState;
     _zoneId        = ZoneId;
 }
コード例 #10
0
 /// <summary>
 /// Gets the Zone State for the corresponding index. One-Based, using the
 /// enumeration <see cref="ENuvoEssentiaZones"/>.!
 /// NOTE: Do not change the object received by this method, use the method
 /// <see cref="setZoneState"/> instead.
 /// </summary>
 /// <param name="zoneId">Zone Id. One-Based!</param>
 /// <returns>Zone State.</returns>
 public ZoneState this[ENuvoEssentiaZones zoneId]
 {
     get { return(_zoneState[(int)zoneId - 1]); }
 }
コード例 #11
0
 /// <summary>
 /// Constructor to create the zone user control event argument.
 /// </summary>
 /// <param name="senderZoneUserControl">This pointer, to the source zone user control.</param>
 /// <param name="currentSelectedZone">Selected Zone, as zone enumeration.</param>
 /// <param name="prevSelectedZone">Previous selected zone, as zone enumeration.</param>
 public ZoneUserControlEventArgs(ZoneUserControl senderZoneUserControl, ENuvoEssentiaZones currentSelectedZone, ENuvoEssentiaZones prevSelectedZone)
 {
     _senderZoneUserControl = senderZoneUserControl;
     _currentSelectedZone   = currentSelectedZone;
     _prevSelectedZone      = prevSelectedZone;
 }
コード例 #12
0
 /// <summary>
 /// Public constructor, setting the Command and Zone id.
 /// </summary>
 /// <param name="command">Nuvo Essentia Command.</param>
 /// <param name="zone">Zone Id.</param>
 public NuvoEssentiaCommand(ENuvoEssentiaCommands command, ENuvoEssentiaZones zone)
 {
     initMembers();
     _zoneId = zone;
     addCommand(command);
 }
コード例 #13
0
 /// <summary>
 /// Public constructor, setting the Zone and Source id.
 /// </summary>
 /// <param name="zone">Zone id.</param>
 /// <param name="source">Source id.</param>
 public NuvoEssentiaCommand(ENuvoEssentiaZones zone, ENuvoEssentiaSources source)
 {
     initMembers();
     _zoneId   = zone;
     _sourceId = source;
 }
コード例 #14
0
 /// <summary>
 /// Public constructor, setting the Zone id.
 /// </summary>
 /// <param name="zone">Zone id.</param>
 public NuvoEssentiaCommand(ENuvoEssentiaZones zone)
 {
     initMembers();
     _zoneId = zone;
 }