コード例 #1
0
        public override void GlobalContext()
        {
            base.GlobalContext();
            _simulation            = DomainFactoryForSpecs.CreateDefaultSimulation();
            _moleculeBuildingBlock = new MoleculeBuildingBlock();
            var compoundProperties = _simulation.CompoundPropertiesList.First();

            _compoundName = compoundProperties.Compound.Name;
            _moleculeBuildingBlock.Add(new MoleculeBuilder {
                Name = _compoundName, QuantityType = QuantityType.Drug
            });
            _moleculeBuildingBlock.Add(new MoleculeBuilder {
                Name = "Enzyme", QuantityType = QuantityType.Enzyme
            });
            _moleculeBuildingBlock.Add(new MoleculeBuilder {
                Name = "Metabolite", QuantityType = QuantityType.Metabolite
            });
            _moleculeBuildingBlock.Add(new MoleculeBuilder {
                Name = "Protein", QuantityType = QuantityType.OtherProtein
            });
            var specificBindingSelection = new ProcessSelection {
                CompoundName = _compoundName, MoleculeName = "Protein", ProcessName = "Specific Binding"
            };
            var metabolizationSelection = new EnzymaticProcessSelection {
                CompoundName = _compoundName, MoleculeName = "Protein", ProcessName = "Metabolism"
            };

            _complexProductName    = specificBindingSelection.ProductName(CoreConstants.Molecule.Complex);
            _metaboliteProductName = specificBindingSelection.ProductName(CoreConstants.Molecule.Metabolite);
            _moleculeBuildingBlock.Add(new MoleculeBuilder {
                Name = _complexProductName, QuantityType = QuantityType.Complex
            });
            compoundProperties.Processes.SpecificBindingSelection.AddPartialProcessSelection(specificBindingSelection);
            compoundProperties.Processes.MetabolizationSelection.AddPartialProcessSelection(metabolizationSelection);
        }
コード例 #2
0
        public override Task <IProcessMapping> MapToModel(CompoundProcessSelection snapshot, Model.CompoundProcess process)
        {
            IProcessMapping processMapping;

            switch (process)
            {
            case SystemicProcess systemicProcess:
                processMapping = new SystemicProcessSelection
                {
                    ProcessType = systemicProcess.SystemicProcessType,
                };
                break;

            case EnzymaticProcess _:
                processMapping = new EnzymaticProcessSelection
                {
                    MetaboliteName = snapshot.MetaboliteName,
                };
                break;

            case InteractionProcess _:
                processMapping = new InteractionSelection();
                break;

            default:
                processMapping = new ProcessSelection();
                break;
            }

            processMapping.ProcessName  = snapshot.Name;
            processMapping.CompoundName = process.ParentCompound.Name;
            processMapping.MoleculeName = snapshot.MoleculeName;

            return(Task.FromResult(processMapping));
        }
コード例 #3
0
        protected override Task Context()
        {
            sut = new ProcessMappingMapper();

            _compound = new Compound
            {
                Name = "COMP",
            };


            _enzymaticProcess          = new EnzymaticProcess().WithName("MetaProcess");
            _enzymaticProcessSelection = new EnzymaticProcessSelection
            {
                CompoundName   = _compound.Name,
                MetaboliteName = "META",
                MoleculeName   = "CYP",
                ProcessName    = _enzymaticProcess.Name
            };


            _specificBindingProcess = new SpecificBindingPartialProcess().WithName("BindingProcess");
            _specificBindingPartialProcessSelection = new ProcessSelection
            {
                CompoundName = _compound.Name,
                MoleculeName = "BINDER",
                ProcessName  = _specificBindingProcess.Name
            };

            _transportSystemicProcess = new SystemicProcess
            {
                Name = "SystemicTransport",
                SystemicProcessType = SystemicProcessTypes.GFR
            };

            _transportSystemicProcessSelection = new SystemicProcessSelection
            {
                CompoundName = _compound.Name,
                ProcessName  = _transportSystemicProcess.Name,
                ProcessType  = _transportSystemicProcess.SystemicProcessType
            };

            _interactionProcess   = new InductionProcess().WithName("InteractionProcess");
            _interactionSelection = new InteractionSelection
            {
                CompoundName = _compound.Name,
                ProcessName  = _interactionProcess.Name,
                MoleculeName = "INHIBITOR"
            };

            _compound.AddProcess(_enzymaticProcess);
            _compound.AddProcess(_transportSystemicProcess);
            _compound.AddProcess(_interactionProcess);
            _compound.AddProcess(_specificBindingProcess);

            return(_completed);
        }
