示例#1
0
        private void OnCommunications(string str, INK iNK)
        {
            if (ValidBrowser == false)
            {
                System.Diagnostics.Debug.WriteLine("INVALID BROWSER, must update Internet Explorer to version 8 or better!!");
                return;
            }
            Int32 line = 0;

            try
            {
                if (InvokeRequired)
                {
                    this.Invoke(new OnCommunicationsDelegate(OnCommunications), new object[] { str, iNK });
                    return;
                }


                HtmlDocument doc = CommunicationsDisplay.Document;
                ScrollMessageIntoView();
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"EXCEPTION IN OnCommunications @ Line: {line}, {ex.Message}");
            }
        }
        private void OnCommunications(string str, INK iNK)
        {
            if (ValidBrowser == false)
            {
                System.Diagnostics.Debug.WriteLine("INVALID BROWSER, must update Internet Explorer to version 8 or better!!");
                return;
            }
            Int32 line = 0;

            //System.Diagnostics.Debug.WriteLine("~~~~~~ OnCommunications 1:");
            try
            {
                if (InvokeRequired)
                {
                    this.Invoke(new OnCommunicationsDelegate(OnCommunications), new object[] { str, iNK });
                    return;
                }

                //  System.Diagnostics.Debug.WriteLine("~~~~~~ OnCommunications 2");
                HtmlDocument doc = CommunicationsDisplay.Document;
                line = 1;
                //System.Diagnostics.Debug.WriteLine("~~~~~~ OnCommunications 3");
                string style = String.Empty;
                if (iNK.Equals(INK.CLR_GREEN))
                {
                    style = Properties.Settings.Default.StyleGreen;
                }
                else if (iNK.Equals(INK.CLR_BLUE))
                {
                    style = Properties.Settings.Default.StyleBlue;
                }
                else if (iNK.Equals(INK.CLR_RED))
                {
                    style = Properties.Settings.Default.StyleRed;
                }
                else if (iNK.Equals(INK.CLR_PURPLE))
                {
                    style = Properties.Settings.Default.StylePurple;
                }
                else
                {
                    style = Properties.Settings.Default.StyleBlack;
                }
                line = 2;
                //System.Diagnostics.Debug.WriteLine("~~~~~~ OnCommunications 4");
                //doc.Write(String.Format("<div style=\"{0}\">{1}</div><br />", style, str));
                doc.Write(String.Format("<div style=\"{0}\">{1}</div>", style, str));
                //doc.Body.ScrollTop = int.MaxValue;
                //CommunicationsDisplay.Document.Window.ScrollTo(0, int.MaxValue);
                line = 3;
                ScrollMessageIntoView();
                //System.Diagnostics.Debug.WriteLine("~~~~~~ OnCommunications 5");
                line = 4;
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"EXCEPTION IN OnCommunications @ Line: {line}, {ex.Message}");
            }
        }