Exemplo n.º 1
0
 public Jp2KrDesignVM() : base(null, null)
 {
     Ongoings.Add(new TestLabelProgressVM());
     Ongoings.Add(new TestLabelProgressVM());
     Faults.Add(new TestLabelProgressVM());
     Progress = new TestLabelProgressVM();
 }
Exemplo n.º 2
0
        public override void Check(ArcChart chart)
        {
            List <(ArcArcTap, float, float)> ats = new List <(ArcArcTap, float, float)>();

            foreach (var arc in chart.Arcs)
            {
                foreach (var at in arc.ArcTaps)
                {
                    float t = 1f * (at.Timing - arc.Timing) / (arc.EndTiming - arc.Timing);
                    float x = ArcAlgorithm.X(arc.XStart, arc.XEnd, t, arc.LineType);
                    float y = ArcAlgorithm.Y(arc.YStart, arc.YEnd, t, arc.LineType);
                    ats.Add((at, x, y));
                }
            }
            for (int i = 0; i < ats.Count - 1; ++i)
            {
                for (int k = i + 1; k < ats.Count; ++k)
                {
                    if (ats[i].Item2 == ats[k].Item2 &&
                        ats[i].Item3 == ats[k].Item3 &&
                        ats[i].Item1.Timing == ats[k].Item1.Timing)
                    {
                        Faults.Add(ats[i].Item1);
                    }
                }
            }
            Faults = Faults.Distinct().ToList();
        }
Exemplo n.º 3
0
 public override void Check(ArcChart chart)
 {
     // foreach (var h in chart.Holds)
     // {
     //     foreach (var t in chart.Timings)
     //     {
     //         if (t.Timing > h.Timing && t.Timing < h.EndTiming)
     //         {
     //             Faults.Add(h);
     //         }
     //     }
     // }
     foreach (var a in chart.Arcs)
     {
         foreach (var t in chart.Timings)
         {
             if (t.Timing > a.Timing && t.Timing < a.EndTiming)
             {
                 if (Mathf.Approximately(a.XStart, a.XEnd) && Mathf.Approximately(a.YStart, a.YEnd))
                 {
                     continue;
                 }
                 Faults.Add(a);
             }
         }
     }
     Faults = Faults.Distinct().ToList();
 }
Exemplo n.º 4
0
        private Task ParallelForEach(Func <TranslationUnit, Jp2KrWork> genViewModel)
        {
            List <TranslationUnit> transUnits = translations ?? FindTranslations().ToList();
            int complete = 0;

            Progress.Value = 0;
            Progress.Label = $"{workKind}{complete} / {transUnits.Count}";

            return(transUnits.ForEachPinnedAsync(coreCount, async t => {
                Jp2KrWork item = genViewModel(t);
                Ongoings.Add(item.Progress);
                try {
                    await Task.Run(() => item.Process());
                }
                catch (EhndNotFoundException) {
                    Progress.Foreground = LabelProgressVM.FgError;
                    throw;
                }
                catch (Exception e) {
                    Progress.Foreground = LabelProgressVM.FgError;
                    string msg = e is RegexMatchTimeoutException
            ? "정규식 검색이 너무 오래 걸립니다. 정규식을 점검해주세요."
            : e.Message;
                    item.SetProgress(TranslationPhase.Error, 100, msg);
                    Faults.Add(item.Progress);
                    Exceptions.Add(e);
                }
                finally {
                    _ = Ongoings.Remove(item.Progress);
                    complete++;
                    Progress.Value = (double)complete / transUnits.Count * 100;
                    Progress.Label = $"{workKind}{complete} / {transUnits.Count}";
                }
            }));
        }
Exemplo n.º 5
0
        public RpdChannelViewModel(IRpdChannel channel, RpdMeterViewModel meter)
        {
            _channel       = channel;
            TrendChartType = TrendChartType.Rpd;
            Meter          = meter;

            Faults.Add(meter.Fault);
        }
Exemplo n.º 6
0
        public IFaultablePort AppendFault(Exception e)
        {
            var fault = e.Message;

            Faults = Faults ?? new List <string>();
            Faults.Add(fault);

            return(this);
        }
Exemplo n.º 7
0
        void FillFaults()
        {
            for (int i = 0; i < Section.Faults.Count; i++)
            {
                Faults.Add(new FaultViewModel(Section.Faults[i]));
            }

            _faultsLinker = new ObservableCollectionsConnector <IFaultLog, IFaultViewModel>(Section.Faults, Faults, ConstructNewFault,
                                                                                            log => Faults.FirstOrDefault(e => e.Fault == log));
        }