コード例 #4
0
        private void Button_LoadProcess_Click(object sender, RoutedEventArgs e)
        {
            ProcessSelection processSelection = new ProcessSelection();

            processSelection.Top  = this.Top;
            processSelection.Left = this.Left;
            Nullable <bool> dialogResult = processSelection.ShowDialog();

            if (dialogResult == true)
            {
                if (processSelection.NewSelectedProcesses != null)
                {
                    foreach (var SelectedProcess in processSelection.NewSelectedProcesses)
                    {
                        SelectedProcess.Hooked = true;
                        AllSelectedProcesses.Add(SelectedProcess);
                    }
                    ListBox_RunningProcesses.Items.Refresh();
                }
            }
        }
コード例 #5
0
        public override Task <IProcessMapping> MapToModel(CompoundProcessSelection snapshot, CompoundProcessSnapshotContext snapshotContext)
        {
            IProcessMapping processMapping;
            var             process = snapshotContext.Process;

            switch (process)
            {
            case SystemicProcess systemicProcess:
                processMapping = new SystemicProcessSelection
                {
                    ProcessType = systemicProcess.SystemicProcessType,
                };
                break;

            case EnzymaticProcess _:
                processMapping = new EnzymaticProcessSelection
                {
                    MetaboliteName = snapshot.MetaboliteName,
                };
                break;

            case InteractionProcess _:
                processMapping = new InteractionSelection();
                break;

            default:
                processMapping = new ProcessSelection();
                break;
            }

            processMapping.ProcessName = ModelValueFor(snapshot.Name);
            //Parent compound may be null for process that are representing a non existent selection
            processMapping.CompoundName = ModelValueFor(process.ParentCompound?.Name);
            processMapping.MoleculeName = ModelValueFor(snapshot.MoleculeName);

            return(Task.FromResult(processMapping));
        }
コード例 #6
0
ファイル: DragScrollViewer.cs プロジェクト: nirzaf/POS_in_WPF
        private void DoButtonUp()
        {
            isButtonDown         = false;
            stoppedVertialOffset = ScrollOffset;
            //scrollViewer.ScrollToVerticalOffset(ScrollOffset);

            // No down-event, before the up-event
            if (((timeStart == null) || !timeStart.HasValue) ||
                ((timeApex == null) || !timeApex.HasValue))
            {
                return;
            }

            // This was a tap or delibrate scroll, not a drag-scroll
            TimeSpan determiningLength = DateTime.Now - timeStart.Value;

            // Process Selection
            if (ProcessSelection != null)
            {
                if (determiningLength.TotalMilliseconds > 1200)
                {
                    EndAnimation();
                    return;
                }
                if (initialVertialOffset == stoppedVertialOffset)
                {
                    ProcessSelection.Invoke(this, new EventArgs());
                    return;
                }
            }
            else if ((initialVertialOffset == stoppedVertialOffset) ||
                     (determiningLength.TotalMilliseconds > 1200))
            {
                EndAnimation();
                return;
            }

            TimeSpan brushStrokeDurration = (DateTime.Now - timeApex.Value);
            int      ms = (int)(brushStrokeDurration.TotalMilliseconds / 10);

            if (!isDeclining)
            {
                strokeLength = (MouseMoveApogy.Value.Y - MouseMoveParogy.Value.Y) / 10;
            }
            else
            {
                strokeLength = (MouseMoveParogy.Value.Y - MouseMoveApogy.Value.Y) / 10;
            }

            if ((strokeLength > -1) && (strokeLength < 0))
            {
                strokeLength = -1;
            }
            if ((strokeLength < 1) && (strokeLength > 0))
            {
                strokeLength = 1;
            }

            // Start the scrolling animation
            int durationMilliseconds = (int)Math.Abs(GetScrollDistantance() / strokeLength * ms);

            if (durationMilliseconds > 0)
            {
                Duration spanDuration =
                    new Duration(new TimeSpan(0, 0, 0, 0, durationMilliseconds));
                StartAnimation(spanDuration);
            }
        }
