Exemplo n.º 1
0
        async private void displayOculusView(OculusView oculusViewForm, int i)
        {
            if (restart)
            {
                restart = false;
                displayOculusView(oculusViewForm, 0);
                return;
            }

            oculusViewForm.streamTexture = buffStream[i];
            //oculusViewForm.bitMap = oculusViewForm.LoadBitmap(imagingFactory, buffStream[i]);
            oculusViewForm.newTextureArrived = true;

            Title = "Oculus View, jump number " + (i+1) + ". Press H for help! Options: pause=" + pause + ", loop=" + loopWhole + ", playing forward=" + playForward;

            GC.Collect();
            if (zoom == 2)
                await Task.Delay(70);
            else if (zoom == 3)
                await Task.Delay(140);

            if (moveForwards)
            {
                moveForwards = false;
                if (i < listPanoIds.Count - 1)
                {
                    displayOculusView(oculusViewForm, ++i);
                    return;
                }
            }
            if (moveBackwards)
            {
                moveBackwards = false;
                if (i > 0)
                {
                    displayOculusView(oculusViewForm, --i);
                    return;
                }
            }

            while (pause)
            {
                if (moveForwards)
                {
                    moveForwards = false;
                    if (i < listPanoIds.Count - 1)
                    {
                        displayOculusView(oculusViewForm, ++i);
                        return;
                    }
                }
                if (moveBackwards)
                {
                    moveBackwards = false;
                    if (i > 0)
                    {
                        displayOculusView(oculusViewForm, --i);
                        return;
                    }
                }
                await Task.Delay(45);
            }

            if (loopWhole)
            {
                if (!playForward)
                {
                    if (i > 0)
                    {
                        displayOculusView(oculusViewForm, --i);
                        return;
                    }
                    else if (i <= 0)
                    {
                        playForward = true;
                        displayOculusView(oculusViewForm, ++i);
                        return;
                    }
                }
                else if (playForward)
                {
                    if (i < listPanoIds.Count - 1)
                    {
                        displayOculusView(oculusViewForm, ++i);
                        return;
                    }
                    else if (i >= listPanoIds.Count - 1)
                    {
                        playForward = false;
                        displayOculusView(oculusViewForm, --i);
                        return;
                    }
                }
            }
            if (!loopWhole)
            {
                if (!playForward)
                {
                    if (i > 0)
                    {
                        displayOculusView(oculusViewForm, --i);
                        return;
                    }
                }
                else if (playForward)
                {
                    if (i < listPanoIds.Count - 1)
                    {
                        displayOculusView(oculusViewForm, ++i);
                        return;
                    }
                }
            }
        }
Exemplo n.º 2
0
        //unsuccesful attempt at paralelization
        /*async Task addToMainPanel(StackPanel mainPanel, int i, int j)
        {
            StackPanel ph = new StackPanel();
            ph.Orientation = Orientation.Horizontal;
            for (int k = 0; k < limitX; k++)
            {
                Image stackImg = new Image();
                stackImg.Source = FromStream(buffStream[i][j][k]);
                ph.Children.Add(stackImg);
            }
            mainPanel.Children.Insert(j, ph);
        }*/

        async private void oculusViewMode()
        {
            ResizeMode = ResizeMode.CanResize;
            WindowStyle = WindowStyle.SingleBorderWindow;
            WindowState = WindowState.Normal;


            OculusView oculusViewForm = new OculusView(zoom, this);

            while (oculusViewForm.oculusReady == false)
            {
                await Task.Delay(100);
            }

            await Task.Delay(1000);
            displayOculusView(oculusViewForm, 0);

            while (true)
            {
                await Task.Delay(100);
                if (restart)
                {
                    restart = false;
                    displayOculusView(oculusViewForm, 0);
                }
            }
        }