//First Method called every time the form is displayed
        public void InitiateProgram(int SelectedSpeed, int SelectedTorque, TimeSpan SelectedDuration, Enumerators.Direction SelectedDirection)
        {
            logger.Info("Initiating Custom Program.");

            dataSampleLeft = new EcceScrumDS(GlobalVariables.leftSerialPort);
            dataSampleRight = new EcceScrumDS(GlobalVariables.rightSerialPort);

            dataSampleLeft.ProgramSelector = Enumerators.ProgramSelect.CustomProgram;
            dataSampleLeft.SelectedSpeed = SelectedSpeed;
            dataSampleLeft.SelectedTorque = SelectedTorque;
            dataSampleLeft.SelectedDuration = SelectedDuration;
            dataSampleLeft.TimeRemaining = SelectedDuration;
            dataSampleLeft.SelectedDirection = SelectedDirection;
            dataSampleLeft.SampleTimerInterval = 100;
            dataSampleLeft.CapturePowerFlag = true;
            ThreadCallbackProcessFeedbackErrorLeft = dataSampleLeft.ProcessErrorSession;

            dataSampleRight.ProgramSelector = Enumerators.ProgramSelect.CustomProgram;
            dataSampleRight.SelectedSpeed = SelectedSpeed;
            dataSampleRight.SelectedTorque = SelectedTorque;
            dataSampleRight.SelectedDuration = SelectedDuration;
            dataSampleRight.TimeRemaining = SelectedDuration;
            dataSampleRight.SelectedDirection = SelectedDirection;
            dataSampleRight.SampleTimerInterval = 100;
            dataSampleRight.CapturePowerFlag = true;
            ThreadCallbackProcessFeedbackErrorRight = dataSampleRight.ProcessErrorSession;

            ResetData();

            isNewSession = true;
            this.StartPosition = FormStartPosition.CenterScreen;
            this.WindowState = FormWindowState.Normal;
            this.Focus();
        }
        //Form Reset Methods - Called everytime the form is shown
        private void ResetData(int DifficultyLevel, int Speed, int Torque, Enumerators.ProgramSelect ProgramSelect)
        {
            ChartPowerLeft.ResetData();
            ChartPowerRight.ResetData();

            DataSample = new objDataSample(GlobalVariables.leftSerialPort);
            DataSample.DifficultyLevel = DifficultyLevel;
            DataSample.SelectedSpeed = Speed;
            DataSample.SelectedTorque = Torque;
            DataSample.ProgramSelector = ProgramSelect;
            DataSample.CapturePowerFlag = false;
            if (DataSample.ProgramSelector == Enumerators.ProgramSelect.RehabBilateral || DataSample.ProgramSelector == Enumerators.ProgramSelect.RehabLeftLeg || DataSample.ProgramSelector == Enumerators.ProgramSelect.RehabRightLeg)
                DataSample.CapturePowerFlag = true;
            else
                DataSample.CapturePowerFlag = false;
            ThreadCallbackProcessFeedbackError = DataSample.ProcessErrorSession;

            torqueTankControl1.panelRightConcRef.Height = Convert.ToInt32(DataSample.SelectedTorque * torqueTankControl1.TankLevelMultiplier);
            torqueTankControl1.panelLeftConcRef.Height = Convert.ToInt32(DataSample.SelectedTorque * torqueTankControl1.TankLevelMultiplier);
            torqueTankControl1.panelRightEcceRef.Height = Convert.ToInt32(DataSample.SelectedTorque * torqueTankControl1.TankLevelMultiplier);
            torqueTankControl1.panelLeftEcceRef.Height = Convert.ToInt32(DataSample.SelectedTorque * torqueTankControl1.TankLevelMultiplier);
            torqueTankControl1.Invalidate();

            btnSkipStage.Visible = true;

            lblSetPrevious.Text = "-";
            lblTimePrevious.Text = "-";
        }
        //First Method called every time the form is displayed
        public void ActivateForm(int DifficultyLevel, int Speed, int Torque, Enumerators.ProgramSelect ProgramSelect)
        {
            this.StartPosition = FormStartPosition.CenterScreen;
            this.WindowState = FormWindowState.Normal;

            ResetData(DifficultyLevel, Speed, Torque, ProgramSelect);
            ReadXMLProgram();
            SetupGraphs();
            this.Focus();
            FormProgramOverview = new frmProgramOverview(CurrentVO2MaxProgram);
            FormProgramOverview.ShowDialog();
            InitiateSequence();
        }
Exemplo n.º 4
0
        public IOAE GetProcessor(Enumerators.Strategy strategy)
        {
            Dictionary<Enumerators.Strategy, IOAE> dic = new Dictionary<Enumerators.Strategy, IOAE>();
            dic.Add(Enumerators.Strategy.KB, kb);
            dic.Add(Enumerators.Strategy.JIT, jit);
            dic.Add(Enumerators.Strategy.JIT2, jit2);
            dic.Add(Enumerators.Strategy.ODP, odp);

            if (dic.ContainsKey(strategy))
            {
                return dic[strategy];
            }
            return null;
        }
Exemplo n.º 5
0
        //First Method called every time the form is displayed
        public void InitiateProgram(Enumerators.ProgramSelect ProgramSelect)
        {
            this.StartPosition = FormStartPosition.CenterScreen;
            this.WindowState = FormWindowState.Normal;

            DataSample = new objDataSample(GlobalVariables.leftSerialPort);
            DataSample.ProgramSelector = ProgramSelect;
            DataSample.SelectedSpeed = 65;
            DataSample.SelectedTorque = 250;
            ThreadCallbackProcessFeedbackError = DataSample.ProcessErrorSession;

            ResetData();
            CurrentProgram = DataSample.ReadXMLProgram();
            this.Focus();
            Start();
        }
        public frmTunkEcceLats(int SelectedSpeed, int SelectedTorque, double SelectedAngle, Enumerators.ProgramSelect TestMode)
        {
            InitializeComponent();
            this.Dock = DockStyle.Fill;
            this.Width = Screen.PrimaryScreen.Bounds.Width;
            this.Height = Screen.PrimaryScreen.Bounds.Height;

            DataSample = new Classes.TunkEcceLatsDS(GlobalVariables.leftSerialPort);
            DataSample.SelectedTorque = SelectedTorque;
            DataSample.ProgramSelector = TestMode;
            DataSample.DeltaTorqueAdjustment = 4;
            DataSample.DeltaTimeInterval = 500;
            testMode = TestMode;
            SetupStartParameters(SelectedSpeed, SelectedAngle, TestMode);

            lblTorqueLimit.Text = DataSample.SelectedTorque.ToString();

            AssignCallbackMethods();
        }
        /// <summary>
        /// Forms the global object with configurable data from Azure.
        /// </summary>
        /// <param name="resourceFile">The resource file containing Global Configurations details</param>
        /// <param name="jsonObject">JSON object which will have the data from resource file</param>
        /// <param name="resourceFileLocation">Location of resource file</param>
        /// <returns>
        /// JavaScript object as string
        /// </returns>
        public static string SetGlobalConfigurations(string resourceFile, string jsonObject, Enumerators.ResourceFileLocation resourceFileLocation)
        {
            StringBuilder scriptBuilder = new StringBuilder();
            try
            {
                if (!string.IsNullOrWhiteSpace(resourceFile) && !string.IsNullOrWhiteSpace(jsonObject))
                {
                    // Add the script tag                
                    scriptBuilder.Append("<script type=\"text/javascript\">var " + jsonObject + "={");
                    scriptBuilder.Append(GetResourceData(resourceFile, Convert.ToString(resourceFileLocation, CultureInfo.InvariantCulture)));
                    scriptBuilder.Append("};</script>");
                }
            }
            catch (Exception exception)
            {
                Logger.LogError(exception, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, UIConstantStrings.LogTableName);
            }

            return Convert.ToString(scriptBuilder, CultureInfo.InvariantCulture);
        }
        private void SetupStartParameters(int selectedSpeed, double selectedAngle, Enumerators.ProgramSelect testMode)
        {
            DataSample.SelectedSpeed = 3;

            switch (testMode)
            {
                case Enumerators.ProgramSelect.LatsEcceVar:
                    DataSample.SelectedStartAngle = selectedAngle * 2;
                    DataSample.SelectedSpeed = selectedSpeed;
                    break;
                case Enumerators.ProgramSelect.AbsEcceVar:
                    DataSample.SelectedStartAngle = selectedAngle * 2;
                    DataSample.SelectedSpeed = selectedSpeed;
                    break;
                case Enumerators.ProgramSelect.LatsEcce75:
                    DataSample.SelectedStartAngle = 75 * 2;
                    break;
                case Enumerators.ProgramSelect.LatsEcce65:
                    DataSample.SelectedStartAngle = 65 * 2;
                    break;
                case Enumerators.ProgramSelect.LatsEcce55:
                    DataSample.SelectedStartAngle = 55 * 2;
                    break;
                case Enumerators.ProgramSelect.AbsEcce75:
                    DataSample.SelectedStartAngle = 75 * 2;
                    break;
                case Enumerators.ProgramSelect.AbsEcce65:
                    DataSample.SelectedStartAngle = 65 * 2;
                    break;
                case Enumerators.ProgramSelect.AbsEcce55:
                    DataSample.SelectedStartAngle = 55 * 2;
                    break;
                default:
                    break;
            }
        }
