Пример #1
0
 public Task <Tool[]> GetTools(int categoryId = 0, ToolType?type = null, int operatingSystem = 0, License?license = null)
 {
     return(Task.Run(() =>
     {
         using (var ctx = new TLEntities())
         {
             var query = ctx.Tools
                         .Where(t => t.Activated)
                         .Include(t => t.Category)
                         .Include(t => t.OperatingSystems);
             if (categoryId != 0)
             {
                 query = query.Where(t => t.Category.Id == categoryId);
             }
             if (type.HasValue)
             {
                 query = query.Where(t => t.Type == type.Value);
             }
             if (operatingSystem != 0)
             {
                 query = query.Where(t => t.OperatingSystems.Where(o => o.Id == operatingSystem).Any());
             }
             if (license.HasValue)
             {
                 query = query.Where(t => t.License == license.Value);
             }
             return query.ToArray();
         }
     }));
 }
Пример #2
0
        private void SelectTool(ToolType toolType)
        {
            SelectedToolType = toolType;

            DialogResult = true;
            Close();
        }
Пример #3
0
        /// <summary>
        /// Open a data set given raw file, id file, and feature file.
        /// </summary>
        /// <param name="dataSetViewModel">DataSetViewModel to associate open dataset with</param>
        /// <param name="rawFilePath">Path to raw file to open</param>
        /// <param name="idFilePath">Path to MS-GF+ or MS-PathFinder results file</param>
        /// <param name="featureFilePath">Path to feature list file</param>
        /// <param name="paramFilePath">Path to MSPathFinder parameter file.</param>
        /// <param name="toolType">Type of ID tool used for this data set</param>
        /// <param name="modIgnoreList">Modifications to ignore if found in ID list.</param>
        /// <returns>Task that opens the data set.</returns>
        public async Task OpenDataSet(
            DataSetViewModel dataSetViewModel,
            string rawFilePath,
            string idFilePath                  = "",
            string featureFilePath             = "",
            string paramFilePath               = "",
            ToolType?toolType                  = ToolType.MsPathFinder,
            IEnumerable <string> modIgnoreList = null)
        {
            // Open raw file, if not already open.
            if (!string.IsNullOrEmpty(rawFilePath) && dataSetViewModel.LcMs == null)
            {
                this.ReadingRawFiles = true;
                await Task.Delay(20).ConfigureAwait(false);

                await dataSetViewModel.InitializeAsync(rawFilePath).ConfigureAwait(false);

                this.ReadingRawFiles = false;
            }

            // Show neighboring charge state XICs by default for MSPathFinder results
            if (toolType != null && toolType == ToolType.MsPathFinder)
            {
                var precFragSeq = dataSetViewModel.XicViewModel.PrecursorPlotViewModel.FragmentationSequenceViewModel as PrecursorSequenceIonViewModel;
                if (precFragSeq != null)
                {
                    precFragSeq.PrecursorViewMode = PrecursorViewMode.Charges;
                }
            }

            // Open ID file
            if (!string.IsNullOrEmpty(idFilePath))
            {
                this.ReadingIdFiles = true;

                if (dataSetViewModel.MsPfParameters == null)
                {
                    dataSetViewModel.SetMsPfParameters(string.IsNullOrWhiteSpace(paramFilePath) ? idFilePath : paramFilePath);
                }

                if (dataSetViewModel.MsPfParameters != null)
                {
                    IcParameters.Instance.ProductIonTolerancePpm = dataSetViewModel.MsPfParameters.ProductIonTolerancePpm;
                    IcParameters.Instance.PrecursorTolerancePpm  = dataSetViewModel.MsPfParameters.PrecursorTolerancePpm;
                }

                await this.ReadIdFile(dataSetViewModel, idFilePath, modIgnoreList);

                this.ReadingIdFiles = false;
            }

            // Open feature file
            if (!string.IsNullOrEmpty(featureFilePath))
            {
                this.ReadingFeatureFiles = true;
                dataSetViewModel.FeatureMapViewModel.OpenFeatureFile(featureFilePath);
                dataSetViewModel.FeatureMapViewModel.UpdateIds(dataSetViewModel.ScanViewModel.FilteredData);
                this.ReadingRawFiles = false;
            }
        }
