예제 #1
0
    /// <summary> Push a new scene onto the stack. </summary>
    public static void Push(PrimeScene scene, bool hideSceneBelow = true)
    {
        if (scene == null)
        {
            return;
        }

        scene.IsHidingSceneBelow = hideSceneBelow;
        SuspendTopScene(hideSceneBelow);
        Stack.Add(scene);

        if (scene.AttachToViewport)
        {
            CanvasLayer canvasLayer = new CanvasLayer();
            canvasLayer.Name = $"{scene.Name}";
            canvasLayer.AddChild(scene);
            StackRoot.AddChild(canvasLayer);
        }
        else
        {
            StackRoot.AddChild(scene);
        }

        Tree.SetInputAsHandled();
        scene.OnPushed();
        scene.OnCurrent();
    }
    private static void HandleQuestionDownloadCompleted(object sender, DownloadStringCompletedEventArgs e)
    {
        if (e.Error == null || !e.Cancelled)
        {
            StackRoot responseRoot = JsonConvert.DeserializeObject <StackRoot>(e.Result);

            // Adding to List<T> is not thread safe.
            lock (criticalSection)
            {
                AllQuestionRoot.Add(responseRoot);
            }
            // Signal completed.
            countdown.Signal();
        }
    }