Exemplo n.º 9
0
        protected virtual List<OrderTracer> GetOrderIss(string loc, Item item, DateTime? startTime, DateTime? endTime, Enumerators.TracerType tracerType)
        {
            if (Plans == null || Plans.Count == 0)
                return null;

            List<OrderTracer> orderTracerList = new List<OrderTracer>();
            foreach (var p in Plans)
            {
                if (Utilities.StringEq(p.Loc, loc) &&
                        (item != null && item.Equals(p.Item)) &&
                        (!startTime.HasValue || p.ReqTime >= startTime.Value) &&//greater equal
                        (!endTime.HasValue || p.ReqTime < endTime.Value) &&//less than
                        p.IRType == Enumerators.IRType.ISS &&
                        p.PlanType == Enumerators.PlanType.Orders &&
                        p.Status > 0)
                {
                    OrderTracer orderTracer = new OrderTracer();

                    orderTracer.TracerType = tracerType;
                    orderTracer.Code = p.OrderNo;
                    orderTracer.ReqTime = p.ReqTime;
                    orderTracer.Item = p.Item;
                    orderTracer.OrderedQty = p.OrderedQty;
                    orderTracer.FinishedQty = p.FinishedQty;
                    orderTracer.Qty = p.Qty;
                    orderTracer.RefOrderLocTransId = p.ID;
                    orderTracer.Location = p.Loc;
                    orderTracer.str1 = p.str1;
                    orderTracer.str2 = p.str2;
                    orderTracer.str3 = p.str3;
                    orderTracer.str4 = p.str4;
                    orderTracer.str5 = p.str5;
                    orderTracer.str6 = p.str6;
                    orderTracer.str7 = p.str7;
                    orderTracer.str8 = p.str8;
                    orderTracer.str9 = p.str9;
                    orderTracer.int1 = p.int1;
                    orderTracer.int2 = p.int2;
                    orderTracer.int3 = p.int3;
                    orderTracer.int4 = p.int4;
                    orderTracer.int5 = p.int5;
                    orderTracer.dec1 = p.dec1;
                    orderTracer.dec2 = p.dec2;
                    orderTracer.dec3 = p.dec3;
                    orderTracer.dec4 = p.dec4;
                    orderTracer.dec5 = p.dec5;
                    orderTracerList.Add(orderTracer);
                }
            }
            return orderTracerList;
        }
Exemplo n.º 10
0
 public static void OneFrameDelay(this MonoBehaviour mb, Action action)
 {
     mb.StartCoroutine(Enumerators.addframedelay(action));
 }
        public override void ProcessParagraphUnit(IParagraphUnit paragraphUnit)
        {
            if (paragraphUnit.IsStructure || !paragraphUnit.SegmentPairs.Any())
            {
                return;
            }

            var transUnit = new TransUnit
            {
                Id = paragraphUnit.Properties.ParagraphUnitId.Id
            };

            var file = GetFileContainer(paragraphUnit);

            UpdateContexts(file, paragraphUnit, transUnit);

            foreach (var segmentPair in paragraphUnit.SegmentPairs)
            {
                SegmentPairInfo segmentPairInfo = null;
                try
                {
                    segmentPairInfo = SegmentPairProcessor.GetSegmentPairInfo(segmentPair);
                }
                catch
                {
                    // catch all; ignore
                }

                var status = segmentPair.Properties.ConfirmationLevel.ToString();
                var match  = Enumerators.GetTranslationOriginType(segmentPair.Target.Properties.TranslationOrigin, _analysisBands);

                if (_exportOptions.ExcludeFilterIds != null)
                {
                    if ((segmentPair.Properties.IsLocked && _exportOptions.ExcludeFilterIds.Exists(a => a == "Locked")) ||
                        _exportOptions.ExcludeFilterIds.Exists(a => a == status) ||
                        _exportOptions.ExcludeFilterIds.Exists(a => a == match))
                    {
                        AddWordExcludedCounts(status, segmentPairInfo, match);
                        continue;
                    }
                }

                SegmentVisitor.VisitSegment(segmentPair.Source);
                if (SegmentVisitor.HasRevisions)
                {
                    //throw new Exception(PluginResources.Message_UnableToProcessFileWithTrackChanges +
                    //Environment.NewLine +
                    //PluginResources.Message_AccecptRejectTrackChangesBeforeExporting);
                }

                var sourceElements = SegmentVisitor.Elements;
                if (SegmentVisitor.Comments.Count > 0)
                {
                    foreach (var comment in SegmentVisitor.Comments)
                    {
                        if (!Xliff.DocInfo.Comments.ContainsKey(comment.Key))
                        {
                            Xliff.DocInfo.Comments.Add(comment.Key, comment.Value);
                        }
                    }
                }
                UpdateTagIds();

                if (segmentPair.Target?.Count == 0 && _exportOptions.CopySourceToTarget)
                {
                    segmentPair.Target.Clear();

                    foreach (var sourceElement in segmentPair.Source)
                    {
                        segmentPair.Target.Add(sourceElement.Clone() as IAbstractMarkupData);
                    }
                }

                SegmentVisitor.VisitSegment(segmentPair.Target);
                if (SegmentVisitor.HasRevisions)
                {
                    //throw new Exception(PluginResources.Message_UnableToProcessFileWithTrackChanges +
                    //Environment.NewLine +
                    //PluginResources.Message_AccecptRejectTrackChangesBeforeExporting);
                }
                var targetElements = SegmentVisitor.Elements;
                if (SegmentVisitor.Comments.Count > 0)
                {
                    foreach (var comment in SegmentVisitor.Comments)
                    {
                        if (!Xliff.DocInfo.Comments.ContainsKey(comment.Key))
                        {
                            Xliff.DocInfo.Comments.Add(comment.Key, comment.Value);
                        }
                    }
                }
                UpdateTagIds();

                var newSegmentPair = new SegmentPair(_segmentBuilder)
                {
                    Id     = segmentPair.Properties.Id.Id,
                    Source = new Source {
                        Elements = sourceElements
                    },
                    Target = new Target {
                        Elements = targetElements
                    },
                    IsLocked          = segmentPair.Properties.IsLocked,
                    ConfirmationLevel = segmentPair.Properties.ConfirmationLevel,
                    TranslationOrigin = segmentPair.Properties.TranslationOrigin
                };
                transUnit.SegmentPairs.Add(newSegmentPair);

                AddWordProcessedCounts(status, segmentPairInfo, match);
            }

            if (transUnit.SegmentPairs.Count > 0)
            {
                file.Body.TransUnits.Add(transUnit);
            }
        }