コード例 #7
0
        protected override Task Context()
        {
            _calculationMethodCacheMapper = A.Fake <CalculationMethodCacheMapper>();
            _processMappingMapper         = A.Fake <ProcessMappingMapper>();
            _logger  = A.Fake <ILogger>();
            _project = new PKSimProject();
            _calculationMethodSnapshot = new CalculationMethodCache();
            sut = new CompoundPropertiesMapper(_calculationMethodCacheMapper, _processMappingMapper, _logger);

            _compoundGroupSelectionOneAlternative = new CompoundGroupSelection
            {
                AlternativeName = "ALT1",
                GroupName       = "ALTERNATIVE_GROUP_1"
            };

            _compoundGroupSelectionTwoAlternatives = new CompoundGroupSelection
            {
                AlternativeName = "ALT2",
                GroupName       = "ALTERNATIVE_GROUP_2"
            };

            _compound = new Compound
            {
                Name = "COMP",
            };

            _protocol = new SimpleProtocol
            {
                Name = "PROTOCOL"
            };

            _parameterAlternativeGroupWithOneAlternative = new ParameterAlternativeGroup {
                Name = _compoundGroupSelectionOneAlternative.GroupName
            };
            _parameterAlternativeGroupWithTwoAlternatives = new ParameterAlternativeGroup {
                Name = _compoundGroupSelectionTwoAlternatives.GroupName
            };

            _parameterAlternativeGroupWithTwoAlternatives.AddAlternative(new ParameterAlternative {
                Name = "ALT1"
            });
            _parameterAlternativeGroupWithTwoAlternatives.AddAlternative(new ParameterAlternative {
                Name = "ALT2"
            });

            _compound.AddParameterAlternativeGroup(_parameterAlternativeGroupWithOneAlternative);
            _compound.AddParameterAlternativeGroup(_parameterAlternativeGroupWithTwoAlternatives);

            _compoundProperties = new Model.CompoundProperties();

            _compoundProperties.AddCompoundGroupSelection(_compoundGroupSelectionOneAlternative);
            _compoundProperties.AddCompoundGroupSelection(_compoundGroupSelectionTwoAlternatives);
            _compoundProperties.Compound = _compound;
            _enzymaticProcess            = new EnzymaticProcess {
                Name = "EnzymaticProcess"
            };
            _anotherEnzymaticProcess = new EnzymaticProcess {
                Name = "AnotherEnzymaticProcess", MoleculeName = "CYP3A4"
            };
            _specificBindingProcess = new SpecificBindingPartialProcess {
                Name = "SpecificBinding"
            };
            _gfrTransportProcess = new SystemicProcess {
                Name = "Transport", SystemicProcessType = SystemicProcessTypes.GFR
            };
            _hepaticEnzymaticProcess = new SystemicProcess {
                Name = "Plasma Clearance", SystemicProcessType = SystemicProcessTypes.Hepatic
            };
            _compound.AddProcess(_enzymaticProcess);
            _compound.AddProcess(_specificBindingProcess);
            _compound.AddProcess(_gfrTransportProcess);
            _compound.AddProcess(_hepaticEnzymaticProcess);

            _enzymaticPartialProcessSelection = new EnzymaticProcessSelection {
                ProcessName = _enzymaticProcess.Name
            };
            _noEnzymaticSystemicProcessSelection = new SystemicProcessSelection {
                ProcessType = SystemicProcessTypes.Hepatic
            };
            _specificBindingPartialProcessSelection = new ProcessSelection {
                ProcessName = _specificBindingProcess.Name
            };
            _transportSystemicProcessSelection = new SystemicProcessSelection {
                ProcessName = _gfrTransportProcess.Name, ProcessType = _gfrTransportProcess.SystemicProcessType,
            };
            _noEnzymaticPartialProcessSelection = new EnzymaticProcessSelection {
                MoleculeName = _anotherEnzymaticProcess.MoleculeName
            };
            _compoundProperties.Processes.MetabolizationSelection.AddPartialProcessSelection(_enzymaticPartialProcessSelection);
            _compoundProperties.Processes.MetabolizationSelection.AddPartialProcessSelection(_noEnzymaticPartialProcessSelection);
            _compoundProperties.Processes.MetabolizationSelection.AddSystemicProcessSelection(_noEnzymaticSystemicProcessSelection);
            _compoundProperties.Processes.SpecificBindingSelection.AddPartialProcessSelection(_specificBindingPartialProcessSelection);
            _compoundProperties.Processes.TransportAndExcretionSelection.AddSystemicProcessSelection(_transportSystemicProcessSelection);

            _snapshotProcess1 = new CompoundProcessSelection {
                Name = _enzymaticPartialProcessSelection.ProcessName
            };
            _snapshotProcess2 = new CompoundProcessSelection {
                Name = _specificBindingPartialProcessSelection.ProcessName
            };
            _snapshotProcess3 = new CompoundProcessSelection {
                Name = _transportSystemicProcessSelection.ProcessName
            };
            _snapshotProcess4 = new CompoundProcessSelection {
                SystemicProcessType = _noEnzymaticSystemicProcessSelection.ProcessType.SystemicProcessTypeId.ToString()
            };
            _snapshotProcess5 = new CompoundProcessSelection {
                MoleculeName = _noEnzymaticPartialProcessSelection.MoleculeName
            };

            _formulation = new Formulation
            {
                Id = "123456"
            };
            _compoundProperties.ProtocolProperties.Protocol = _protocol;
            _compoundProperties.ProtocolProperties.AddFormulationMapping(new FormulationMapping
            {
                FormulationKey        = "F1",
                TemplateFormulationId = _formulation.Id
            });

            _project.AddBuildingBlock(_formulation);
            A.CallTo(() => _calculationMethodCacheMapper.MapToSnapshot(_compoundProperties.CalculationMethodCache)).Returns(_calculationMethodSnapshot);
            A.CallTo(() => _processMappingMapper.MapToSnapshot(_enzymaticPartialProcessSelection)).Returns(_snapshotProcess1);
            A.CallTo(() => _processMappingMapper.MapToSnapshot(_specificBindingPartialProcessSelection)).Returns(_snapshotProcess2);
            A.CallTo(() => _processMappingMapper.MapToSnapshot(_transportSystemicProcessSelection)).Returns(_snapshotProcess3);
            A.CallTo(() => _processMappingMapper.MapToSnapshot(_noEnzymaticSystemicProcessSelection)).Returns(_snapshotProcess4);
            A.CallTo(() => _processMappingMapper.MapToSnapshot(_noEnzymaticPartialProcessSelection)).Returns(_snapshotProcess5);

            A.CallTo(() => _processMappingMapper.MapToModel(_snapshotProcess1, _enzymaticProcess)).Returns(_enzymaticPartialProcessSelection);
            A.CallTo(() => _processMappingMapper.MapToModel(_snapshotProcess2, _specificBindingProcess)).Returns(_specificBindingPartialProcessSelection);
            A.CallTo(() => _processMappingMapper.MapToModel(_snapshotProcess3, _gfrTransportProcess)).Returns(_transportSystemicProcessSelection);
            A.CallTo(() => _processMappingMapper.MapToModel(_snapshotProcess4, A <NotSelectedSystemicProcess> ._)).Returns(_noEnzymaticSystemicProcessSelection);
            A.CallTo(() => _processMappingMapper.MapToModel(_snapshotProcess5, A <EnzymaticProcess> ._)).Returns(_noEnzymaticPartialProcessSelection);

            return(_completed);
        }