Пример #4
0
        IEnumerator DelayEndQuickTool(QuickToolData toolData)
        {
            var toolState = UIStateManager.current.stateData.toolState;

            if (m_PreviousToolType == null)
            {
                m_PreviousToolType = toolState.activeTool;
            }

            if (toolState.activeTool != toolData.toolType || (toolData.orbitType != OrbitType.None && toolState.orbitType != toolData.orbitType))
            {
                if (toolState.orbitType != toolData.orbitType)
                {
                    m_PreviousOrbitType = toolState.orbitType;
                }

                toolState.activeTool = toolData.toolType;

                if (toolData.toolType == ToolType.OrbitTool)
                {
                    toolState.orbitType = toolData.orbitType;
                }
            }

            UIStateManager.current.Dispatcher.Dispatch(Payload <ActionTypes> .From(ActionTypes.SetToolState, toolState));

            yield return(new WaitForSeconds(k_ToolDebounceTime));

            OnQuickToolEnd();
        }
Пример #5
0
        void OnPanMode(InputAction.CallbackContext context)
        {
            if (!CheckTreatInput(context))
            {
                return;
            }

            var toolState = UIStateManager.current.stateData.toolState;

            if (context.control.IsPressed())
            {
                m_PanPressed = true;
                if (!IsTemporaryTool(toolState.activeTool))
                {
                    m_PreviousToolType = toolState.activeTool;
                }

                toolState.activeTool = m_ZoomPressed ? ToolType.ZoomTool : ToolType.PanTool;
            }
            else
            {
                toolState.activeTool = m_PreviousToolType ?? ToolType.None;
                m_PanPressed         = false;
            }

            UIStateManager.current.Dispatcher.Dispatch(Payload <ActionTypes> .From(ActionTypes.SetToolState, toolState));
        }
        private void SelectTool(ToolType toolType)
        {
            SelectedToolType = toolType;

            DialogResult = true;
            Close();
        }
        private void ActivateFireExtinguisher()
        {
            _lockMovement = true;
            _animator.SetBool("Extinguisher", true);

            CurrentGame.ActivateTool(ToolType.FireExtinguisher);
            _activeTool = ToolType.FireExtinguisher;
        }
Пример #8
0
 protected Block(string name, ItemMaterial?material = null, ToolType?toolType = null, double?hardness = null)
     : base(name, material, toolType)
 {
     if (hardness != null)
     {
         BlockHardness[BlockId] = hardness.Value;
     }
 }
Пример #9
0
 protected Item(string name, ItemMaterial?material = null, ToolType?toolType = null)
 {
     Name = name;
     if (material != null)
     {
         ItemMaterials[ItemId] = material.Value;
     }
     if (toolType != null)
     {
         ToolTypes[ItemId] = toolType.Value;
     }
 }
Пример #10
0
        public async Task <ToolModel[]> GetTools([FromUri] int categoryId = 0, [FromUri] int type = 0, [FromUri] int os = 0, [FromUri] int license = 0)
        {
            ToolType?toolEnum = (ToolType)type;

            if (toolEnum == 0)
            {
                toolEnum = null;
            }
            License?licenseEnum = (License)license;

            if (licenseEnum == 0)
            {
                licenseEnum = null;
            }
            Tool[] tools = await this._toolManager.GetTools(categoryId, toolEnum, os, licenseEnum);

            ToolModel[] models = tools.ConvertTools();
            return(models);
        }
Пример #11
0
        void OnQuickToolEnd()
        {
            var toolState           = UIStateManager.current.stateData.toolState;
            var navigationToolState = toolState;

            toolState.activeTool = m_PanPressed ? (m_ZoomPressed ? ToolType.ZoomTool:ToolType.PanTool):m_PreviousToolType ?? ToolType.None;
            m_PreviousToolType   = null;
            if (m_PreviousOrbitType != null)
            {
                toolState.orbitType = m_PreviousOrbitType ?? toolState.orbitType;
                m_PreviousOrbitType = null;
            }

            // Reset Orbit tool type first
            navigationToolState.activeTool = m_PreviousOrbitToolType ?? ToolType.None;
            navigationToolState.orbitType  = OrbitType.OrbitAtPoint;
            UIStateManager.current.Dispatcher.Dispatch(Payload <ActionTypes> .From(ActionTypes.SetToolState, navigationToolState));

            UIStateManager.current.Dispatcher.Dispatch(Payload <ActionTypes> .From(ActionTypes.SetToolState, toolState));
        }