Exemplo n.º 12
0
 protected virtual decimal GetInvBalance(string loc, Item item, Enumerators.InvType invType)
 {
     return InvBalances.Where(i =>
        Utilities.StringEq(loc, i.Loc) &&
        (item != null && item.Equals(i.Item)) &&
        invType == i.InvType)
        .Sum(i => i.Qty);
 }
Exemplo n.º 13
0
        public static object FindControlInTableByCustom(Table tbl, string strCustomAttribute, string strToFind,
                                                          Enumerators.ControlType ctrl)
        {
            if (ctrl == Enumerators.ControlType.Span)
            {
                Span sp = tbl.Span(Find.By(strCustomAttribute, strToFind));
                Assert.IsTrue(sp.Exists, "Could not Find: " + strToFind);
                return sp;
            }
            else if (ctrl == Enumerators.ControlType.Link)
            {
                Link lnk = tbl.Link(Find.By(strCustomAttribute, strToFind));
                Assert.IsTrue(lnk.Exists, "Could not Find: " + strToFind);
                return lnk;
            }
            else if (ctrl == Enumerators.ControlType.Image)
            {
                Image img;

                if (strCustomAttribute == "src")
                {
                    img = tbl.Image(Find.BySrc(strToFind));
                }
                else
                {
                    img = tbl.Image(Find.By(strCustomAttribute, strToFind));
                }
                Assert.IsTrue(img.Exists, "Could not Find: " + strToFind);
                return img;
            }
            else if (ctrl == Enumerators.ControlType.TableCell)
            {
                TableCell tCell = tbl.TableCell(Find.By(strCustomAttribute, strToFind));
                Assert.IsTrue(tCell.Exists, "Could not Find: " + strToFind);
                return tCell;
            }
            else if (ctrl == Enumerators.ControlType.Table)
            {
                Table nestedTbl = tbl.Table(Find.By(strCustomAttribute, strToFind));
                Assert.IsTrue(nestedTbl.Exists, "Could not Find: " + strToFind);
                return nestedTbl;
            }
            else if (ctrl == Enumerators.ControlType.TableRow)
            {
                TableRow row = tbl.TableRow(Find.By(strCustomAttribute, strToFind));
                Assert.IsTrue(row.Exists, "Could not Find: " + strToFind);
                return row;
            }
            else if (ctrl == Enumerators.ControlType.CheckBox)
            {
                CheckBox chk = tbl.CheckBox(Find.By(strCustomAttribute, strToFind));
                Assert.IsTrue(chk.Exists, "Could not Find: " + strToFind);
                return chk;
            }
            else if (ctrl == Enumerators.ControlType.Button)
            {
                Button btn = tbl.Button(Find.By(strCustomAttribute, strToFind));
                Assert.IsTrue(btn.Exists, "Could not Find: " + strToFind);
                return btn;
            }
            else if (ctrl == Enumerators.ControlType.TextField)
            {
                TextField txt = tbl.TextField(Find.By(strCustomAttribute, strToFind));
                Assert.IsTrue(txt.Exists, "Could not Find: " + strToFind);
                return txt;
            }
            else if (ctrl == Enumerators.ControlType.SelectList)
            {
                SelectList sList = tbl.SelectList(Find.By(strCustomAttribute, strToFind));
                Assert.IsTrue(sList.Exists, "Could not Find: " + strToFind);
                return sList;
            }
            else if (ctrl == Enumerators.ControlType.Div)
            {
                Div div = tbl.Div(Find.By(strCustomAttribute, strToFind));
                Assert.IsTrue(div.Exists, "Could not Find: " + strToFind);
                return div;
            }
            else
            {
                return null;
            }
        }
Exemplo n.º 14
0
 public static object FindControlInFrameByID(Frame frame, string strID, Enumerators.ControlType ctrl)
 {
     if (ctrl == Enumerators.ControlType.Span)
     {
         Span sp = frame.Span(Find.ById(strID));
         Assert.IsTrue(sp.Exists, "Could not Find: " + strID);
         return sp;
     }
     else if (ctrl == Enumerators.ControlType.Link)
     {
         Link lnk = frame.Link(Find.ById(strID));
         Assert.IsTrue(lnk.Exists, "Could not Find: " + strID);
         return lnk;
     }
     else if (ctrl == Enumerators.ControlType.Image)
     {
         Image img = frame.Image(Find.BySrc(strID));
         Assert.IsTrue(img.Exists, "Could not Find: " + strID);
         return img;
     }
     else if (ctrl == Enumerators.ControlType.TableCell)
     {
         TableCell tCell = frame.TableCell(Find.ById(strID));
         Assert.IsTrue(tCell.Exists, "Could not Find: " + strID);
         return tCell;
     }
     else if (ctrl == Enumerators.ControlType.Table)
     {
         Table nestedTbl = frame.Table(Find.ById(strID));
         Assert.IsTrue(nestedTbl.Exists, "Could not Find: " + strID);
         return nestedTbl;
     }
     else if (ctrl == Enumerators.ControlType.CheckBox)
     {
         CheckBox chk = frame.CheckBox(Find.ById(strID));
         Assert.IsTrue(chk.Exists, "Could not Find: " + strID);
         return chk;
     }
     else if (ctrl == Enumerators.ControlType.Button)
     {
         Button btn = frame.Button(Find.ById(strID));
         Assert.IsTrue(btn.Exists, "Could not Find: " + strID);
         return btn;
     }
     else if (ctrl == Enumerators.ControlType.TextField)
     {
         TextField txt = frame.TextField(Find.ById(strID));
         Assert.IsTrue(txt.Exists, "Could not Find: " + strID);
         return txt;
     }
     else if (ctrl == Enumerators.ControlType.Div)
     {
         Div division = frame.Div(Find.ById(strID));
         Assert.IsTrue(division.Exists, "Could not Find: " + strID);
         return division;
     }
     else if (ctrl == Enumerators.ControlType.TableRow)
     {
         TableRow tRow = frame.TableRow(Find.ById(strID));
         Assert.IsTrue(tRow.Exists, "Could not Find: " + strID);
         return tRow;
     }
     else
     {
         return null;
     }
 }
