예제 #1
0
        public void Add(AppStates state, DateTime?date = null)
        {
            this.LogInfo($"{DateTime.Now}, {state}");
            var key = date.HasValue ? date.Value : DateTime.Now;

            History = History.Add(key, state);
        }
        /////////////////////////////////////
        // Background thread stuff: /////////
        ////////////////////////////////////



        /// <summary>
        /// The possible states of the app are:
        ///
        /// Processing -- in the process of importing data from VESTA reports,
        ///     or creating label or list documents using the imported data.
        ///
        /// Viewing -- The startup state. Present a list of label and list files
        ///     to the user, along with buttons to perform various operations.
        ///
        /// Showing Work -- Exhibiting the results of the Processing stage.
        ///
        /// </summary>
        /// <param name="newState"></param>

        private void SetAppState(AppStates newState)
        {
            CurrentState = newState;
            switch (CurrentState)
            {
            case AppStates.Processing:
                this.Hide();
                break;

            case AppStates.Viewing:
                this.Show();
                if (this.Context.IsEmpty)
                {
                    ShowNothingImportedMessage();
                }
                else if (this.FileListManager.IsEmpty)
                {
                    ShowNoFilesMessage();
                }
                break;

            case AppStates.ShowingWork:
                ProgressForm.Done = true;
                break;
            }
        }
        //protected SimpleDialog finishScanningdialog;

        void Start()
        {
            State = AppStates.Loading;
            StartCoroutine(DisplayLoadingMessage());
            //StartCoroutine(DisplayScanningMessage());
            TextureMappingManager.Instance.SpatialMappingCreated += SpatialMappingCreated;
            UnityEngine.XR.WSA.Input.InteractionManager.OnTapped += TappedCallBack;
        }
 protected void SpatialMappingCreated()
 {
     if (State == AppStates.Loading)
     {
         State = AppStates.Scanning;
         Debug.Log("Start Scanning");
         StartCoroutine(DisplayScanningMessage());
     }
 }
예제 #5
0
        public InfoTabViewItem(AppStates appStates)
        {
            switch (appStates)
            {
            case AppStates.Awaiting:
                Message  = "Заполните данные и проверьте соединение!";
                Image    = "/Images/info.png";
                AppState = AppStates.Awaiting;
                break;

            case AppStates.Connected:
                Message  = "Соединение прошло успешно, выберите операцию!";
                Image    = "/Images/ok.png";
                AppState = AppStates.Connected;
                break;

            case AppStates.ConnectionError:
                Message  = "Соединение прошло неудачно, ошибка скопирована в буфер обмена!";
                Image    = "/Images/error.png";
                AppState = AppStates.ConnectionError;
                break;

            case AppStates.SuccessfullyBackuped:
                Message  = "Резервное копирование завершено успешно!";
                Image    = "/Images/good.png";
                AppState = AppStates.SuccessfullyBackuped;
                break;

            case AppStates.SuccessfullyRestored:
                Message  = "Восстановление из копии выполнено успешно!";
                Image    = "/Images/good.png";
                AppState = AppStates.SuccessfullyRestored;
                break;

            case AppStates.BackupError:
                Message  = "Копирование прошло неудачно, ошибка скопирована в буфер обмена!";
                Image    = "/Images/error.png";
                AppState = AppStates.BackupError;
                break;

            case AppStates.RestoreError:
                Message  = "Восстановление прошло неудачно, ошибка скопирована в буфер обмена!";
                Image    = "/Images/error.png";
                AppState = AppStates.RestoreError;
                break;

            case AppStates.IsBusy:
                Message           = "Пожалуйста, ждите...";
                IsProgressVisible = true;
                IsUIActive        = false;
                AppState          = AppStates.IsBusy;
                break;
            }
        }
예제 #6
0
        /*************************************************************
        *************************************************************/
        private void HandleDetecting(AppStims theAppStims)
        {
            switch (theAppStims)
            {
            case AppStims.KEYS_LOADED:
                break;

            case AppStims.DRIVE_DETECTED:
                theAppState = AppStates.AUTHENTICATING;
                break;
            }
        }
예제 #7
0
        private static AppStates GetAppStates()
        {
            var appStatesRepository = UnitOfWork.AppStates;
            var appStates           = appStatesRepository.GetById(AppStates.AppStatesId);

            if (appStates == null)
            {
                appStates = new AppStates();
                appStatesRepository.Insert(appStates);
            }

            return(appStates);
        }
예제 #8
0
        /*************************************************************
        *************************************************************/
        private void HandleError(AppStims theAppStims)
        {
            switch (theAppStims)
            {
            case AppStims.DRIVE_PRESENT:
                break;

            case AppStims.DRIVE_ABSENT:
                AddEvent("Drive Removed");
                theAppState = AppStates.DETECTING;
                break;
            }
        }
예제 #9
0
        private void SetAppState(AppStates newState, string filename)
        {
            switch (newState)
            {
            case AppStates.Idle:
                this.SetFileReadWidgetsVisible(false);
                this.StatusBox.Visible   = true;
                this.ProgressBar.Visible = false;
                break;

            case AppStates.ParsingLog:
                this.SetFileReadWidgetsVisible(true);
                this.ProgressBar.Text  = string.Format("Reading file: {0}", filename);
                this.StatusBox.Visible = false;
                break;
            }
        }