Пример #12
0
        void OnStateDataChanged(UIStateData stateData)
        {
            if (m_ToolbarsEnabled != stateData.toolbarsEnabled)
            {
                if (stateData.toolbarsEnabled)
                {
                    if (stateData.navigationState.navigationMode == NavigationMode.Orbit)
                    {
                        m_Camera.enabled = true;
                        m_InputActionAsset.Enable();
                    }
                    else
                    {
                        m_Camera.enabled = false;
                        m_InputActionAsset.Disable();
                    }
                }
                else
                {
                    m_Camera.enabled = false;
                    m_InputActionAsset.Disable();
                }

                m_ResetButton.button.interactable = stateData.toolbarsEnabled;

                m_ToolbarsEnabled = stateData.toolbarsEnabled;
            }

            if (m_CachedNavigationState != stateData.navigationState)
            {
                m_Camera.enabled      = stateData.navigationState.freeFlyCameraEnabled;
                m_FocusButton.enabled = stateData.navigationState.freeFlyCameraEnabled;

                if (stateData.navigationState.orbitEnabled)
                {
                    m_InputActionAsset["Orbit Action"].Enable();
                }
                else
                {
                    m_InputActionAsset["Orbit Action"].Disable();
                }

                if (stateData.navigationState.panEnabled)
                {
                    m_InputActionAsset["Pan Mode Action"].Enable();
                    m_InputActionAsset["Pan Gesture Action"].Enable();
                    m_InputActionAsset["Pan Gesture Action"].Enable();
                    m_InputActionAsset["Pan Action"].Enable();
                    m_InputActionAsset["Quick Pan Action"].Enable();
                }
                else
                {
                    m_InputActionAsset["Pan Mode Action"].Disable();
                    m_InputActionAsset["Pan Gesture Action"].Disable();
                    m_InputActionAsset["Pan Gesture Action"].Disable();
                    m_InputActionAsset["Pan Action"].Disable();
                    m_InputActionAsset["Quick Pan Action"].Disable();
                }

                if (stateData.navigationState.zoomEnabled)
                {
                    m_InputActionAsset["Zoom Mode Action"].Enable();
                    m_InputActionAsset["Zoom Gesture Action"].Enable();
                    m_InputActionAsset["Zoom Gesture Action"].Enable();
                    m_InputActionAsset["Zoom Action"].Enable();
                    m_InputActionAsset["Quick Zoom Action"].Enable();
                }
                else
                {
                    m_InputActionAsset["Zoom Mode Action"].Disable();
                    m_InputActionAsset["Zoom Gesture Action"].Disable();
                    m_InputActionAsset["Zoom Gesture Action"].Disable();
                    m_InputActionAsset["Zoom Action"].Disable();
                    m_InputActionAsset["Quick Zoom Action"].Disable();
                }

                if (stateData.navigationState.moveEnabled)
                {
                    m_InputActionAsset["Moving Action"].Enable();
                }
                else
                {
                    m_InputActionAsset["Moving Action"].Disable();
                }

                if (stateData.navigationState.worldOrbitEnabled)
                {
                    m_InputActionAsset["Quick WorldOrbit Action"].Enable();
                }
                else
                {
                    m_InputActionAsset["Quick WorldOrbit Action"].Disable();
                }

                if (stateData.navigationState.teleportEnabled)
                {
                    m_InputActionAsset["Teleport Action"].Enable();
                }
                else
                {
                    m_InputActionAsset["Teleport Action"].Disable();
                }

                if (m_CachedNavigationMode != stateData.navigationState.navigationMode)
                {
                    if (stateData.navigationState.navigationMode == NavigationMode.Orbit)
                    {
                        StartCoroutine(ResetHomeView());
                    }
                    m_CachedNavigationMode = stateData.navigationState.navigationMode;
                }

                m_GizmoCube.SetActive(stateData.navigationState.gizmoEnabled);

                /*
                 * TODO: Temporary fix till next MARS Update. This code will make sure that the cube stay hidden in AR mode.
                 */
                GizmoController gizmoController = GetComponent <GizmoController>();
                if (!stateData.navigationState.gizmoEnabled)
                {
                    gizmoController.HideGizmo();
                }
                else
                {
                    gizmoController.ShowGizmo();
                }

                m_CachedNavigationState = stateData.navigationState;
            }

            if (m_CachedToolType == null || m_CachedToolType != stateData.toolState.activeTool)
            {
                m_CachedToolType = stateData.toolState.activeTool;
            }

            if (m_CachedCameraOptionData != stateData.cameraOptionData)
            {
                switch (stateData.cameraOptionData.cameraViewType)
                {
                case CameraViewType.Top:
                    OnTopView();
                    break;

                case CameraViewType.Left:
                    OnLeftView();
                    break;

                case CameraViewType.Right:
                    OnRightView();
                    break;
                }

                m_CachedCameraOptionData = stateData.cameraOptionData;
            }

            if (m_CachedInfoType != stateData.toolState.infoType)
            {
                m_CachedInfoType = stateData.toolState.infoType;
            }
        }