Exemplo n.º 15
0
        public override void ProcessParagraphUnit(IParagraphUnit paragraphUnit)
        {
            if (paragraphUnit.IsStructure)
            {
                base.ProcessParagraphUnit(paragraphUnit);
                return;
            }

            foreach (var segmentPair in paragraphUnit.SegmentPairs)
            {
                SegmentPairInfo segmentPairInfo = null;
                try
                {
                    segmentPairInfo = SegmentPairProcessor.GetSegmentPairInfo(segmentPair);
                }
                catch
                {
                    // catch all; ignore
                }

                var status = segmentPair.Properties.ConfirmationLevel.ToString();
                var match  = Enumerators.GetTranslationOriginType(segmentPair.Target.Properties.TranslationOrigin, _analysisBands);

                var targetSegment = segmentPair.Target;

                //capture if segment contains tracked changes
                //var hasTrackedChanges = false;

                var segmentIdentifier = string.Empty;
                var updatedSegment    = GetUpdatedSegmentContent(paragraphUnit.Properties.ParagraphUnitId.Id,
                                                                 segmentPair.Properties.Id.Id, ref segmentIdentifier);

                if (updatedSegment != null)
                {
                    var canOverwriteTranslation      = _importOptions.OverwriteTranslations || !segmentPair.Target.Any();
                    var canOverwriteBackTranslations = _importOptions.OverwriteTranslations ||
                                                       segmentPair.Target.Properties.TranslationOrigin == null ||
                                                       !segmentPair.Target.Properties.TranslationOrigin.MetaDataContainsKey("back-translation") ||
                                                       string.IsNullOrEmpty(segmentPair.Target.Properties.TranslationOrigin.GetMetaData("back-translation"));

                    var excludeFilter = false;
                    if (_importOptions.ExcludeFilterIds != null)
                    {
                        excludeFilter = (segmentPair.Properties.IsLocked && _importOptions.ExcludeFilterIds.Exists(a => a == "Locked")) ||
                                        _importOptions.ExcludeFilterIds.Exists(a => a == status) ||
                                        _importOptions.ExcludeFilterIds.Exists(a => a == match);
                    }

                    if (excludeFilter || (!canOverwriteTranslation && !canOverwriteBackTranslations))
                    {
                        if (!string.IsNullOrEmpty(_importOptions.StatusTranslationNotUpdatedId))
                        {
                            var success = Enum.TryParse <ConfirmationLevel>(_importOptions.StatusTranslationNotUpdatedId, true, out var result);
                            var statusTranslationNotUpdated = success ? result : ConfirmationLevel.Unspecified;

                            segmentPair.Target.Properties.ConfirmationLevel = statusTranslationNotUpdated;
                            segmentPair.Properties.ConfirmationLevel        = statusTranslationNotUpdated;

                            status = segmentPair.Properties.ConfirmationLevel.ToString();
                            match  = Enumerators.GetTranslationOriginType(segmentPair.Target.Properties.TranslationOrigin, _analysisBands);
                        }

                        AddWordExcludedCounts(status, segmentPairInfo, match);

                        continue;
                    }

                    var tokenVisitor = new TokenVisitor();
                    tokenVisitor.VisitSegment(targetSegment);
                    var originalText = tokenVisitor.PlainText.ToString();

                    try
                    {
                        if (segmentPair.Target.Properties.TranslationOrigin == null)
                        {
                            targetSegment.Properties.TranslationOrigin = _segmentBuilder.ItemFactory.CreateTranslationOrigin();
                        }

                        if (canOverwriteTranslation)
                        {
                            var currentTranslationOrigin = (ITranslationOrigin)targetSegment.Properties.TranslationOrigin.Clone();
                            targetSegment.Properties.TranslationOrigin.OriginBeforeAdaptation = currentTranslationOrigin;

                            SetTranslationOrigin(targetSegment);

                            if (updatedSegment.TranslationTokens.Count > 0)
                            {
                                targetSegment = _segmentBuilder.GetUpdatedSegment(targetSegment,
                                                                                  updatedSegment.TranslationTokens, segmentPair.Source);
                            }
                        }

                        if (canOverwriteBackTranslations && updatedSegment.BackTranslationTokens.Count > 0)
                        {
                            var backTranslations = JsonConvert.SerializeObject(updatedSegment.BackTranslationTokens);
                            segmentPair.Target.Properties.TranslationOrigin.SetMetaData("back-translation", backTranslations);
                        }

                        if (!canOverwriteTranslation)
                        {
                            if (!string.IsNullOrEmpty(_importOptions.StatusTranslationNotUpdatedId))
                            {
                                var success = Enum.TryParse <ConfirmationLevel>(_importOptions.StatusTranslationNotUpdatedId, true, out var result);
                                var statusTranslationNotUpdated = success ? result : ConfirmationLevel.Unspecified;

                                segmentPair.Target.Properties.ConfirmationLevel = statusTranslationNotUpdated;
                                segmentPair.Properties.ConfirmationLevel        = statusTranslationNotUpdated;

                                status = segmentPair.Properties.ConfirmationLevel.ToString();
                                match  = Enumerators.GetTranslationOriginType(segmentPair.Target.Properties.TranslationOrigin, _analysisBands);
                            }

                            AddWordExcludedCounts(status, segmentPairInfo, match);
                            continue;
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("Problem when merging content of segment " + segmentPair.Properties.Id.Id, ex);
                    }

                    tokenVisitor.Process(targetSegment);
                    var updatedText = tokenVisitor.PlainText.ToString();

                    if (string.Compare(originalText, updatedText, StringComparison.Ordinal) != 0)
                    {
                        if (!string.IsNullOrEmpty(_importOptions.StatusTranslationUpdatedId))
                        {
                            var success = Enum.TryParse <ConfirmationLevel>(_importOptions.StatusTranslationUpdatedId, true,
                                                                            out var result);
                            var statusTranslationUpdated = success ? result : ConfirmationLevel.Unspecified;

                            targetSegment.Properties.ConfirmationLevel = statusTranslationUpdated;
                            segmentPair.Properties.ConfirmationLevel   = statusTranslationUpdated;

                            status = segmentPair.Properties.ConfirmationLevel.ToString();
                            match  = Enumerators.GetTranslationOriginType(segmentPair.Target.Properties.TranslationOrigin, _analysisBands);
                        }

                        AddWordProcessedCounts(status, segmentPairInfo, match);
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(_importOptions.StatusTranslationNotUpdatedId))
                        {
                            var success = Enum.TryParse <ConfirmationLevel>(_importOptions.StatusTranslationNotUpdatedId, true, out var result);
                            var statusTranslationNotUpdated = success ? result : ConfirmationLevel.Unspecified;

                            targetSegment.Properties.ConfirmationLevel = statusTranslationNotUpdated;
                        }

                        status = targetSegment.Properties.ConfirmationLevel.ToString();
                        match  = Enumerators.GetTranslationOriginType(targetSegment.Properties.TranslationOrigin, _analysisBands);

                        AddWordExcludedCounts(status, segmentPairInfo, match);
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(_importOptions.StatusSegmentNotImportedId))
                    {
                        var success = Enum.TryParse <ConfirmationLevel>(_importOptions.StatusTranslationNotUpdatedId, true, out var result);
                        var statusTranslationNotUpdated = success ? result : ConfirmationLevel.Unspecified;

                        segmentPair.Target.Properties.ConfirmationLevel = statusTranslationNotUpdated;
                        segmentPair.Properties.ConfirmationLevel        = statusTranslationNotUpdated;

                        status = segmentPair.Properties.ConfirmationLevel.ToString();
                        match  = Enumerators.GetTranslationOriginType(segmentPair.Target.Properties.TranslationOrigin, _analysisBands);
                    }

                    AddWordNotProcessedCounts(status, segmentPairInfo, match);
                }
            }

            base.ProcessParagraphUnit(paragraphUnit);
        }
 void MoveEnumerator() => CurrentEnumerator = Enumerators.Dequeue();
