예제 #1
0
        private void PlayQueueButton_Click(object sender, RoutedEventArgs e)
        {
            MenuItem    menuItem = (MenuItem)sender;
            DACPElement item     = menuItem.DataContext as DACPElement;

            if (item == null)
            {
                return;
            }

            PlayQueueMode mode;

            switch (menuItem.Name)
            {
            case "PlayNextButton": mode = PlayQueueMode.PlayNext; break;

            case "AddToUpNextButton": mode = PlayQueueMode.AddToQueue; break;

            default: return;
            }

            if (item is Album)
            {
                RemoteUtility.HandleLibraryQueueTask(((Album)item).Play(mode));
                return;
            }

            if (item is Song)
            {
                RemoteUtility.HandleLibraryQueueTask(CurrentGroup.PlaySong((Song)item, mode));
                return;
            }
        }
예제 #2
0
        /// <summary>
        /// Adds a unit to the undo manager without executing it
        /// </summary>
        /// <param name="unit">The UndoUnit to add</param>
        void Add(UndoUnit <T> unit)
        {
            if (IsBlocked)
            {
                throw new InvalidOperationException("Attempt to add undo operation while blocked");
            }

            if (CurrentGroup != null)
            {
                CurrentGroup.Add(unit);
            }
            else
            {
                RemoveAllRedoUnits();
                _units.Add(unit);

                // Limit undo stack size
                if (_units.Count > _maxUnits)
                {
                    // Update unmodified index
                    if (_unmodifiedPos >= 0)
                    {
                        _unmodifiedPos--;
                    }

                    // Remove
                    _units.RemoveAt(0);
                }
                else
                {
                    _currentPos++;
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Changes the current channel after a specified delay.
        /// </summary>
        /// <param name="channelIdx">The (1 based) index within the group of the channel to change to.</param>
        /// <param name="useZapDelay">If true, the configured zap delay is used. Otherwise it zaps immediately.</param>
        public void ZapToChannelIndex(int channelIdx, bool useZapDelay)
        {
            IList <GroupMap> channels = CurrentGroup.ReferringGroupMap();

            if (channelIdx < 1 || channelIdx > channels.Count)
            {
                Log.Debug("ZapToChannelIndex, channelIdx out-of-range:{0}", channelIdx);
                return;
            }
            //Check channelIdx against visible channels in guide
            GroupMap gm;
            Channel  chan;
            int      guideIdx = 0;

            for (int i = 0; i < channels.Count; i++)
            {
                gm   = (GroupMap)channels[i];
                chan = (Channel)gm.ReferencedChannel();
                if (chan.VisibleInGuide)
                {
                    guideIdx++;
                }
                if (guideIdx == channelIdx)
                {
                    ZapToChannel(chan, useZapDelay);
                    return;
                }
            }
        }
예제 #4
0
        object ReadValueContents(Type knownType)
        {
            Type type;
            var  typeAttrib = CurrentGroup.Attribute("type");

            if (typeAttrib == null)
            {
                type = knownType;
            }
            else if (typeAttrib.Value == "null")
            {
                return(null);
            }
            else
            {
                type = SerializerRegistry.ParseSerializedType(typeAttrib.Value);
            }

            var serializer = SerializerRegistry.GetSerializer(type);

            object value;

            serializer.DeserializeConstructor(out value, _version, this);
            serializer.DeserializeContents(ref value, _version, this);
            serializer.DeserializeBacklinks(ref value, _version, this);
            return(value);
        }
예제 #5
0
        public override void RunOnClock()
        {
            if (GroupQueue.Count != 0 || CurrentGroup != null)
            {
                //  If CurrentGroup is 0, then we need to get a group.
                if (CurrentGroup == null)
                {
                    DequeueGroup();
                }
                //  If 'PeopleAllowedToMove' has reached member count. Then allow them to continue.
                if (1 <= PeopleAllowedToMove)
                {
                    CurrentGroup.RemoveAgents(1);
                    CurrentGroup.CurrentNode.RemoveAgents(1);
                    PeopleAllowedToMove--;
                }
                //  If not. Then we need to count it up with the flow rate of the door.
                PeopleAllowedToMove += GetFlowRate();

                if (CurrentGroup.MemberCount == 0)
                {
                    DequeueGroup();
                }
            }
            else
            {
                PeopleAllowedToMove = 0;
            }
        }
 /// <summary>
 /// Prints the property status in the trace log.
 /// </summary>
 /// <remarks>For debugging purposes only.</remarks>
 private void PrintStatus()
 {
     DebugTrace("CurrentIndex=" + CurrentIndex.ToString());
     DebugTrace("PageSize=" + PageSize.ToString());
     DebugTrace("RecordCount=" + RecordCount.ToString());
     DebugTrace("CurrentGroup=" + CurrentGroup.ToString());
 }
예제 #7
0
        /// <summary>
        /// Checks the settings.
        /// </summary>
        /// <returns></returns>
        private bool CheckSettings()
        {
            _rockContext = _rockContext ?? new RockContext();

            if (CurrentGroup == null)
            {
                NavigateToHomePage();
                return(false);
            }

            //Authorization check. Nothing is visible otherwise
            if (!CurrentGroup.IsAuthorized(Authorization.EDIT, CurrentPerson))
            {
                return(false);
            }

            _defaultGroupRole = CurrentGroup.GroupType.DefaultGroupRole;

            _dvcConnectionStatus = DefinedValueCache.Get(GetAttributeValue("ConnectionStatus").AsGuid());
            if (_dvcConnectionStatus == null)
            {
                return(false);
            }

            _dvcRecordStatus = DefinedValueCache.Get(GetAttributeValue("RecordStatus").AsGuid());
            if (_dvcRecordStatus == null)
            {
                return(false);
            }

            return(true);
        }
예제 #8
0
        /// <summary>
        /// Changes the current channel (based on channel number) after a specified delay.
        /// </summary>
        /// <param name="channelNr">The nr of the channel to change to.</param>
        /// <param name="useZapDelay">If true, the configured zap delay is used. Otherwise it zaps immediately.</param>
        public void ZapToChannelNumber(int channelNr, bool useZapDelay)
        {
            IList <GroupMap> channels = CurrentGroup.ReferringGroupMap();

            if (channelNr >= 0)
            {
                Log.Debug("channels.Count {0}", channels.Count);

                bool    found    = false;
                int     iCounter = 0;
                Channel chan;
                while (iCounter < channels.Count && found == false)
                {
                    chan = ((GroupMap)channels[iCounter]).ReferencedChannel();

                    Log.Debug("chan {0}", chan.DisplayName);
                    if (chan.VisibleInGuide)
                    {
                        if (chan.ChannelNumber == channelNr)
                        {
                            Log.Debug("find channel: iCounter {0}, chan.ChannelNumber {1}, chan.DisplayName {2}, channels.Count {3}",
                                      iCounter, chan.ChannelNumber, chan.DisplayName, channels.Count);
                            found = true;
                            ZapToChannel(iCounter + 1, useZapDelay);
                        }
                    }
                    iCounter++;
                }
                if (found)
                {
                    m_zapChannelNr = channelNr;
                }
            }
        }
예제 #9
0
        protected void btnSMSSend_Click(object sender, EventArgs e)
        {
            bool   sendToParents = cbEmailSendToParents.Checked;
            string subject       = tbSubject.Text;
            string body          = tbBody.Text;

            if (Page.IsValid)
            {
                _rockContext = new RockContext();
                var communication = UpdateCommunication(_rockContext);

                if (communication != null)
                {
                    AddRecepients(communication, cbSMSSendToParents.Checked);

                    communication.SMSMessage            = tbMessage.Text;
                    communication.SMSFromDefinedValueId = DefinedValueCache.Get(CurrentGroup.GetAttributeValue("TextMessageFrom").AsGuid()).Id;

                    communication.Status                = CommunicationStatus.Approved;
                    communication.ReviewedDateTime      = RockDateTime.Now;
                    communication.ReviewerPersonAliasId = CurrentPersonAliasId;

                    _rockContext.SaveChanges();
                    var transaction = new Rock.Transactions.SendCommunicationTransaction();
                    transaction.CommunicationId = communication.Id;
                    transaction.PersonAlias     = CurrentPersonAlias;
                    Rock.Transactions.RockQueue.TransactionQueue.Enqueue(transaction);
                }
            }
            cbSMSSendToParents.Checked = false;
            pnlEmail.Visible           = false;
            pnlSMS.Visible             = false;
            pnlMain.Visible            = true;
            maSent.Show("Your message will be been sent shortly.", ModalAlertType.Information);
        }
예제 #10
0
 protected override void OnListItemTap(DACPElement item, Common.Phone.Controls.LongListSelector list, bool isPlayButton)
 {
     if (item is Song)
     {
         RemoteUtility.HandleLibraryPlayTask(CurrentGroup.PlaySong((Song)item));
         return;
     }
 }
예제 #11
0
        public void AddRawFileJobsToCurrentGroup(string file)
        {
            ProcessItem item = new IdNamePairProcessItem()
            {
                Name = file
            };

            CurrentGroup.Add(item);
        }
예제 #12
0
        public IEnumerable <object> ReadSet(Type knownType, string itemName, bool allowCircularDependencies)
        {
            foreach (var element in CurrentGroup.Elements(itemName))
            {
                _groups.Push(element);
                yield return(ReadContents(knownType, allowCircularDependencies));

                _groups.Pop();
            }
        }
예제 #13
0
        private void ShuffleButton_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            if (CurrentGroup == null)
            {
                return;
            }

            RemoteUtility.HandleLibraryPlayTask(CurrentGroup.Shuffle());
            e.Handled = true;
        }
예제 #14
0
        private void showRosterEmail(int?id)
        {
            hfCommunication.Value = id.ToString();
            CurrentGroup.LoadAttributes();
            cbEmailSendToParents.Visible = CurrentGroup.GetAttributeValue("AllowEmailParents").AsBoolean();
            pnlMain.Visible  = false;
            pnlEmail.Visible = true;

            DisplayEmailRecipients();
        }
예제 #15
0
        public void RemoveItemFromCurrentGroup(ProcessItem item)
        {
            string name  = item.Name;
            var    child = CurrentGroup.FirstOrDefault(i => i.Name == name);

            if (child != null && child.Name == name)
            {
                CurrentGroup.Remove(child);
            }
        }
예제 #16
0
        /// <summary>
        /// Changes to the previous channel in the current group.
        /// </summary>
        /// <param name="useZapDelay">If true, the configured zap delay is used. Otherwise it zaps immediately.</param>
        public void ZapToPreviousChannel(bool useZapDelay)
        {
            Channel currentChan = null;
            int     currindex;

            if (m_zapchannel == null)
            {
                currentChan = Channel;
                currindex   = GetChannelIndex(Channel);
            }
            else
            {
                currentChan = m_zapchannel;
                currindex   = GetChannelIndex(m_zapchannel); // Zap from last zap channel
            }
            GroupMap gm;
            Channel  chan;

            //check if channel is visible
            //if not find next visible
            do
            {
                // Step to prev channel
                currindex--;
                if (currindex < 0)
                {
                    currindex = CurrentGroup.ReferringGroupMap().Count - 1;
                }
                gm   = (GroupMap)CurrentGroup.ReferringGroupMap()[currindex];
                chan = (Channel)gm.ReferencedChannel();
            } while (!chan.VisibleInGuide);

            TVHome.UserChannelChanged = true;
            m_zapchannel = chan;
            m_zapchannel.CurrentGroup = null;
            m_zapChannelNr            = -1;
            Log.Info("Navigator:ZapPrevious {0}->{1}",
                     currentChan.DisplayName, m_zapchannel.DisplayName);
            if (GUIWindowManager.ActiveWindow == (int)(int)GUIWindow.Window.WINDOW_TVFULLSCREEN)
            {
                if (useZapDelay)
                {
                    m_zaptime = DateTime.Now.AddMilliseconds(m_zapdelay);
                }
                else
                {
                    m_zaptime = DateTime.Now;
                }
            }
            else
            {
                m_zaptime = DateTime.Now;
            }
            RaiseOnZapChannelEvent();
        }
예제 #17
0
        /// <summary>
        /// Changes to the next channel in the current group.
        /// </summary>
        /// <param name="useZapDelay">If true, the configured zap delay is used. Otherwise it zaps immediately.</param>
        public void ZapToNextChannel(bool useZapDelay)
        {
            Channel currentChan = null;
            int     currindex;

            if (m_zapchannel == null)
            {
                currindex   = GetChannelIndex(Channel);
                currentChan = Channel;
            }
            else
            {
                currindex   = GetChannelIndex(m_zapchannel); // Zap from last zap channel
                currentChan = Channel;
            }
            GroupMap gm;
            Channel  chan;

            //check if channel is visible
            //if not find next visible
            do
            {
                // Step to next channel
                currindex++;
                if (currindex >= CurrentGroup.ReferringGroupMap().Count)
                {
                    currindex = 0;
                }
                gm   = (GroupMap)CurrentGroup.ReferringGroupMap()[currindex];
                chan = (Channel)gm.ReferencedChannel();
            } while (!chan.VisibleInGuide);

            TVHome.UserChannelChanged = true;
            ZapChannel = chan;
            m_zapchannel.CurrentGroup = null;
            Log.Info("Navigator:ZapNext {0}:{1}->{2}:{3},index:{4}",
                     currentChan.DisplayName, currentChan.ChannelNumber, m_zapchannel.DisplayName, m_zapchannel.ChannelNumber, currindex);
            if (GUIWindowManager.ActiveWindow == (int)(int)GUIWindow.Window.WINDOW_TVFULLSCREEN)
            {
                if (useZapDelay)
                {
                    m_zaptime = DateTime.Now.AddMilliseconds(m_zapShortDelay);
                }
                else
                {
                    m_zaptime = DateTime.Now;
                }
            }
            else
            {
                m_zaptime = DateTime.Now;
            }
            RaiseOnZapChannelEvent();
        }
    protected void btnAddGroup_Click(object sender, ImageClickEventArgs e)
    {
        MacroDesignerGroup root = GetRootGroup();

        root.StoreData();

        MacroDesignerTree item = CurrentGroup.AddGroup();

        AddGroup(item.IDPath);

        root.BuildDesigner(true);
    }
예제 #19
0
        protected void btnEmail_Click(object sender, EventArgs e)
        {
            tbBody.Text    = "";
            tbSubject.Text = "";

            CurrentGroup.LoadAttributes();
            cbEmailSendToParents.Visible = CurrentGroup.GetAttributeValue("AllowEmailParents").AsBoolean();
            pnlMain.Visible  = false;
            pnlEmail.Visible = true;

            DisplayEmailRecipients();
        }
예제 #20
0
        protected void btnSMS_Click(object sender, EventArgs e)
        {
            tbMessage.Text = "";

            CurrentGroup.LoadAttributes();
            cbSMSSendToParents.Visible = CurrentGroup.GetAttributeValue("AllowEmailParents").AsBoolean();
            pnlMain.Visible            = false;
            pnlSMS.Visible             = true;

            DisplaySMSRecipients();

            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "smsCharCount", smsScript, true);
        }
예제 #21
0
        public object Read(Type knownType, string name, bool allowCircularDependencies)
        {
            Assert.IsNotNull(name);

            var groupElem = CurrentGroup.GetElement(name);

            _groups.Push(groupElem);
            var result = ReadContents(knownType, allowCircularDependencies);

            _groups.Pop();

            return(result);
        }
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Init" /> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            RegisterScript();

            _rockContext = new RockContext();

            if (CurrentGroup != null && CurrentGroup.IsAuthorized(Authorization.EDIT, CurrentPerson))
            {
                _canEdit = true;
            }
        }
