Example #1
0
        public void AddLineAndUpdate3_error(IAddLine iFace, out string allOut)
        {
            lock (this)
            {
                if (iFace == null)
                {
                    throw new Exception("iFace == null");
                }
                if (IAddLines == null)
                {
                    throw new Exception("IAddLines == null");
                }

                if (iFace.MergeSupported)
                {
                    IAddLine old   = IAddLines.ContainsKey(iFace.DisplayItem) ? IAddLines[iFace.DisplayItem] : null;
                    IAddLine newIf = iFace.MergeAddLine(old);

                    if (old == null)
                    {
                        IAddLines.Add(newIf.DisplayItem, newIf);
                    }
                    else
                    {
                        IAddLines[newIf.DisplayItem] = newIf;
                    }
                }
                else if (IAddLines.ContainsKey(iFace.DisplayItem))
                {
                    IAddLines[iFace.DisplayItem] = iFace;
                }
                else
                {
                    IAddLines.Add(iFace.DisplayItem, iFace);
                }

                StringBuilder sb = new StringBuilder();
                foreach (KeyValuePair <eDisplayItem, IAddLine> i in IAddLines)
                {
                    try
                    {
                        sb.AppendLine(i.Value.ToInfoLine());
                    }
                    catch (Exception ex)
                    {
                        sb.AppendLine("--Exception --");
                    }
                }

                allOut = sb.ToString();
            }
        }
Example #2
0
        public void AddLine2(IAddLine iFace)
        {
            string        allText;
            StringBuilder debug = new StringBuilder();

            try
            {
                textController.AddLineAndUpdate3(iFace, out allText, debug);
                FileLog_Debug(debug.ToString());
            }
            catch (Exception)
            {
                FileLog_Debug(debug.ToString());
                throw;
            }
            theForm.UserAction_DisplayText(new Data_DisplayText(true, allText, this.StopRequest));
        }
Example #3
0
 public void Add(IAddLine it)
 {
     TheList.Add(it);
     TheList.Sort(new MyComparers());
 }
Example #4
0
 public int Compare(IAddLine x, IAddLine y)
 {
     return((int)(x.DisplayItem) - (int)(y.DisplayItem));
 }
Example #5
0
 public void AddLine2(IAddLine iFace)
 {
 }
Example #6
0
 public CreateLineCommand(IBetLineFactory lineFactory, IAddLine addLine, IGetAccountById getAccountById)
 {
     this.lineFactory    = lineFactory;
     this.lines          = addLine;
     this.getAccountById = getAccountById;
 }
Example #7
0
 public void AddLine2(IAddLine iFace)
 {
     Out(iFace.ToInfoLine());
 }
Example #8
0
 public virtual void IncomingReport(IAddLine info)
 {
 }
Example #9
0
 public virtual IAddLine MergeAddLine(IAddLine existing)
 {
     return(existing);
 }
Example #10
0
        public void AddLineAndUpdate3(IAddLine iFace, out string allOut, StringBuilder debug)
        {
            lock (this)
            {
                if (iFace == null)
                {
                    throw new Exception("iFace == null");
                }
                if (IAddLines == null)
                {
                    throw new Exception("IAddLines == null");
                }

                if (iFace.MergeSupported)
                {
                    IAddLine old   = IAddLines.ContainsKey(iFace.DisplayItem) ? IAddLines[iFace.DisplayItem] : null;
                    IAddLine newIf = iFace.MergeAddLine(old);

                    if (newIf == null)
                    {
                        throw new Exception("newIf == null");
                    }

                    if (old == null)
                    {
                        IAddLines.Add(newIf.DisplayItem, newIf);
                    }
                    else
                    {
                        IAddLines[newIf.DisplayItem] = newIf;
                    }
                }
                else if (IAddLines.ContainsKey(iFace.DisplayItem))
                {
                    IAddLines[iFace.DisplayItem] = iFace;
                }
                else
                {
                    IAddLines.Add(iFace.DisplayItem, iFace);
                }

                foreach (eDisplayItem report in iFace.ReportTo)
                {
                    IAddLine other = IAddLines.FirstOrDefault(i => i.Key == report).Value;
                    other?.IncomingReport(iFace);
                }

                StringBuilder sb = new StringBuilder();
                foreach (KeyValuePair <eDisplayItem, IAddLine> i in IAddLines)
                {
                    try
                    {
                        sb.AppendLine(i.Value.ToInfoLine());
                    }
                    catch (Exception ex)
                    {
                        sb.AppendLine("--Exception --");
                    }
                }

                allOut = sb.ToString();
            }
        }