Exemplo n.º 17
0
        private void UpdateTranslationOrigin(ISegment originalTarget, ISegment targetSegment, SegmentPairInfo segmentPairInfo, SegmentPair importedSegmentPair)
        {
            SegmentVisitor.VisitSegment(originalTarget);
            var originalText = SegmentVisitor.Text;

            SegmentVisitor.VisitSegment(targetSegment);
            var updatedText = SegmentVisitor.Text;

            if (string.Compare(originalText, updatedText, StringComparison.Ordinal) != 0)
            {
                if (!string.IsNullOrEmpty(_importOptions.StatusTranslationUpdatedId))
                {
                    if (targetSegment.Properties.TranslationOrigin == null)
                    {
                        targetSegment.Properties.TranslationOrigin = importedSegmentPair.TranslationOrigin;
                    }

                    if (targetSegment.Properties.TranslationOrigin != null)
                    {
                        var currentTranslationOrigin = (ITranslationOrigin)targetSegment.Properties.TranslationOrigin.Clone();
                        targetSegment.Properties.TranslationOrigin.OriginBeforeAdaptation = currentTranslationOrigin;
                    }
                    else
                    {
                        targetSegment.Properties.TranslationOrigin = _segmentBuilder.CreateTranslationOrigin();
                    }

                    SetTranslationOrigin(targetSegment);

                    var success = Enum.TryParse <ConfirmationLevel>(_importOptions.StatusTranslationUpdatedId, true, out var result);
                    var statusTranslationUpdated = success ? result : importedSegmentPair.ConfirmationLevel;

                    targetSegment.Properties.ConfirmationLevel = statusTranslationUpdated;
                    targetSegment.Properties.IsLocked          = importedSegmentPair.IsLocked;
                }
                else
                {
                    targetSegment.Properties.TranslationOrigin = importedSegmentPair.TranslationOrigin;
                    targetSegment.Properties.IsLocked          = importedSegmentPair.IsLocked;
                    targetSegment.Properties.ConfirmationLevel = importedSegmentPair.ConfirmationLevel;
                }

                var status = targetSegment.Properties.ConfirmationLevel.ToString();
                var match  = Enumerators.GetTranslationOriginType(targetSegment.Properties.TranslationOrigin, _analysisBands);

                AddWordProcessedCounts(status, segmentPairInfo, match);
            }
            else
            {
                if (!string.IsNullOrEmpty(_importOptions.StatusTranslationNotUpdatedId))
                {
                    var success = Enum.TryParse <ConfirmationLevel>(_importOptions.StatusTranslationNotUpdatedId, true, out var result);
                    var statusTranslationNotUpdated = success ? result : importedSegmentPair.ConfirmationLevel;

                    targetSegment.Properties.ConfirmationLevel = statusTranslationNotUpdated;
                }
                else
                {
                    targetSegment.Properties.ConfirmationLevel = importedSegmentPair.ConfirmationLevel;
                }

                targetSegment.Properties.TranslationOrigin = importedSegmentPair.TranslationOrigin;
                targetSegment.Properties.IsLocked          = importedSegmentPair.IsLocked;

                var status = targetSegment.Properties.ConfirmationLevel.ToString();
                var match  = Enumerators.GetTranslationOriginType(targetSegment.Properties.TranslationOrigin, _analysisBands);

                AddWordExcludedCounts(status, segmentPairInfo, match);
            }
        }
Exemplo n.º 18
0
 protected void SetForumLockState(int forumid,Enumerators.PostStatus lockstatus)
 {
     Forums.SetForumStatus(forumid, (int)lockstatus);
     Response.Redirect(Request.RawUrl);
 }
Exemplo n.º 19
0
 /// <summary>
 /// Get the value corresponding to specified key from specified resource file
 /// </summary>
 /// <param name="fileName">Name of the resource file</param>
 /// <param name="keyName">Name of the key</param>
 /// <param name="resourceFileLocation">Resource file location</param>
 /// <returns>
 /// Value of the key
 /// </returns>
 public static string GetConfigurationFromResourceFile(string fileName, string keyName, Enumerators.ResourceFileLocation resourceFileLocation)
 {
     string resourceValue = string.Empty;
     ResXResourceReader resxReader = null;
     try
     {
         resxReader = new ResXResourceReader(HttpContext.Current.Server.MapPath(@"~/" + resourceFileLocation + ConstantStrings.ForwardSlash + fileName + ConstantStrings.ResourceFileExtension));
         ResourceSet resourceSet = new ResourceSet(resxReader);
         resourceValue = resourceSet.GetString(keyName);
     }
     catch (Exception exception)
     {
         Logger.LogError(exception, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, ConstantStrings.LogTableName);
     }
     finally
     {
         resxReader.Close();
     }
     return resourceValue;
 }
