예제 #1
0
        public void ExecuteOneCommand()
        {
            if (currentCmdIndex > 0)
            {
                ClearLast();
            }
            var currentCmd = _commands[currentCmdIndex];
            var currentUI  = cmd_UIElement[currentCmd];

            if (currentCmd is AdvancedPipettingCommand)
            {
                AdvancedPipettingCommand pipettingCmd = (AdvancedPipettingCommand)currentCmd;
                if (pipettingCmd.IsAspirate)
                {
                    currentUI.AspirateWellIDs = pipettingCmd.SelectedWellIDs;
                }
                else
                {
                    currentUI.DispenseWellIDs = pipettingCmd.SelectedWellIDs;
                }
                currentUI.Dispatcher.Invoke(() =>
                {
                    currentUI.InvalidateVisual();
                });
            }
            currentCmdIndex++;
        }
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            string sVolume = txtVolume.Text;
            int    volume  = 0;
            bool   bok     = int.TryParse(sVolume, out volume);

            if (!bok)
            {
                SetInfo(strings.VolumeMustBeDigital, Brushes.Red);
                return;
            }
            if (volume <= 0)
            {
                SetInfo(strings.VolumeMustBeBiggerThan0, Brushes.Red);
                return;
            }

            if (labwareUIElement.SelectedWellIDs.Count == 0)
            {
                SetInfo(strings.MustSelectSomeWell, Brushes.Red);
                return;
            }
            pipettingCommand = new AdvancedPipettingCommand(_labware.Label, new List <int>()
            {
                1
            },
                                                            labwareUIElement.SelectedWellIDs,
                                                            GetLiquidClass(),
                                                            ((string)lblCommandName.Content) == strings.aspirate, volume);
            bOk             = true;
            this.Visibility = System.Windows.Visibility.Hidden;
        }
예제 #3
0
        public ScriptVisualizer(Grid container, List <IPipettorCommand> commands)
        {
            _commands = commands;
            //check labware all exists
            Dictionary <string, LabwareUIElement> label_LabwareUI = new Dictionary <string, LabwareUIElement>();

            foreach (UIElement uiElement in container.Children)
            {
                if (uiElement is LabwareUIElement)
                {
                    LabwareUIElement labwareUIElement = (LabwareUIElement)uiElement;
                    label_LabwareUI.Add(labwareUIElement.Label, labwareUIElement);
                    _labwareUIElements.Add(labwareUIElement);
                }
            }

            int lineNum = 1;
            List <AdvancedPipettingCommand> pipettingCmds = new List <AdvancedPipettingCommand>();

            foreach (var command in commands)
            {
                if (command is AdvancedPipettingCommand)
                {
                    AdvancedPipettingCommand pipettingCmd = (AdvancedPipettingCommand)command;
                    pipettingCmds.Add(pipettingCmd);
                    string label = pipettingCmd.LabwareLabel;
                    if (!_labwareUIElements.Exists(x => x.Label == label))
                    {
                        throw new Exception(string.Format("Command: {0}'s labware cannot be found!", label));
                    }
                    else //check wellID
                    {
                        var labware      = label_LabwareUI[label].Labware;
                        int totalWellCnt = labware.WellsInfo.NumberOfWellsX * labware.WellsInfo.NumberOfWellsY;
                        if (pipettingCmd.SelectedWellIDs.Max() > totalWellCnt)
                        {
                            throw new Exception(string.Format("Command : {0}'s well ID doesn't exist in labware:{1}", lineNum, label));
                        }
                    }
                    cmd_UIElement.Add(pipettingCmd, label_LabwareUI[label]);
                }
                lineNum++;
            }
        }
예제 #4
0
        private void StartScript_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            TabItem                  selectedTab   = tabDynamic.SelectedItem as TabItem;
            LayoutEditor             layoutEditor  = (LayoutEditor)((Grid)selectedTab.Content).Children[0];
            AdvancedPipettingCommand pipettingCmd1 = new AdvancedPipettingCommand("label1", new List <int>()
            {
                1
            }, new List <int>()
            {
                1
            }, new LiquidClass(), true, 100);
            AdvancedPipettingCommand pipettingCmd2 = new AdvancedPipettingCommand("label1", new List <int>()
            {
                1
            }, new List <int>()
            {
                9
            }, new LiquidClass(), false, 100);
            AdvancedPipettingCommand pipettingCmd3 = new AdvancedPipettingCommand("label1", new List <int>()
            {
                1
            }, new List <int>()
            {
                2
            }, new LiquidClass(), true, 100);
            AdvancedPipettingCommand pipettingCmd4 = new AdvancedPipettingCommand("label1", new List <int>()
            {
                1
            }, new List <int>()
            {
                10
            }, new LiquidClass(), false, 100);
            List <IPipettorCommand> pipettingCmds = new List <IPipettorCommand>()
            {
                pipettingCmd1, pipettingCmd2,
                pipettingCmd3, pipettingCmd4
            };

            layoutEditor.RunScript(pipettingCmds);
        }