Пример #1
0
        void HandleBtnDockClicked(object sender, EventArgs e)
        {
            Gtk.Widget w;
            if (CurrentContainer.FrameNotebook.Visible == true)
            {
                w = CurrentContainer.removePage(this);                  //remove Page
                //Console.WriteLine(w.GetType().ToString());
            }
            else
            {
                w = PanedBox.removeItem(this);                 //remove Item
                //Console.WriteLine(w.GetType().ToString());
            }

            DockItemContainer container = (w as DockItemContainer);

            MainWindow.Instance.removeWidget(container.CurrentWidget as DockableWidget);

            DockItemContainer dc = w as DockItemContainer;

            Widget cw = dc.CurrentWidget;

            dc.removeCurrentWidget();
            cw.Parent = null;
            MainWindow.Instance.showAsPopupWindow(cw as DockableWidget);

            w.Destroy();
        }
Пример #2
0
        /// <summary>
        /// Processes any new blocks that have been pushed to <see cref="NewBlocks"/>.
        /// </summary>
        /// <param name="result">The last result of matching.</param>
        /// <param name="allowClosing">if set to <c>true</c> the processing of a new block will close existing opened blocks].</param>
        /// <exception cref="InvalidOperationException">The NewBlocks is not empty. This is happening if a LeafBlock is not the last to be pushed</exception>
        private void ProcessNewBlocks(BlockState result, bool allowClosing)
        {
            var newBlocks = NewBlocks;

            while (newBlocks.Count > 0)
            {
                var block = newBlocks.Pop();

                if (block.Parser == null)
                {
                    ThrowHelper.InvalidOperationException($"The new block [{block.GetType()}] must have a valid Parser property");
                }

                block.Line = LineIndex;

                // If we have a leaf block
                var leaf = block as LeafBlock;
                if (leaf != null)
                {
                    if (!result.IsDiscard())
                    {
                        leaf.AppendLine(ref Line, Column, LineIndex, CurrentLineStartPosition);
                    }

                    if (newBlocks.Count > 0)
                    {
                        ThrowHelper.InvalidOperationException(
                            "The NewBlocks is not empty. This is happening if a LeafBlock is not the last to be pushed");
                    }
                }

                if (allowClosing)
                {
                    // Close any previous blocks not opened
                    CloseAll(false);
                }

                // If previous block is a container, add the new block as a children of the previous block
                if (block.Parent == null)
                {
                    UpdateLastBlockAndContainer();
                    CurrentContainer.Add(block);
                }

                block.IsOpen = result.IsContinue();

                // Add a block BlockProcessor to the stack (and leave it opened)
                OpenedBlocks.Add(block);

                if (leaf != null)
                {
                    ContinueProcessingLine = false;
                    return;
                }
            }

            ContinueProcessingLine = !result.IsDiscard();
        }
        public static void OnExecuting()
        {
            SessionFactory = CurrentContainer.Resolve <ISessionFactory>();

            var session = SessionFactory.OpenSession();

            CurrentSessionContext.Bind(session);
            session.BeginTransaction();
        }
Пример #4
0
        /// <summary>
        /// Set selected value.
        /// </summary>
        /// <param name="value">The value instance.</param>
        public void SetSelected(XSelectable value)
        {
            if (value != null)
            {
                if (value is XLayer)
                {
                    var layer = value as XLayer;
                    var owner = layer?.Owner;
                    if (owner != null)
                    {
                        if (owner.CurrentLayer != layer)
                        {
                            owner.CurrentLayer = layer;
                        }
                    }
                }
                else if (value is XContainer && _documents != null)
                {
                    var container = value as XContainer;
                    var document  = _documents.FirstOrDefault(d => d.Pages.Contains(container));
                    if (document != null)
                    {
                        if (CurrentDocument != document)
                        {
                            CurrentDocument = document;
                        }

                        if (CurrentContainer != container)
                        {
                            CurrentContainer = container;
                            CurrentContainer.Invalidate();
                        }
                    }
                }
                else if (value is XDocument)
                {
                    var document = value as XDocument;
                    if (CurrentDocument != document)
                    {
                        CurrentDocument = document;
                        if (!CurrentDocument?.Pages.Contains(CurrentContainer) ?? false)
                        {
                            var container = CurrentDocument.Pages.FirstOrDefault();
                            if (CurrentContainer != container)
                            {
                                CurrentContainer = container;
                            }
                        }
                    }
                }
            }
        }
Пример #5
0
        protected override void OnListItemTap(DACPElement item, Common.Phone.Controls.LongListSelector list, bool isPlayButton)
        {
            if (item is Playlist)
            {
                NavigationManager.OpenPlaylistPage((Playlist)item);
                return;
            }

            if (item is DACPItem)
            {
                RemoteUtility.HandleLibraryPlayTask(CurrentContainer.PlayItem((DACPItem)item));
            }
        }
Пример #6
0
        void HandleBtnCloseClicked(object sender, EventArgs e)
        {
            Gtk.Widget w;
            if (CurrentContainer.FrameNotebook.Visible == true)
            {
                w = CurrentContainer.removePage(this);                  //remove Page
                //Console.WriteLine(w.GetType().ToString());
            }
            else
            {
                w = PanedBox.removeItem(this);                 //remove Item
                //Console.WriteLine(w.GetType().ToString());
            }

            DockItemContainer container = (w as DockItemContainer);

            MainWindow.Instance.removeWidget(container.CurrentWidget as DockableWidget);
            w.Destroy();
        }