Exemplo n.º 20
0
        public override void ProcessParagraphUnit(IParagraphUnit paragraphUnit)
        {
            if (paragraphUnit.IsStructure || !paragraphUnit.SegmentPairs.Any())
            {
                base.ProcessParagraphUnit(paragraphUnit);
                return;
            }

            var importedTransUnit = GetTransUnit(paragraphUnit);

            if (importedTransUnit == null)
            {
                if (!string.IsNullOrEmpty(_importOptions.StatusSegmentNotImportedId))
                {
                    var success = Enum.TryParse <ConfirmationLevel>(_importOptions.StatusSegmentNotImportedId, true, out var result);
                    var statusSegmentNotImported = success ? result : ConfirmationLevel.Unspecified;

                    foreach (var segmentPair in paragraphUnit.SegmentPairs)
                    {
                        SegmentPairInfo segmentPairInfo = null;
                        try
                        {
                            segmentPairInfo = SegmentPairProcessor.GetSegmentPairInfo(segmentPair);
                        }
                        catch
                        {
                            // catch all; ignore
                        }

                        segmentPair.Target.Properties.ConfirmationLevel = statusSegmentNotImported;

                        var status = segmentPair.Properties.ConfirmationLevel.ToString();
                        var match  = Enumerators.GetTranslationOriginType(segmentPair.Target.Properties.TranslationOrigin, _analysisBands);

                        AddWordNotProcessedCounts(status, segmentPairInfo, match);
                    }
                }

                base.ProcessParagraphUnit(paragraphUnit);
                return;
            }

            if (importedTransUnit.Contexts.Count > 0)
            {
                var contexts = paragraphUnit.Properties.Contexts.Contexts;
                foreach (var importContext in importedTransUnit.Contexts)
                {
                    var existingContext = contexts.FirstOrDefault(a =>
                                                                  string.Compare(a.ContextType, importContext.ContextType, StringComparison.CurrentCultureIgnoreCase) == 0 &&
                                                                  string.Compare(a.DisplayCode, importContext.DisplayCode, StringComparison.CurrentCultureIgnoreCase) == 0 &&
                                                                  string.Compare(a.DisplayName, importContext.DisplayName, StringComparison.CurrentCultureIgnoreCase) == 0 &&
                                                                  string.Compare(a.Description, importContext.Description, StringComparison.CurrentCultureIgnoreCase) == 0);

                    if (existingContext == null)
                    {
                        var newContext = _segmentBuilder.CreateContextInfo(importContext);
                        contexts.Add(newContext);
                    }
                }
            }

            foreach (var segmentPair in paragraphUnit.SegmentPairs)
            {
                SegmentPairInfo segmentPairInfo = null;
                try
                {
                    segmentPairInfo = SegmentPairProcessor.GetSegmentPairInfo(segmentPair);
                }
                catch
                {
                    // catch all; ignore
                }

                var importedSegmentPair = importedTransUnit.SegmentPairs.FirstOrDefault(a => a.Id == segmentPair.Properties.Id.Id);
                if (importedSegmentPair == null)
                {
                    if (!string.IsNullOrEmpty(_importOptions.StatusSegmentNotImportedId))
                    {
                        var success = Enum.TryParse <ConfirmationLevel>(_importOptions.StatusSegmentNotImportedId, true, out var result);
                        var statusSegmentNotImported = success ? result : ConfirmationLevel.Unspecified;

                        segmentPair.Target.Properties.ConfirmationLevel = statusSegmentNotImported;
                    }

                    var status = segmentPair.Properties.ConfirmationLevel.ToString();
                    var match  = Enumerators.GetTranslationOriginType(segmentPair.Target.Properties.TranslationOrigin, _analysisBands);

                    AddWordNotProcessedCounts(status, segmentPairInfo, match);

                    continue;
                }

                var noOverwrite   = !_importOptions.OverwriteTranslations && segmentPair.Target.Any();
                var excludeFilter = false;
                if (_importOptions.ExcludeFilterIds?.Count > 0)
                {
                    var status = segmentPair.Properties.ConfirmationLevel.ToString();
                    var match  = Enumerators.GetTranslationOriginType(segmentPair.Target.Properties.TranslationOrigin, _analysisBands);

                    excludeFilter = (segmentPair.Properties.IsLocked && _importOptions.ExcludeFilterIds.Exists(a => a == "Locked")) ||
                                    _importOptions.ExcludeFilterIds.Exists(a => a == status) ||
                                    _importOptions.ExcludeFilterIds.Exists(a => a == match);
                }

                if (noOverwrite || excludeFilter)
                {
                    if (!string.IsNullOrEmpty(_importOptions.StatusTranslationNotUpdatedId))
                    {
                        var success = Enum.TryParse <ConfirmationLevel>(_importOptions.StatusTranslationNotUpdatedId, true, out var result);
                        var statusTranslationNotUpdated = success ? result : ConfirmationLevel.Unspecified;

                        segmentPair.Target.Properties.ConfirmationLevel = statusTranslationNotUpdated;
                    }
                    else
                    {
                        segmentPair.Target.Properties.ConfirmationLevel = importedSegmentPair.ConfirmationLevel;
                    }

                    var status = segmentPair.Properties.ConfirmationLevel.ToString();
                    var match  = Enumerators.GetTranslationOriginType(segmentPair.Target.Properties.TranslationOrigin, _analysisBands);

                    AddWordExcludedCounts(status, segmentPairInfo, match);

                    continue;
                }

                UpdateTargetSegment(segmentPair, importedSegmentPair, segmentPairInfo);
            }

            base.ProcessParagraphUnit(paragraphUnit);
        }
Exemplo n.º 21
0
 private Lambda(ExpressionNodeInfo info, SimpleLambdaExpressionSyntax node)
     : this(info.SetKind(ExprKind.LAMBDA), node.Body, Enumerators.Singleton(node.Parameter))
 {
 }
 public abstract void Read(TSisStream aFile, Int64 aContainerSize, Enumerators.TFieldType aArrayType);
Exemplo n.º 23
0
 public static object FindControlInBrowserByID(IE ie, string strID, Enumerators.ControlType ctrl)
 {
     if (ctrl == Enumerators.ControlType.Span)
     {
         Span sp = ie.Span(Find.ById(strID));
         Assert.IsTrue(sp.Exists, "Could not Find: " + strID);
         return sp;
     }
     else if (ctrl == Enumerators.ControlType.Link)
     {
         Link lnk = ie.Link(Find.ById(strID));
         Assert.IsTrue(lnk.Exists, "Could not Find: " + strID);
         return lnk;
     }
     else if (ctrl == Enumerators.ControlType.Frame)
     {
         Frame iFrame = ie.Frame(Find.ById(strID));
         return iFrame;
     }
     else if (ctrl == Enumerators.ControlType.Image)
     {
         Image img = ie.Image(Find.ById(strID));
         Assert.IsTrue(img.Exists, "Could not Find: " + strID);
         return img;
     }
     else if (ctrl == Enumerators.ControlType.TableCell)
     {
         TableCell tCell = ie.TableCell(Find.ById(strID));
         Assert.IsTrue(tCell.Exists, "Could not Find: " + strID);
         return tCell;
     }
     else if (ctrl == Enumerators.ControlType.Table)
     {
         Table tbl = ie.Table(Find.ById(strID));
         Assert.IsTrue(tbl.Exists, "Could not Find: " + strID);
         return tbl;
     }
     else if (ctrl == Enumerators.ControlType.TableRow)
     {
         TableRow row = ie.TableRow(Find.ById(strID));
         Assert.IsTrue(row.Exists, "Could not Find: " + strID);
         return row;
     }
     else if (ctrl == Enumerators.ControlType.CheckBox)
     {
         CheckBox chk = ie.CheckBox(Find.ById(strID));
         Assert.IsTrue(chk.Exists, "Could not Find: " + strID);
         return chk;
     }
     else if (ctrl == Enumerators.ControlType.Button)
     {
         Button btn = ie.Button(Find.ById(strID));
         Assert.IsTrue(btn.Exists, "Could not Find: " + strID);
         return btn;
     }
     else if (ctrl == Enumerators.ControlType.TextField)
     {
         TextField txt = ie.TextField(Find.ById(strID));
         Assert.IsTrue(txt.Exists, "Could not Find: " + strID);
         return txt;
     }
     else if (ctrl == Enumerators.ControlType.SelectList)
     {
         SelectList sList = ie.SelectList(Find.ById(strID));
         Assert.IsTrue(sList.Exists, "Could not Find: " + strID);
         return sList;
     }
     else if (ctrl == Enumerators.ControlType.Div)
     {
         Div division = ie.Div(Find.ById(strID));
         Assert.IsTrue(division.Exists, "Could not Find: " + strID);
         return division;
     }
     else if (ctrl == Enumerators.ControlType.TableRow)
     {
         TableRow tRow = ie.TableRow(Find.ById(strID));
         Assert.IsTrue(tRow.Exists, "Could not Find: " + strID);
         return tRow;
     }
     else if (ctrl == Enumerators.ControlType.FileUpload)
     {
         FileUpload fileUpload = ie.FileUpload(Find.ById(strID));
         Assert.IsTrue(fileUpload.Exists, "Could not find: " + strID);
         return fileUpload;
     }
     else
     {
         return null;
     }
 }
 //Control Logic - Show Generic Programs Form
 private void ShowfrmPrograms(Enumerators.ProgramSelect ProgramSelector)
 {
     GlobalVariables.FormCollection.FormVO2MaxPrograms.ActivateForm(0, SelectedSpeed, SelectedTorque, ProgramSelector);
 }
