// Page Open Transition:
        // http://amadeusw.com/xaml/animated-navigation-universal-app

        /// <summary>
        /// Opens a page as an overlay. It must be closed to return to the page that opened it.
        /// </summary>
        public async Task <object> OpenModal(string page_caption, SmartPage page2open)
        {
            ShellData shell_data = Navigator.ShellData;

            if (shell_data.ManagesSmartPage(this) == false)
            {
                throw new InvalidOperationException("This Page object is not managed by the Ventura Navigator.");
            }

            // Since the page is managed, we are 100% sure the FrameData and TabData will also be found.

            TabData tabdata = shell_data.FindTabData(this);

            if (tabdata.TopMost() != this)
            {
                throw new InvalidOperationException("Only call OpenModal for the topmost Page object.");
            }

            Navigator.CloseAllSatelliteTabs(tabdata.UniqueID);

            page2open.IsModal     = true;
            page2open.PageCaption = page_caption;
            page2open.CloseAction = CloseActionKind.ReleaseTCS;
            page2open.TCS         = new TaskCompletionSource <object>();

            // PushPage MUST come before the await.
            tabdata.PushPage(page2open);

            object result = await page2open.TCS.Task;

            return(result);

            //await Task.CompletedTask; // Dummy task
        }
 // Use Before Start
 private void Awake()
 {
     // shelbody is shells rigidbody component
     // shelldata is shells sheldata component
     shellBody = shell.gameObject.GetComponent <Rigidbody>();
     shellData = shell.gameObject.GetComponent <ShellData>();
 }
Example #3
0
    private void Start()
    {
        // The fire axis is based on the player number.
        m_FireButton = "Fire";

        // The rate that the launch force charges up is the range of possible forces by the max charge time.
        m_ChargeSpeed       = (m_MaxLaunchForce - m_MinLaunchForce) / m_MaxChargeTime;
        shellData           = new ShellData();
        shellData.position  = new Position();
        shellData.direction = new Position();
    }
        public ShellFrame()
        {
            SetValue(MenuBarProperty, Repository.MenuBarItems);

            _instance = this;

            _splitscreen = false;

            _shell_data = Navigator.ShellData;

            this.InitializeComponent();

            // The Main Window gets a custom title bar.
            InitializeCustomTitlebar();

            tabbed_frame0.DataContext = _shell_data.Frames[0];
            tabbed_frame1.DataContext = _shell_data.Frames[1];

            // Save column definitions
            _column_definitions = grid_with_a_split.ColumnDefinitions.ToArray();

            // Clear the column definitions
            grid_with_a_split.ColumnDefinitions.Clear();

            _fullScreen = new FullScreenHelper();

            NavigationBarControl.DisplayMenuPanel += NavigationBar_DisplayMenuPanel;
            NavigationBarControl.HideMenuPanel    += NavigationBar_HideMenuPanel;

            WorkSpaceGrid.AddHandler(UIElement.TappedEvent, new TappedEventHandler(WorkSpaceGrid_Tapped), true);
            WorkSpaceGrid.SizeChanged += WorkSpaceGrid_SizeChanged;

            _shell_data.PropertyChanged += ShellData_PropertyChanged;

            this.Loaded += ShellFrame_Loaded;
        }
 static Navigator()
 {
     _colors     = new DistinctColors();
     _shell_data = new ShellData();
 }
        /// <summary>
        /// Close the Modal page or close the Tab.
        /// </summary>
        public void ClosePage(object retvar = null)
        {
            ShellData shell_data = Navigator.ShellData;

            if (shell_data.ManagesSmartPage(this) == false)
            {
                throw new InvalidOperationException("This Page object is not managed by the Ventura Navigator.");
            }

            // Find the tab that holds the page in its modalstack.
            TabData tabdata = shell_data.FindTabData(this);

            if (tabdata.TopMost() != this)
            {
                throw new InvalidOperationException("Only call CloseModal for the topmost Page object.");
            }

            Navigator.CloseAllSatelliteTabs(tabdata.UniqueID);

            tabdata.PopPage();

            // The topmost will be null if no pages left on the stack.
            var topmost = tabdata.TopMost();

            if (this.CloseAction == CloseActionKind.CloseTab)
            {
                Navigator.InternalCloseTab(tabdata);
            }
            else if (this.CloseAction == CloseActionKind.ReleaseTCS)
            {
                this.TCS.SetResult(retvar);
            }
            else if (this.CloseAction == CloseActionKind.CloseTab_With_SatelliteClosedEventOnMasterTab)
            {
                Navigator.InternalCloseTab(tabdata);

                TabData tabdata_master = shell_data.FindTabData(tabdata.MasterTabID);

                if (tabdata_master != null)
                {
                    FrameData framedata_master = shell_data.FindFrameData(tabdata_master);

                    // Make the frame containing the master page (for the satellite page) active.
                    shell_data.ActiveFrameIndex = framedata_master.Index;

                    // Make the master page the selected tab.
                    framedata_master.SelectedTab = tabdata_master;

                    SmartPage topmost_master = tabdata_master.TopMost();

                    if (topmost_master != null)
                    {
                        topmost_master.SatellitePageClosed(this.InstanceID, retvar);
                    }
                }
            }
            else if (this.CloseAction == CloseActionKind.CloseModal_SatelliteClosedEventOnParentPage)
            {
                topmost.SatellitePageClosed(this.InstanceID, retvar);
                //await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => topmost.SatellitePageClosed(this.InstanceID, retvar));
            }
        }