예제 #23
0
        protected override void InitializeApplicationBar()
        {
            base.InitializeApplicationBar();

            AddApplicationBarMenuItem(LocalizedStrings.BrowseArtistPlayAllSongs, () =>
            {
                if (CurrentGroup == null)
                {
                    return;
                }

                RemoteUtility.HandleLibraryPlayTask(CurrentGroup.Play());
            });
        }
예제 #24
0
        /// <summary>
        /// Changes the current channel after a specified delay.
        /// </summary>
        /// <param name="channelNr">The nr of the channel to change to.</param>
        /// <param name="useZapDelay">If true, the configured zap delay is used. Otherwise it zaps immediately.</param>
        public void ZapToChannel(int channelNr, bool useZapDelay)
        {
            IList <GroupMap> channels = CurrentGroup.ReferringGroupMap();

            m_zapChannelNr = channelNr;
            channelNr--;
            if (channelNr >= 0 && channelNr < channels.Count)
            {
                GroupMap gm   = (GroupMap)channels[channelNr];
                Channel  chan = gm.ReferencedChannel();
                TVHome.UserChannelChanged = true;
                ZapToChannel(chan, useZapDelay);
            }
        }
 internal void UpdateCurrentGroup(string name, string desc)
 {
     CurrentGroup.name        = name;
     CurrentGroup.Description = desc;
     CurrentGroup.HasChnaged();
     dbContext.SaveChanges();
     MessageBox.Show("Group" + CurrentGroup.name + " Was Created");
     //var x = AllGroups.Find( g =>g.Id.Equals(CurrentGroup.Id));
     //if (x != null)
     //{
     //    x = CurrentGroup;
     //}
     OnPropertyChanged("AllGroups");
 }