Exemplo n.º 25
0
    // Start is called before the first frame update
    void Start()
    {
        // Properties p = new Properties();
        // p.Hours = 30;
        // Debug.Log(p.Minutes); // 1800
        // p.Minutes = 30;
        // Debug.Log(p.Hours); // 0.5

        // StaticFields.monChamp = 10;

        // Singleton.Instance.groupName = "New name";
        // Singleton.Instance.nbGroup = 42;

        // MethodOverloading mo = new MethodOverloading();
        // mo.text("Hello world !!");

        // Debug.Log(mo.text());

        // ParentClass c1 = new ParentClass("Jean", 42, 20);
        // ParentClass c2 = new ChildClass("Marion", 45, 17, 15);

        // c1.attack(c2);

        // Debug.Log(c1.getHp()); // 20
        // Debug.Log(c2.getHp()); // 12

        // c2.attack(c1);
        // Debug.Log(c1.getHp()); // 13
        // Debug.Log(c2.getHp()); // 12
        // Debug.Log(((ChildClass)c2).getMp()); // 13

        // Group<User> userGroup = new Group<User>();

        // Female female = new Female();
        // userGroup.AddUser(female);
        // Male male = new Male();
        // userGroup.AddUser(male);
        // User user = new User();
        // userGroup.AddUser(user);

        // foreach(User u in userGroup.GetList())
        // {
        //     Debug.Log(u.SelfDescribe());
        // }

        // MemberHiding.ParentClass parent = new MemberHiding.ParentClass();
        // MemberHiding.ParentClass child = new MemberHiding.ChildClass();

        // Debug.Log(parent.Name);
        // Debug.Log(child.Name);

        // IMyInterface attacker = new Attacker();

        // attacker.Attack();

        Enumerators enumerators = new Enumerators();
        IEnumerator enumerator  = enumerators.myEnumerator();

        while (true)
        {
            if (enumerator.MoveNext())
            {
                Debug.Log(enumerator.Current);
            }
            else
            {
                break;
            }
        }
    }
        public objServoResult InitiateMotorForce(int SelectedSpeed, int SelectedForce, Enumerators.Direction SelectedDirection, ISerialPortIo serialPort)
        {
            int SpeedRefVal = Convert.ToInt32(Math.Round(Convert.ToDouble(SelectedSpeed) * CalibrationSettings.Default.GearRatio, 0));
            double SelectedTorque = SelectedForce * CalibrationSettings.Default.SprocketRadius;
            int TorqueRefVal = GlobalFunctions.ConvertToTorqueRefVal(SelectedTorque);

            ServoResult.IsSuccess = true;       //Explicitrly Set the IsSuccess to true

            if (SelectedDirection == Enumerators.Direction.None)
            {
                return ServoResult;
            }
            else if (SelectedDirection == Enumerators.Direction.Forward)
            {
                GlobalVariables.leftSerialPort.MotorDirection = 1;  //For Serial Port Faking (Forward)
                GlobalVariables.rightSerialPort.MotorDirection = 1; //For Serial Port Faking (Forward)

                if (SerialMotorControl.WriteSingleRegister(238, 17, serialPort) == false)       //10001 / 17 (Old value was 31)
                    if (SerialMotorControl.WriteSingleRegister(238, 17, serialPort) == false)
                        ServoResult.IsSuccess = false;
            }
            else if (SelectedDirection == Enumerators.Direction.Backward)
            {
                GlobalVariables.leftSerialPort.MotorDirection = 2;  //For Serial Port Faking (Reverse)
                GlobalVariables.rightSerialPort.MotorDirection = 2; //For Serial Port Faking (Reverse)

                if (SerialMotorControl.WriteSingleRegister(238, 16, serialPort) == false)       //10000 / 16 (Old value was 30)
                    if (SerialMotorControl.WriteSingleRegister(238, 16, serialPort) == false)
                        ServoResult.IsSuccess = false;
            }

            //Set Motor Torque Forward
            if (ServoResult.IsSuccess == true)
                if (SerialMotorControl.WriteSingleRegister(166, (UInt16)TorqueRefVal, serialPort) == false)
                    if (SerialMotorControl.WriteSingleRegister(166, (UInt16)TorqueRefVal, serialPort) == false)
                        ServoResult.IsSuccess = false;

            //Set Motor Torque Reverse
            if (ServoResult.IsSuccess == true)
                if (SerialMotorControl.WriteSingleRegister(168, (UInt16)TorqueRefVal, serialPort) == false)
                    if (SerialMotorControl.WriteSingleRegister(168, (UInt16)TorqueRefVal, serialPort) == false)
                        ServoResult.IsSuccess = false;

            //Set Speed (Speed Command 7)
            //if (ServoResult.IsSuccess == true)
            //    if (SerialMotorControl.WriteSingleRegister(292, (UInt16)SpeedRefVal, serialPort) == false)
            //        if (SerialMotorControl.WriteSingleRegister(292, (UInt16)SpeedRefVal, serialPort) == false)
            //            ServoResult.IsSuccess = false;

            //Set Speed (Speed Command 1)
            if (ServoResult.IsSuccess == true)
                if (SerialMotorControl.WriteSingleRegister(280, (UInt16)SpeedRefVal, serialPort) == false)
                    if (SerialMotorControl.WriteSingleRegister(280, (UInt16)SpeedRefVal, serialPort) == false)
                        ServoResult.IsSuccess = false;


            //Start Motor - Ignore E-Stop (10000  - 16)
            //start Motor - With E-stop (10100 - 20)
            //if (ServoResult.IsSuccess == true)
            //    if (SerialMotorControl.WriteSingleRegister(236, 20, serialPort) == false)
            //        if (SerialMotorControl.WriteSingleRegister(236, 20, serialPort) == false)
            //            ServoResult.IsSuccess = false;

            //Start Motor - (11100  - 28)
            if (ServoResult.IsSuccess == true)
                if (SerialMotorControl.WriteSingleRegister(236, 28, serialPort) == false)
                    if (SerialMotorControl.WriteSingleRegister(236, 28, serialPort) == false)
                        ServoResult.IsSuccess = false;


            if (ServoResult.IsSuccess == false)
            {
                frmMessageDialog.DisplayBriefMessage("Communications error: Check cable connections.");
            }

            if (ServoResult.IsSuccess == false)
                ServoResult.ErrorMessage = "Error Occurred with WriteSingleRegister in InitiateMotor";

            return ServoResult;
        }
Exemplo n.º 27
0
        protected virtual List<OrderTracer> GetOrderIss(string loc, string item, DateTime? startTime, DateTime? endTime, Enumerators.TracerType tracerType)
        {
            if (Plans == null || Plans.Count == 0)
                return null;

            var query = from p in Plans
                        where Utilities.StringEq(p.Item, item) && Utilities.StringEq(p.Loc, loc) &&
                        (!startTime.HasValue || p.ReqTime >= startTime.Value) &&//greater equal
                        (!endTime.HasValue || p.ReqTime < endTime.Value) &&//less than
                        p.IRType == Enumerators.IRType.ISS &&
                        p.PlanType == Enumerators.PlanType.Orders
                        select new OrderTracer
                        {
                            TracerType = tracerType,
                            Code = p.OrderNo,
                            ReqTime = p.ReqTime,
                            Item = p.Item,
                            OrderedQty = p.OrderedQty,
                            FinishedQty = p.FinishedQty,
                            Qty = p.Qty,
                            RefOrderLocTransId = p.ID
                        };

            return query.ToList();
        }