コード例 #8
0
 protected override async Task Because()
 {
     _processSelection = await sut.MapToModel(_snapshot, _specificBindingProcess) as ProcessSelection;
 }
コード例 #9
0
ファイル: StroopMainForm.cs プロジェクト: blha303/STROOP
        private void StroopMainForm_Load(object sender, EventArgs e)
        {
            // Temp: Remove "Other" tab
#if RELEASE
            tabControlMain.TabPages.Remove(tabPageExpressions);
#endif

            _sm64Stream           = new ProcessStream();
            _sm64Stream.OnUpdate += OnUpdate;

            _disManager    = new DisassemblyManager(this, richTextBoxDissasembly, maskedTextBoxDisStart, _sm64Stream, buttonDisGo);
            _scriptManager = new ScriptManager(_sm64Stream, _scriptParser, checkBoxUseRomHack);
            _hackManager   = new HackManager(_sm64Stream, _romHacks, checkedListBoxHacks);

            // Create map manager
            MapGui mapGui = new MapGui();
            mapGui.GLControl              = glControlMap;
            mapGui.MapIdLabel             = labelMapId;
            mapGui.MapNameLabel           = labelMapName;
            mapGui.MapSubNameLabel        = labelMapSubName;
            mapGui.PuValueLabel           = labelMapPuValue;
            mapGui.QpuValueLabel          = labelMapQpuValue;
            mapGui.MapIconSizeTrackbar    = trackBarMapIconSize;
            mapGui.MapZoomTrackbar        = trackBarMapZoom;
            mapGui.MapShowInactiveObjects = checkBoxMapShowInactive;
            mapGui.MapShowMario           = checkBoxMapShowMario;
            mapGui.MapShowObjects         = checkBoxMapShowObj;
            mapGui.MapShowHolp            = checkBoxMapShowHolp;
            mapGui.MapShowCamera          = checkBoxMapShowCamera;
            mapGui.MapShowFloorTriangle   = checkBoxMapShowFloor;
            _mapManager = new MapManager(_sm64Stream, _mapAssoc, _objectAssoc, mapGui);

            _marioManager    = new MarioManager(_sm64Stream, _marioData, panelMarioBorder, flowLayoutPanelMario, _mapManager);
            _hudManager      = new HudManager(_sm64Stream, _hudData, tabPageHud);
            _miscManager     = new MiscManager(_sm64Stream, _miscData, flowLayoutPanelMisc, groupBoxPuController);
            _cameraManager   = new CameraManager(_sm64Stream, _cameraData, panelCameraBorder, flowLayoutPanelCamera);
            _triangleManager = new TriangleManager(_sm64Stream, tabPageTriangles, _triangleData);
            _debugManager    = new DebugManager();

            // Create object manager
            var objectGui = new ObjectDataGui()
            {
                ObjectBorderPanel     = panelObjectBorder,
                ObjectFlowLayout      = flowLayoutPanelObject,
                ObjectImagePictureBox = pictureBoxObject,
                ObjAddressLabelValue  = labelObjAddValue,
                ObjAddressLabel       = labelObjAdd,
                ObjBehaviorLabel      = labelObjBhvValue,
                ObjectNameTextBox     = textBoxObjName,
                ObjSlotIndexLabel     = labelObjSlotIndValue,
                ObjSlotPositionLabel  = labelObjSlotPosValue,
                CloneButton           = buttonObjClone,
                MoveMarioToButton     = buttonObjGoTo,
                MoveToMarioButton     = buttonObjRetrieve,
                UnloadButton          = buttonObjUnload
            };
            _objectManager = new ObjectManager(_sm64Stream, _objectAssoc, _objectData, objectGui);

            // Create options manager
            var optionGui = new OptionsGui();
            optionGui.CheckBoxStartFromOne = checkBoxStartSlotIndexOne;
            _optionsManager = new OptionsManager(optionGui);

            // Create Object Slots
            _slotManagerGui.TabControl                  = tabControlMain;
            _slotManagerGui.LockLabelsCheckbox          = checkBoxObjLockLabels;
            _slotManagerGui.MapObjectToggleModeComboBox = comboBoxMapToggleMode;
            _slotManagerGui.FlowLayoutContainer         = flowLayoutPanelObjects;
            _slotManagerGui.SortMethodComboBox          = comboBoxSortMethod;
            _slotManagerGui.LabelMethodComboBox         = comboBoxLabelMethod;
            _objectSlotManager = new ObjectSlotsManager(_sm64Stream, _objectAssoc, _objectManager, _slotManagerGui, _mapManager, _miscManager);

            SetupViews();

            _resizing               = false;
            _defaultSplitValue      = splitContainerMain.SplitterDistance;
            labelVersionNumber.Text = _version;

            // Load process
            var processes = GetAvailableProcesses();
            if (processes.Count == 1)
            {
                if (MessageBox.Show(String.Format("Found process \"{0}\". Connect?", processes[0].ProcessName),
                                    "Process Found", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    var processSelect = new ProcessSelection(processes[0]);
                    comboBoxProcessSelection.Items.Add(processSelect);
                    comboBoxProcessSelection.SelectedIndex = 0;
                }
            }
        }
コード例 #10
0
 protected override async Task Because()
 {
     _processSelection = await sut.MapToModel(_snapshot, new CompoundProcessSnapshotContext(_specificBindingProcess, new SnapshotContext())) as ProcessSelection;
 }