예제 #10
0
        /*************************************************************
        *************************************************************/
        private void HandleAuthenticating(AppStims theAppStims)
        {
            switch (theAppStims)
            {
            case AppStims.KEYS_LOADED:
                AuthenticateDrive();
                break;

            case AppStims.DRIVE_AUTH_FAILED:
                //keys.Enabled = true;
                theAppState = AppStates.ERROR;
                break;

            case AppStims.DRIVE_AUTH_PASSED:
                //keys.Enabled = true;
                theAppState = AppStates.DISK_DETECTING;
                break;
            }
        }
        public IEnumerator StartMappingTexture()
        {
            if (State == AppStates.Scanning)
            {
                State = AppStates.MappingTexture;

                SpatialUnderstanding.Instance.RequestFinishScan();
                while (SpatialUnderstanding.Instance.ScanState != SpatialUnderstanding.ScanStates.Done)
                {
                    yield return(null);
                }

                TextureMappingManager.Instance.StartTextureMapping();
                MiniatureRoom.GenerateMesh();

                ClearDialog();
                SimpleDialog.ButtonTypeEnum buttons = SimpleDialog.ButtonTypeEnum.OK;
                dialog = SimpleDialog.Open(DialogPrefab, buttons, "Camera Mapping", "Move around and do AirTap.");
            }
        }
예제 #12
0
        private async void btnCancel_Click(object sender, EventArgs e)
        {
            cancellation.Cancel();
            AddEvent("Cancelling...");

            // We should wait for the tasks to finish here
            btnCancel.Enabled = false;

            if (currentTask != null)
            {
                await currentTask;
            }

            AddEvent("Current task cancelled");

            StateMachine(AppStims.CANCEL);
            ReportProgress(0); // Reset progressbar
            theAppState = AppStates.READY;

            TaskComplete();
        }
예제 #13
0
        /*************************************************************
        *************************************************************/
        private void HandleReady(AppStims theAppStims)
        {
            switch (theAppStims)
            {
            case AppStims.DISK_PRESENT:
                btnRipGame.Enabled = true;
                btnEject.Enabled   = true;
                break;

            case AppStims.NO_DISK_PRESENT:
                AuthenticateDrive();
                /* Wait for user to swap disks */
                btnRipGame.Enabled = false;
                btnEject.Enabled   = false;
                theAppState        = AppStates.DISK_DETECTING;
                break;

            case AppStims.DRIVE_ABSENT:
                theAppState = AppStates.DETECTING;
                break;
            }
        }
예제 #14
0
        /*************************************************************
        *************************************************************/
        private void HandleDiskDetecting(AppStims theAppStims)
        {
            switch (theAppStims)
            {
            case AppStims.DRIVE_PRESENT:
                DiskDetectionWorker.RunWorkerAsync();
                break;

            case AppStims.DRIVE_ABSENT:
                AddEvent("Drive Removed");
                theAppState = AppStates.DETECTING;
                break;

            case AppStims.DISK_PRESENT:
                theAppState = AppStates.DISK_TYPE_DETECTING;
                break;

            case AppStims.NO_DISK_PRESENT:
                /* Wait for user to swap disks */
                break;
            }
        }
예제 #15
0
 //Called by the buttons
 public void TerrainDone()
 {
     appState = AppStates.GAME_RENDERING;
 }
예제 #16
0
 private void OnImageTrackableFoundFirstTime()
 {
     appState = AppStates.INIT_ANIMATION;
 }
예제 #17
0
 public bool Exists(AppStates state) => History.Any(x => x.Value == state);
예제 #18
0
 private void OnStateChanged(AppStates state)
 {
     updatableState = appStateMachine.CurrentState as IUpdatable;
 }
예제 #19
0
 public void ResetAll()
 {
     appState = AppStates.RESET_ALL;
 }
예제 #20
0
    void Update()
    {
        //We declare the bool values here because we want them to be set to false, unless the state is correct
        //This saves us from setting the values to false in each state.
        bool showDoneButton  = false;
        bool showResetButton = false;

        switch (appState)
        {
        //Detection phase
        case AppStates.OVERLAY_OUTLINE:
            instructionsText.text = pointDeviceText;
            surfaceBehaviour.GetComponent <Renderer>().enabled = false;
            break;

        // The animation that is played when the trackable is found for the first time
        case AppStates.INIT_ANIMATION:
            appState = AppStates.SCANNING;
            break;

        // Scanning phase
        case AppStates.SCANNING:
            ShowWireFrame(true);
            instructionsText.text = pullBackText;
            showDoneButton        = true;
            break;

        // When the user taps done. This happens before the game can be played
        case AppStates.GAME_RENDERING:
            if ((reconstructionBehaviour != null) && (reconstructionBehaviour.Reconstruction != null))
            {
                ShowWireFrame(false);
                surfaceBehaviour.GetComponent <Renderer>().enabled = false;
                imageTarget.ToggleOnStateChange = true;
                reconstructionBehaviour.Reconstruction.Stop();
                OnStartGame.Invoke();
                appState = AppStates.GAME_PLAY;
            }
            break;

        //This is where the user can shoot the ball
        case AppStates.GAME_PLAY:
            instructionHolder.gameObject.SetActive(false);
            showResetButton = true;
            break;

        //User taps on [RESET] button - Re-loads the level
        case AppStates.RESET_ALL:
            //Reloads this scene
            UnityEngine.SceneManagement.SceneManager.LoadScene(0);
            appState = AppStates.NONE;
            break;

        // Just a placeholder state, to make sure that the previous state runs for just one frame.
        case AppStates.NONE: break;
        }

        if (doneButton != null &&
            showDoneButton != doneButton.enabled)
        {
            doneButton.enabled       = showDoneButton;
            doneButton.image.enabled = showDoneButton;
            doneButton.gameObject.SetActive(showDoneButton);
        }

        if (resetButton != null &&
            showResetButton != resetButton.enabled)
        {
            resetButton.enabled       = showResetButton;
            resetButton.image.enabled = showResetButton;
            resetButton.gameObject.SetActive(showResetButton);
        }
    }
 //------------------------------------------------------------------
 private void ChangeAppState(AppStates in_newState)
 {
     m_appState = in_newState;
 }