Exemplo n.º 28
0
 protected void SetCategoryLockState(int catid, Enumerators.PostStatus lockstatus)
 {
     Categories.SetCatStatus(catid, (int)lockstatus);
     Response.Redirect(Request.RawUrl);
 }
Exemplo n.º 29
0
 public static void SelectControlInBrowserByID(IE ie, string strID, Enumerators.ControlType ctrl)
 {
     if (ctrl == Enumerators.ControlType.Image)
     {
         Image imgCtrl = (Image)FindControlInBrowserByID(ie, strID, Enumerators.ControlType.Image);
         imgCtrl.Click();
     }
     else if (ctrl == Enumerators.ControlType.TableCell)
     {
         TableCell tblCell = (TableCell)FindControlInBrowserByID(ie, strID, Enumerators.ControlType.TableCell);
         tblCell.Click();
     }
     else if (ctrl == Enumerators.ControlType.Button)
     {
         Button btnToSelect = (Button)FindControlInBrowserByID(ie, strID, Enumerators.ControlType.Button);
         btnToSelect.Click();
     }
     else if (ctrl == Enumerators.ControlType.Link)
     {
         Link lnkSelect = (Link)FindControlInBrowserByID(ie, strID, Enumerators.ControlType.Link);
         lnkSelect.Click();
     }
     else if (ctrl == Enumerators.ControlType.CheckBox)
     {
         CheckBox chkToSelect = (CheckBox)FindControlInBrowserByID(ie, strID, Enumerators.ControlType.CheckBox);
         chkToSelect.Click();
     }
     else if (ctrl == Enumerators.ControlType.Div)
     {
         Div divToSelect = (Div)FindControlInBrowserByID(ie, strID, Enumerators.ControlType.Div);
         divToSelect.Click();
     }
     else if (ctrl == Enumerators.ControlType.Span)
     {
         Span spanToSelect = (Span)FindControlInBrowserByID(ie, strID, Enumerators.ControlType.Span);
         spanToSelect.Click();
     }
     ie.WaitForComplete();
 }
Exemplo n.º 30
0
 public static void SelectControlInBrowserByCustom(IE ie, string strCustomAttribute, string strToFind,
                                                   Enumerators.ControlType ctrl)
 {
     if (ctrl == Enumerators.ControlType.Image)
     {
         Image imgCtrl =
             (Image)FindControlInBrowserByCustom(ie, strCustomAttribute, strToFind, Enumerators.ControlType.Image);
         imgCtrl.Click();
     }
     else if (ctrl == Enumerators.ControlType.TableCell)
     {
         TableCell tblCell =
             (TableCell)FindControlInBrowserByCustom(ie, strCustomAttribute, strToFind, Enumerators.ControlType.TableCell);
         tblCell.Click();
     }
     else if (ctrl == Enumerators.ControlType.Link)
     {
         Link lnkToSelect =
             (Link)FindControlInBrowserByCustom(ie, strCustomAttribute, strToFind, Enumerators.ControlType.Link);
         lnkToSelect.Click();
     }
     else if (ctrl == Enumerators.ControlType.CheckBox)
     {
         CheckBox chkToClick =
             (CheckBox)FindControlInBrowserByCustom(ie, strCustomAttribute, strToFind, Enumerators.ControlType.CheckBox);
         chkToClick.Click();
     }
     else if (ctrl == Enumerators.ControlType.Div)
     {
         Div divToClick = (Div)FindControlInBrowserByCustom(ie, strCustomAttribute, strToFind, Enumerators.ControlType.Div);
         divToClick.Click();
     }
     ie.WaitForComplete();
 }
Exemplo n.º 31
0
        public override void ProcessParagraphUnit(IParagraphUnit paragraphUnit)
        {
            if (paragraphUnit.IsStructure)
            {
                return;
            }

            var priority = paragraphUnit.Properties.Contexts.Contexts.FirstOrDefault(
                a => a.ContextType == "Recommended" || a.ContextType.StartsWith("Alternative"));

            var textFunction = paragraphUnit.Properties.Contexts.Contexts.FirstOrDefault(
                a => string.Compare(a.DisplayName, "Text Function", StringComparison.CurrentCultureIgnoreCase) == 0);

            if (priority == null)
            {
                return;
            }

            if (_contextTypes.Count == 0)
            {
                _contextTypes.Add(priority.ContextType);
                _wordWriter.AddNewTable(priority.ContextType);
            }

            foreach (var segmentPair in paragraphUnit.SegmentPairs)
            {
                SegmentPairInfo segmentPairInfo = null;
                try
                {
                    segmentPairInfo = SegmentPairProcessor.GetSegmentPairInfo(segmentPair);
                }
                catch
                {
                    // catch all; ignore
                }

                var status = segmentPair.Properties.ConfirmationLevel.ToString();
                var match  = Enumerators.GetTranslationOriginType(segmentPair.Target.Properties.TranslationOrigin, _analysisBands);

                if (SkipSegment(segmentPair))
                {
                    AddWordCounts(status, ConfirmationStatistics.WordCounts.Excluded, segmentPairInfo);
                    AddWordCounts(match, TranslationOriginStatistics.WordCounts.Excluded, segmentPairInfo);
                    AddWordCounts(status, ConfirmationStatistics.WordCounts.Total, segmentPairInfo);
                    AddWordCounts(match, TranslationOriginStatistics.WordCounts.Total, segmentPairInfo);

                    continue;
                }

                AddWordCounts(status, ConfirmationStatistics.WordCounts.Processed, segmentPairInfo);
                AddWordCounts(match, TranslationOriginStatistics.WordCounts.Processed, segmentPairInfo);
                AddWordCounts(status, ConfirmationStatistics.WordCounts.Total, segmentPairInfo);
                AddWordCounts(match, TranslationOriginStatistics.WordCounts.Total, segmentPairInfo);

                _tokenVisitor.Process(segmentPair.Source);
                var sourceText   = _tokenVisitor.PlainText.ToString();
                var sourceTokens = CloneList(_tokenVisitor.Tokens);

                _tokenVisitor.Process(segmentPair.Target);
                var targetText   = _tokenVisitor.PlainText.ToString();
                var targetTokens = CloneList(_tokenVisitor.Tokens);
                var comments     = _tokenVisitor.Comments;

                List <Token> backTranslationTokens = null;
                if (segmentPair.Target.Properties.TranslationOrigin != null &&
                    segmentPair.Target.Properties.TranslationOrigin.MetaDataContainsKey("back-translation"))
                {
                    //TODO check if we need to create TranslationOrigin??

                    var backTranslation =
                        segmentPair.Target.Properties.TranslationOrigin.GetMetaData("back-translation");

                    backTranslationTokens = JsonConvert.DeserializeObject <List <Token> >(backTranslation);
                }

                var textFunctionDescription = textFunction?.Description;
                if (string.IsNullOrEmpty(textFunctionDescription))
                {
                    textFunctionDescription = _previousTextFunctionDescription;
                }
                else
                {
                    _previousTextFunctionDescription = textFunctionDescription;
                }

                _wordWriter.WriteEntry(
                    segmentPair.Properties.Id.Id,
                    paragraphUnit.Properties.ParagraphUnitId.Id,
                    priority.ContextType,
                    textFunctionDescription,
                    sourceTokens,
                    targetTokens,
                    segmentPair.Properties,
                    backTranslationTokens);
            }
        }