Пример #13
0
 void OnOrbitButtonClicked()
 {
     m_PreviousOrbitToolType = ToolType.OrbitTool;
 }
Пример #14
0
 void OnPanButtonClicked()
 {
     m_PreviousOrbitToolType = ToolType.PanTool;
 }
Пример #15
0
 void OnZoomButtonClicked()
 {
     m_PreviousOrbitToolType = ToolType.ZoomTool;
 }
 private void CheckForToolDeactivation()
 {
     if ((_activeTool != null) && (!CurrentGame.ToolIsActive))
     {
         _animator.SetBool("Extinguisher", false);
         _lockMovement = false;
         _activeTool = null;
     }
 }
        private void Reset()
        {
            _facingRight = (_transform.localScale.x > 0.0f);
            _verticalMovementState = VerticalMovementState.OnGround;

            _lockMovement = false;
            _isMoving = false;

            _activeGateType = GateType.None;
            _gateCenterX = 0.0f;
            _enteringGate = false;

            _activeTool = null;
        }
Пример #18
0
        void OnStateDataChanged(UIStateData stateData)
        {
            if (m_ToolbarsEnabled != stateData.toolbarsEnabled)
            {
                if (stateData.toolbarsEnabled)
                {
                    if (stateData.navigationState.navigationMode == NavigationMode.Orbit)
                    {
                        m_Camera.enabled = true;
                        m_InputActionAsset.Enable();
                    }
                    else
                    {
                        m_Camera.enabled = false;
                        m_InputActionAsset.Disable();
                    }
                }
                else
                {
                    m_Camera.enabled = false;
                    m_InputActionAsset.Disable();
                }
                m_ResetButton.button.interactable = stateData.toolbarsEnabled;

                m_ToolbarsEnabled = stateData.toolbarsEnabled;
            }

            if (m_CachedNavigationMode != stateData.navigationState.navigationMode)
            {
                if (stateData.navigationState.navigationMode == NavigationMode.Orbit)
                {
                    m_Camera.enabled = true;
                    m_InputActionAsset.Enable();
                    StartCoroutine(ResetHomeView());
                    m_ResetButton.button.interactable = stateData.toolbarsEnabled; // only disable home button on AR mode
                }
                else if (stateData.navigationState.navigationMode == NavigationMode.AR)
                {
                    m_Camera.enabled = false;
                    m_InputActionAsset.Disable();
                    m_ResetButton.button.interactable = false;
                }
                else
                {
                    m_Camera.enabled = false;
                    m_InputActionAsset.Disable();
                    m_ResetButton.button.interactable = stateData.toolbarsEnabled;
                }

                m_CachedNavigationMode = stateData.navigationState.navigationMode;
            }

            if (m_CachedToolType == null || m_CachedToolType != stateData.toolState.activeTool)
            {
                m_CachedToolType = stateData.toolState.activeTool;
            }

            if (m_PreviousToolType == null && !IsTemporaryTool(stateData.toolState.activeTool))
            {
                m_PreviousToolType = stateData.toolState.activeTool;
            }
            else if (stateData.toolState.activeTool == ToolType.None)
            {
                m_PreviousToolType = ToolType.OrbitTool;
            }
        }