예제 #26
0
        /// <summary>
        /// Retrieves the index of the current channel.
        /// </summary>
        /// <returns></returns>
        private int GetChannelIndex(Channel ch)
        {
            IList <GroupMap> groupMaps = CurrentGroup.ReferringGroupMap();

            for (int i = 0; i < groupMaps.Count; i++)
            {
                GroupMap gm   = (GroupMap)groupMaps[i];
                Channel  chan = (Channel)gm.ReferencedChannel();
                if (chan.IdChannel == ch.IdChannel)
                {
                    return(i);
                }
            }
            return(0); // Not found, return first channel index
        }
예제 #27
0
        public void AddOrEditWatcherEntry(DateTime timestamp, WatcherChangeTypes changeType, string path)
        {
            long id = ComputeGroupId(timestamp);

            if (CurrentGroup == null || id != CurrentGroup.Id)
            {
                CurrentGroup = new WatcherEntryGroup(id, timestamp);
                if (!this.GroupDict.ContainsKey(id))
                {
                    GroupDict.Add(id, CurrentGroup);
                }
            }

            CurrentGroup.AddOrEditWatcherEntry(changeType, path);
        }
예제 #28
0
        /// <summary> Drills down recursively until a segment is reached.</summary>
        private void FindLeaf()
        {
            if (currentChild == -1)
            {
                currentChild = 0;
            }

            var c = CurrentGroup.GetClass(childNames[currentChild]);

            if (typeof(IGroup).IsAssignableFrom(c))
            {
                DrillDown(currentChild, 0);
                FindLeaf();
            }
        }
예제 #29
0
        object ReadReferenceContents(Type knownType, bool allowCircularDependencies)
        {
            long id = (long)CurrentGroup.Attribute("ref");

            if (id == 0)
            {
                return(null);
            }

            var info = _rootReferences[id];

            DeserializeConstructor(info);
            DeserializeContents(info, allowCircularDependencies);

            return(info.Value);
        }
예제 #30
0
        /// <summary> Returns the given rep of the structure at the current location.
        /// If at root, always returns the root (the rep is ignored).
        /// </summary>
        public virtual IStructure GetCurrentStructure(int rep)
        {
            IStructure ret = null;

            if (currentChild != -1)
            {
                var childName = childNames[currentChild];
                ret = CurrentGroup.GetStructure(childName, rep);
            }
            else
            {
                ret = CurrentGroup;
            }

            return(ret);
        }