Exemplo n.º 8
0
 public override void Check(ArcChart chart)
 {
     foreach (var h in chart.Holds)
     {
         if (h.EndTiming <= h.Timing)
         {
             Faults.Add(h);
         }
     }
     Faults = Faults.Distinct().ToList();
 }
Exemplo n.º 9
0
 public void AddFault(Fault fault)
 {
     if (Faults == null)
     {
         Faults = new List <Fault>
         {
             fault
         };
     }
     else
     {
         Faults.Add(fault);
     }
 }
Exemplo n.º 10
0
 public override void Check(ArcChart chart)
 {
     for (int i = 0; i < chart.Taps.Count - 1; ++i)
     {
         for (int k = i + 1; k < chart.Taps.Count; ++k)
         {
             if (chart.Taps[i].Timing == chart.Taps[k].Timing &&
                 chart.Taps[i].Track == chart.Taps[k].Track)
             {
                 Faults.Add(chart.Taps[i]);
             }
         }
     }
     Faults = Faults.Distinct().ToList();
 }
Exemplo n.º 11
0
 public override void Check(ArcChart chart)
 {
     foreach (var h in chart.Holds)
     {
         foreach (var t in chart.Taps)
         {
             if (t.Timing >= h.Timing && t.Timing <= h.EndTiming &&
                 t.Track == h.Track)
             {
                 Faults.Add(t);
             }
         }
     }
     Faults = Faults.Distinct().ToList();
 }
Exemplo n.º 12
0
 public override void Check(ArcChart chart)
 {
     foreach (var a in chart.Arcs)
     {
         if (a.EndTiming <= a.Timing)
         {
             if (a.XEnd == a.XStart)
             {
                 if (a.YEnd == a.YStart)
                 {
                     Faults.Add(a);
                 }
             }
         }
     }
     Faults = Faults.Distinct().ToList();
 }
Exemplo n.º 13
0
 public override void Check(ArcChart chart)
 {
     foreach (var h in chart.Holds)
     {
         foreach (var t in chart.Timings)
         {
             if (t.Timing > h.Timing && t.Timing < h.EndTiming)
             {
                 Faults.Add(h);
             }
         }
     }
     foreach (var a in chart.Arcs)
     {
         foreach (var t in chart.Timings)
         {
             if (t.Timing > a.Timing && t.Timing < a.EndTiming)
             {
                 Faults.Add(a);
             }
         }
     }
     Faults = Faults.Distinct().ToList();
 }
Exemplo n.º 14
0
        /// <summary>
        /// Method to obtain all the faults as a result of the validation of the html
        /// </summary>
        /// <param name="htmlValid">Boolean that will indicate if the document is or not valid html.</param>
        /// <param name="urlDocument">Xml document that represents the result of the validation</param>
        /// <param name="envNamespace">Namespace using to obtain some data such as line, colum, etc.</param>
        /// <param name="mNamespace">Namespace using to obtain some data such as line, colum, etc.</param>
        private void HTMLFaults(XDocument urlDocument, XNamespace envNamespace, XNamespace mNamespace)
        {
            faults = new Faults();

            //Obtaining the descendants of the elements labeled "Fault". With this we obtain all the faults
            var faultElement = from e in urlDocument.Descendants(envNamespace + "Fault")
                               select e;

            //Obtaining the descendants of the elements labeled "Detail". With this we obtain the details of the fault 
            var faultDetail = from e in faultElement.Descendants(envNamespace + "Detail")
                              select e;

            //Obtaining the descendants of the elements labeled "Text". With this we obtain the reason text of the fault
            var faultReason = from e in faultElement.Descendants(envNamespace + "Text")
                              select e;

            //Iterate over the fault elements
            foreach (var element in faultElement)
            {
                //Create a new instance of the class Fault
                Fault fault = new Fault();

                //Iterate over the fault reason
                foreach (var reason in faultReason)
                {
                    //Store the value of the reason into de instance of the fault
                    fault.reason = reason.Value;
                }
                //Iterate over the fault detail
                foreach (var e in faultDetail)
                {
                    //Store the value of the messageid and errordetail
                    fault.messageid = e.Descendants(mNamespace + "messageid").First().Value;
                    fault.errorDetail = e.Descendants(mNamespace + "errordetail").First().Value;
                }

                //Insert the fault in the list of faults
                faults.Add(fault);
            }
        }