Пример #7
0
        private void PlayQueueButton_Click(object sender, RoutedEventArgs e)
        {
            MenuItem menuItem = (MenuItem)sender;

            PlayQueueMode mode;

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

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

            default: return;
            }

            if (menuItem.DataContext is DACPItem)
            {
                RemoteUtility.HandleLibraryQueueTask(CurrentContainer.PlayItem((DACPItem)menuItem.DataContext, mode));
            }
        }
Пример #8
0
        protected void FormsAuthentication_OnAuthenticate(Object sender, FormsAuthenticationEventArgs e)
        {
            if (FormsAuthentication.CookiesSupported == true)
            {
                if (Request.Cookies[FormsAuthentication.FormsCookieName] != null)
                {
                    //let us take out the username now
                    var encryptedTicketCookie = Request.Cookies[FormsAuthentication.FormsCookieName].Value;
                    var username = FormsAuthentication.Decrypt(encryptedTicketCookie).Name;

                    ////let us extract the roles from our own custom cookie
                    var usersRepository = CurrentContainer.GetInstance <IUsersRepository>();
                    var user            = usersRepository.Get(username);

                    ////Let us set the Pricipal with our user specific details
                    var genericIdentity = new System.Security.Principal.GenericIdentity(user.Username, "Forms");
                    genericIdentity.AddClaim(new Claim(ClaimTypes.GivenName, user.GivenName));
                    genericIdentity.AddClaim(new Claim(ClaimTypes.Sid, user.Id.ToString()));
                    e.User = new ApplicationPrincipal(genericIdentity, user.Roles.ToArray());
                }
            }
        }
Пример #9
0
        private async void ArtistButton_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            e.Handled = true;

            if (CurrentGroup == null)
            {
                return;
            }

            // Set the artist button reference for the continuum transition
            _artistButton = sender as FrameworkElement;

            var artists = await CurrentContainer.GetArtistsAsync();

            if (artists != null)
            {
                var artist = artists.FirstOrDefault(a => a.Name == CurrentGroup.ArtistName);
                if (artist != null)
                {
                    NavigationManager.OpenArtistPage(artist);
                }
            }
        }
Пример #10
0
 internal void SetError()
 {
     CurrentContainer.SetAttribute(SqlStructureConstants.ANAME_HASERROR, "1");
     ErrorFound = true;
 }
Пример #11
0
 private void AppBarShuffleSongsButton_Click()
 {
     RemoteUtility.HandleLibraryPlayTask(CurrentContainer.ShuffleAllSongsAsync());
 }
Пример #12
0
        void HeaderButtonRelease(object ob, Gtk.ButtonReleaseEventArgs args)
        {
            //Console.WriteLine("HeaderButtonRelease");
            if (args.Event.Button == 1)
            {
                Frame.HidePlaceholder();

                if (header.Window != null)
                {
                    header.Window.Cursor = handCursor;
                }

                if (Frame.TargetContainer != null)
                {
                    //check if we are in notebook mode
//					if ((CurrentContainer != null) && (CurrentContainer.FrameNotebook.Visible == true))
//					{
//						//notebok mode
//						if ((frame.TargetContainer == CurrentContainer) && (frame.TargetAlign != ItemAlignment.Center))
//						{
//							//switch to paned mode
//							CurrentContainer.hideNotebook(frame.TargetAlign);
//						} else
//						{
//							CurrentContainer.removePage(this);
//						}
//
//
//
//					}  else
//					{
//						//panedbox mode
//
//						PanedBox.removeItem(this);
//
//
//					}

                    //check if we have to remove something
                    if ((CurrentContainer != null) && (Frame.TargetContainer != CurrentContainer))
                    {
                        if (CurrentContainer.FrameNotebook.Visible == true)
                        {
                            CurrentContainer.removePage(this);                                  //remove Page
                        }
                        else
                        {
                            PanedBox.removeItem(this);                             //remove Item
                        }
                    }

                    //Console.WriteLine("alg:" + frame.TargetAlign);
                    //add the new item
                    if (Frame.TargetContainer.FrameNotebook.Visible == true)
                    {
                        this.Reparent(null);
                        this.Parent = null;
                        //Console.WriteLine("add1 " + this.Name + " to "  + Frame.TargetContainer.Name);
                        frame.TargetContainer.addPage(this, Frame.TargetAlign);
                        this.Visible = true;
                    }
                    else
                    {
                        this.Reparent(null);
                        //Console.WriteLine("add2 " + this.Name + " to "  + Frame.TargetContainer.Name);
                        Frame.TargetContainer.addItem(this, Frame.TargetAlign);
                        this.Visible = true;
                    }
                }
            }
        }
Пример #13
0
 private void ShuffleButton_Tap(object sender, System.Windows.Input.GestureEventArgs e)
 {
     RemoteUtility.HandleLibraryPlayTask(CurrentContainer.Shuffle());
     e.Handled = true;
 }
Пример #14
0
        private void TestHostForAContainer()
        {
            var     id = inOrderProping.GetNextCandidate();
            Message m  = new CanHaveContainerRequest(id, 0, inOrderProping.InstanceId, CurrentContainer.GetContainerPredictedLoadInfo());

            CommunicationModule.SendMessage(m);
        }