Пример #1
0
 public override bool GetInfoByDb(string connStr, ref DbModels rel)
 {
     rel.Tables = new Dictionary<string, TableInfo>();
     using (Helper = new DBStructureHelper(connStr))
     {
         if (Helper.Open())
         {
             OutputText?.Invoke("开始获取数据库表结构(" + Helper.Server + (Helper.Port == "-1" ? "" : ":" + Helper.Port) + "  " + Helper.DbName + ")\n", OutputType.Comment);
             Helper.Set_DbHander(SetLen);
             if (Helper.GetTables(out List<string> tempList, out string errorMsg))
             {
                 OutputText?.Invoke("  获取到 " + tempList.Count + " 个表\n", OutputType.Comment);
                 OutputText?.Invoke("...", OutputType.Comment);
                 foreach (string tabName in tempList)
                 {
                     rel.Tables.Add(tabName, Helper.GetTableInfo(tabName));
                 }
                 OutputText?.Invoke("\n", OutputType.None);
                 OutputText?.Invoke("\n", OutputType.Comment);
                 return true;
             }
             else
             {
                 OutputText?.Invoke("获取表信息失败:" + errorMsg, OutputType.Comment);
                 return false;
             }
         }
         else
         {
             OutputText("打开数据库失败(" + Helper.DbName + ")", OutputType.Comment);
             return false;
         }
     }
 }
Пример #2
0
        } //MANUALLLY UPDATE TEMP ONLINE

        private void updateLTemp_Click(object sender, RoutedEventArgs e) //MANUALLY UPDATE TEMP LOCALLY
        {
            sp.Write("7");

            ambientTemp = Convert.ToDouble(sp.ReadLine());
            ambientTempLabel.Content = "Ambient Temperature: " + ambientTemp;

            if (ambientTemp < lowerBoundTemp)
            {
                OutputText.AppendText("\n" + "Ambient Temperature is lower than the predefined values. ");
                OutputText.AppendText("\n" + "Lower Bound: " + lowerBoundTemp);
                OutputText.AppendText("\n" + "Setting Temp to Auto");
                OutputText.ScrollToEnd();
                autoTempCheck.IsChecked = true;
            }
            else if (ambientTemp > upperBoundTemp)
            {
                OutputText.AppendText("\n" + "Ambient Temperature is higher than the predefined values. ");
                OutputText.AppendText("\n" + "Upper Bound: " + upperBoundTemp);
                OutputText.AppendText("\n" + "Setting Temp to Auto");
                OutputText.ScrollToEnd();
                autoTempCheck.IsChecked = true;
            }

            OutputText.AppendText("\n" + "Ambient Temperature Update: " + ambientTemp);
            OutputText.ScrollToEnd();
        }
Пример #3
0
        void ReleaseDesignerOutlets()
        {
            if (CallApiButton != null)
            {
                CallApiButton.Dispose();
                CallApiButton = null;
            }

            if (LoginButton != null)
            {
                LoginButton.Dispose();
                LoginButton = null;
            }

            if (LogoutButton != null)
            {
                LogoutButton.Dispose();
                LogoutButton = null;
            }

            if (OutputText != null)
            {
                OutputText.Dispose();
                OutputText = null;
            }

            if (RefreshButton != null)
            {
                RefreshButton.Dispose();
                RefreshButton = null;
            }
        }
Пример #4
0
        private void CalculateHomeWins()
        {
            int totalGames = 0;
            int homeGames  = 0;
            int homeWins   = 0;
            int homeDraws  = 0;
            int homeLosses = 0;

            foreach (Match m in matches)
            {
                totalGames++;
                if (m.HomeTeam != 0)
                {
                    homeGames++;
                }
                if (m.WinningTeam == 0)
                {
                    homeDraws++;
                }
                else if ((m.HomeTeam == 1 && m.WinningTeam == 1) || (m.HomeTeam == -1 && m.WinningTeam == -1))
                {
                    homeWins++;
                }
                else if ((m.HomeTeam == 1 && m.WinningTeam == -1) || (m.HomeTeam == -1 && m.WinningTeam == 1))
                {
                    homeLosses++;
                }
            }
            OutputText.AppendText("Total Games = " + totalGames + Environment.NewLine + "Home Games = " + homeGames + Environment.NewLine +
                                  "Home Wins = " + homeWins + Environment.NewLine + "Home Draws = " + homeDraws + Environment.NewLine +
                                  "Home Losses = " + homeLosses + Environment.NewLine + "Home win % = " + (float)homeWins / (float)homeGames);
        }
Пример #5
0
        private void StreamReaderThreadFunc()
        {
            if (!Process.StartInfo.RedirectStandardOutput)
            {
                return;
            }
            var streamReader = Process.StandardOutput;

            if (streamReader == null)
            {
                return;
            }
            try
            {
                while (!streamReader.EndOfStream)
                {
                    string s = streamReader.ReadLine();
                    if (s == null)
                    {
                        return;
                    }
                    lock (OutputText)
                    {
                        OutputText.Add(s);
                    }
                }
            }
            catch (Exception ex)
            {
                lock (Exceptions)
                {
                    Exceptions.Add(ex);
                }
            }
        }
 private void Button_Click(object sender, RoutedEventArgs e) //SET UPPER AND LOWER BOUNDS
 {
     if (Convert.ToDouble(lowerBoundTB.Text) == lowerBoundTemp)
     {
         OutputText.AppendText("\n" + "Lower Bound is already;" + lowerBoundTemp + ". No changes made.");
         OutputText.ScrollToEnd();
     }
     else
     {
         lowerBoundTemp = Convert.ToDouble(lowerBoundTB.Text);
         OutputText.AppendText("\n" + "Lower Bound Set To;" + lowerBoundTemp);
         OutputText.ScrollToEnd();
     }
     if (Convert.ToDouble(upperBoundTB.Text) == upperBoundTemp)
     {
         OutputText.AppendText("\n" + "upper Bound is already;" + upperBoundTemp + ". No changes made.");
         OutputText.ScrollToEnd();
     }
     else
     {
         upperBoundTemp = Convert.ToDouble(upperBoundTB.Text);
         OutputText.AppendText("\n" + "Upper Bound Set To;" + upperBoundTemp);
         OutputText.ScrollToEnd();
     }
 }
    private void StartProcess()
    {
        var outputText = new OutputText();

        outputText.processEventArgsHandler += ProcessEventHandler;
        outputText.SimulateProcessOutput();
    }
Пример #8
0
        private void ParseOutput()
        {
            _parsedErrors.Clear();
            string[] lines = OutputText.Split('\n');
            foreach (string line in lines)
            {
                Regex errorRegex = new Regex("(?<file>.+):(?<lineNum>\\d+):(?<type>.+):(?<description>.+)");
                Match match      = errorRegex.Match(line);
                if (!match.Success)
                {
                    continue;
                }

                string filePath = match.Groups["file"].Value;
                if (filePath.IndexOfAny(Path.GetInvalidPathChars()) != -1)
                {
                    continue;
                }

                FilePath file          = new FilePath(filePath);
                string   lineNumString = match.Groups["lineNum"].Value;
                string   type          = match.Groups["type"].Value;
                string   description   = match.Groups["description"].Value;
                int      lineNum       = Convert.ToInt32(lineNumString);
                bool     isWarning     = type.Contains("warning");
                _parsedErrors.Add(new BuildError(file, lineNum, description, isWarning));
            }
        }
Пример #9
0
        private void InputText(string message)
        {
            if (!string.IsNullOrEmpty(OutputText))
            {
                var splittext = OutputText.Split('\n').ToList();
                if (splittext.Count > 100)
                {
                    splittext.RemoveAt(0);
                }

                splittext.Add(message);
                OutputText = string.Join("\n", splittext.ToArray());
                if (CurrentViewModel is ModulesViewModel)
                {
                    var cmod = (ModulesViewModel)CurrentViewModel;
                    cmod.ForwardInput(message);
                }
            }
            else
            {
                OutputText = "" + message;

                if (CurrentViewModel is ModulesViewModel)
                {
                    var cmod = (ModulesViewModel)CurrentViewModel;
                    cmod.ForwardInput(message);
                }
            }

            InText = "";
        }
Пример #10
0
        private void Btn_Store_Click(object sender, EventArgs e)
        {
            // Update Flags
            StoreFlags(CheckedListFlags, CheckedFlags);

            // Create a temporary list
            List <string> SpecifcFlags = new List <string>(CheckedFlags);

            // Add Dictionary Key/Content Pair
            ImageFlags.Add(ImageLocationComboBox.Text, SpecifcFlags);

            // Remove Key from ImageLocationComboBox
            ImageLocationComboBox.Items.Remove(ImageLocationComboBox.Text);
            //Reset Functionality
            FullRefresh();

            OutputText.AppendText(NameTextBox.Text + " [" + "Image Check" + "] " + "(" + DateTextBox.Text + ")");
            foreach (var contents in ImageFlags.Keys)
            {
                OutputText.AppendText("\r\n" + contents);
                foreach (var listItem in ImageFlags[contents])
                {
                    OutputText.AppendText("\r\n" + "   " + "\u2022 " + listItem);
                }
            }
            OutputText.AppendText("\r\n");
        }
Пример #11
0
 public void ShowText(bool result)
 {
     OutputText.Text           = text;
     OutputText.SelectionStart = OutputText.TextLength;
     OutputText.ScrollToCaret();
     SetTitleMessages(result);
 }
Пример #12
0
        public string ExecuteCommand(List <string> args)
        {
            var t = new OutputText();

            ExecuteCommand(args, t);
            return(t.ToString());
        }
 public override bool GetInfoByDb(string connStr, ref DbModels rel)
 {
     using (Helper = new DBStructureHelper(connStr))
     {
         if (Helper.Open())
         {
             OutputText?.Invoke("开始获取数据库信息(" + Helper.Server + (Helper.Port == "-1" ? "" : ":" + Helper.Port) + "  " + Helper.DbName + ")\n", OutputType.Comment);
             Helper.Set_DbHander(SetLen);
             if (Helper.GetTables(out List <string> tempList, out string errorMsg))
             {
                 rel.DbModel = Helper.GetDbInfo();
                 OutputText?.Invoke("\n", OutputType.None);
                 OutputText?.Invoke("\n", OutputType.Comment);
                 return(true);
             }
             else
             {
                 OutputText?.Invoke("获取数据库信息失败:" + errorMsg, OutputType.Comment);
                 return(false);
             }
         }
         else
         {
             OutputText("打开数据库失败(" + Helper.DbName + ")", OutputType.Comment);
             return(false);
         }
     }
 }
Пример #14
0
        public void AddToOutput(string text)
        {
            string timestamp = DateTime.Now.ToString("HH:mm:ss.ffff");

            text = String.Format("[{0}] {1}", timestamp, text);

            //if (OutputText.Count >= logHighWatermark)
            //{
            //    UInt32 numToDelete = (UInt32)OutputText.Count - logLowWatermark;
            //    for (UInt32 i = 0; i < numToDelete; i++)
            //    {
            //        OutputText.RemoveAt(0);
            //    }
            //}

            OutputText.Items.Add(text);

            //sw = new StreamWriter(aFile);
            //sw.Write(text.ToString());
            //sw.Close();

            //File.AppendAllText("D:\\temp\\temp.txt", text+"\r\n", Encoding.Default);

            OutputText.SetSelected(OutputText.Items.Count - 1, true);  // 光标移到最后一条
        }
Пример #15
0
 private void Window_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     if (IsVisible)
     {
         OutputText.ScrollToEnd();
     }
 }
Пример #16
0
        private void RunThroughMatches(int kValue, bool outputMatches, bool outputTeamResults, bool outputKResults)
        {
            int   matchTotal             = 0;
            float matchCorrectPrediction = 0;

            foreach (Match m in matches)
            {
                if ((m.WinningTeam == -1 && m.Team1.CurrentRating > m.Team2.CurrentRating) || (m.WinningTeam == 1 && m.Team1.CurrentRating > m.Team2.CurrentRating))
                {
                    matchCorrectPrediction++;
                }
                if (m.WinningTeam == 0)
                {
                    matchCorrectPrediction++;
                }
                Calculator.UpdateRatings(m, kValue);
                if (outputMatches)
                {
                    OutputText.AppendText(String.Format("{0} {1} {2} - {3} {4}\n", m.Date, m.Team1.Name, m.Team1.CurrentRating, m.Team2.Name, m.Team2.CurrentRating));
                }
                matchTotal++;
            }
            if (outputTeamResults)
            {
                OutputText.AppendText("\n");
                foreach (Team t in teams)
                {
                    OutputText.AppendText(String.Format("{0} {1} {2}\n", t.Name, t.InitialRating, t.CurrentRating));
                }
            }
            if (outputKResults)
            {
                OutputText.AppendText(String.Format("K value: {0} Correct: {1} Total: {2} Percent: {3}\n", kValue, matchCorrectPrediction, matchTotal, (float)matchCorrectPrediction / (float)matchTotal));
            }
        }
        void getLTemp()
        {
            sp.Write("7");

            ambientTemp = Convert.ToDouble(sp.ReadLine());
            ambientTempLabel.Content = "Ambient Temperature: " + ambientTemp;

            OutputText.AppendText("\n" + "Ambient Temperature Update: " + ambientTemp);
            OutputText.ScrollToEnd();

            if (ambientTemp < lowerBoundTemp)
            {
                OutputText.AppendText("\n" + "Ambient Temperature is lower than the predefined values. ");
                OutputText.AppendText("\n" + "Lower Bound: " + lowerBoundTemp);
                OutputText.ScrollToEnd();
                autoTempCheck.IsChecked = true;
            }
            else if (ambientTemp > upperBoundTemp)
            {
                OutputText.AppendText("\n" + "Ambient Temperature is higher than the predefined values. ");
                OutputText.AppendText("\n" + "Upper Bound: " + upperBoundTemp);
                OutputText.ScrollToEnd();
                autoTempCheck.IsChecked = true;
            }
        }
        void connectArduino()
        {
            try
            {
                sp.PortName = portName;
                sp.BaudRate = 9600;
                sp.Open();
                arduinoConnected        = true;
                connectLabel.Content    = "Arduino: Connected";
                connectButton.IsEnabled = false;

                updateLTemp.IsEnabled            = true;
                sensorMovementCheckBox.IsEnabled = true;
                sp.WriteLine("");
                OutputText.AppendText("\n" + "Arduino Connected");
                OutputText.ScrollToEnd();
                getLTemp();
            }
            catch (Exception)
            {
                connectLabel.Content = "Arduino: Disconnected";
                Console.WriteLine("ERROR CONNECTING ARDUINO");

                OutputText.AppendText("\n" + "arduino did not connect");
                OutputText.AppendText("\n" + "Change COM port");
                OutputText.ScrollToEnd();

                arduinoConnected        = false;
                connectButton.IsEnabled = true;;
                updateLTemp.IsEnabled   = false;
            }
        }
Пример #19
0
        private void Button_Send_Speed_Click(object sender, EventArgs e)
        {
            switch (Speed_Selection)
            {
            case 0:
                OutputString = "SNL";
                break;

            case 1:
                OutputString = "SOD";
                break;

            default:
                OutputText.AppendText("Please select a speed before sending a speed command!\r\n");
                OutputText.AppendText("------------------------------------------------------------------------------------------\r\n");
                break;
            }
            try
            {
                serialPort1.WriteLine(OutputString);
            }
            catch (System.InvalidOperationException)
            {
                MessageBox.Show("You are not connected to a Serial Port!", "Serial Error");
                return;
            }
        }
Пример #20
0
 private void Button_Clear(object sender, RoutedEventArgs e)
 {
     cipherText.Clear();
     clenText.Clear();
     ccountText.Clear();
     OutputText.Clear();
 }
Пример #21
0
        private async void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs args)
        {
            _viewModel = (OpenDocumentViewModel)args.NewValue;
            _viewModel.ResultsAvailable       += ResultsAvailable;
            _viewModel.ReadInput              += OnReadInput;
            _viewModel.NuGet.PackageInstalled += NuGetOnPackageInstalled;

            _viewModel.EditorFocus           += (o, e) => Editor.Focus();
            _viewModel.DocumentUpdated       += (o, e) => Dispatcher.InvokeAsync(() => Editor.RefreshHighlighting());
            _viewModel.OutputMessageReceived += s =>
            {
                ShowBottomPaneRow();

                BottomTabs.SelectedItem = OutputTab;
                OutputText.AppendText($"{DateTime.Now:dd/MM/yyyy HH:mm:ss.fff} - {s}{Environment.NewLine}");
                OutputText.ScrollToEnd();
            };
            _viewModel.ConsoleMessageReceived += (s, t) =>
            {
                ConsoleTextType consoleTextType;
                string          separator;
                if (t == ConsoleMessageType.Err)
                {
                    separator       = "!";
                    consoleTextType = ConsoleTextType.Error;
                }
                else
                {
                    consoleTextType = ConsoleTextType.Output;
                    separator       = ">";
                }

                WriteConsole(s, consoleTextType, separator);
            };
            _viewModel.ExecutionStarted += s =>
            {
                _viewModel.Dispatcher.InvokeAsync(() => WriteConsole($"['{s}.csx' code Execution Started]", ConsoleTextType.Information, "-"));
            };
            _viewModel.BuildStarted += () => OutputText.Clear();

            _viewModel.MainViewModel.EditorFontSizeChanged += OnEditorFontSizeChanged;
            Editor.FontSize = _viewModel.MainViewModel.EditorFontSize;

            var documentText = await _viewModel.LoadText().ConfigureAwait(true);

            var documentId = Editor.Initialize(
                _viewModel.MainViewModel.RoslynHost,
                new ClassificationHighlightColors(),
                _viewModel.WorkingDirectory,
                documentText);

            _viewModel.Initialize(
                documentId,
                OnError,
                () => new TextSpan(Editor.SelectionStart, Editor.SelectionLength),
                this);

            Editor.Document.TextChanged += (o, e) => _viewModel.OnTextChanged();
        }
        private void Output(string message)
        {
            OutputText.Text += Environment.NewLine + message;
            CGPoint p = OutputText.ContentOffset;

            OutputText.SetContentOffset(p, false);
            OutputText.ScrollRangeToVisible(new NSRange(OutputText.Text.Length, 0));
        }
 private void tempOffBtn_Click(object sender, RoutedEventArgs e)
 {
     TempSlider.Value        = 0;
     setTemp                 = 0;
     autoTempCheck.IsChecked = false;
     OutputText.AppendText("\n" + "Temperature sytem: OFF");
     OutputText.ScrollToEnd();
 }
        private void simulatedMovementCheckBox_Unchecked(object sender, RoutedEventArgs e)
        {
            movement = false;

            incrementLightsSeconds = 0;
            OutputText.AppendText("\n" + "No Motion Detected, Lights OFF in " + delayTime + " Seconds.");
            OutputText.ScrollToEnd();
        } // conditional
        void getOTemp()
        {
            string sURL;

            sURL = "http://api.openweathermap.org/data/2.5/forecast?id=2644668&APPID=90375e80d95a34c3df52b029eb02580e";

            WebRequest wrGETURL;

            wrGETURL = WebRequest.Create(sURL);



            Stream objStream;

            objStream = wrGETURL.GetResponse().GetResponseStream();

            StreamReader objReader = new StreamReader(objStream);

            string sLine = "";



            sLine      = objReader.ReadLine();
            tempString = sLine;
            if (tempString.Substring(78, 1) == ":")
            {
                tempSubString = tempString.Substring(79, 5);
            }
            else
            {
                tempSubString = tempString.Substring(78, 5);
            }
            Console.WriteLine(tempSubString);
            onlineTemp = Convert.ToDouble(tempSubString) - 273.2;
            onlineTemp = Math.Round(onlineTemp, 2);
            OutputText.AppendText("\n" + "Online Temperature Update: " + onlineTemp);
            OutputText.ScrollToEnd();

            //Console.WriteLine(tempString);
            onlineTempLabel.Content = "Online Temperature: " + onlineTemp;

            if (onlineTemp < lowerBoundTemp)
            {
                OutputText.AppendText("\n" + "Online Temperature is lower than the predefined values. ");
                OutputText.AppendText("\n" + "Lower Bound: " + lowerBoundTemp);
                OutputText.ScrollToEnd();
                autoTempCheck.IsChecked = true;
            }
            else if (onlineTemp > upperBoundTemp)
            {
                OutputText.AppendText("\n" + "Online Temperature is higher than the predefined values. ");
                OutputText.AppendText("\n" + "Upper Bound: " + upperBoundTemp);
                OutputText.ScrollToEnd();
                autoTempCheck.IsChecked = true;
            }
            incrementTempMinutes = 0;
            incrementTempSeconds = 0;
        }
Пример #26
0
 private void AlignRight()
 {
     LineNum.SelectAll();
     LineNum.SelectionAlignment = HorizontalAlignment.Right;
     LineNum.DeselectAll();
     OutputText.SelectAll();
     OutputText.SelectionAlignment = HorizontalAlignment.Center;
     OutputText.DeselectAll();
 }
Пример #27
0
        void FullRefresh()
        {
            OutputText.Clear();
            ImageLocationComboBox.Text = "";
            RefreshCheckedListFlags();

            CheckedListFlags.Enabled = false;
            Btn_Store.Enabled        = false;
        }
Пример #28
0
        } //SET TARGET TEMPERATURE

        void updateOTemp_Click(object sender, RoutedEventArgs e)
        {
            string sURL;

            sURL = "http://api.openweathermap.org/data/2.5/forecast?id=2644668&APPID=90375e80d95a34c3df52b029eb02580e";

            WebRequest wrGETURL;

            wrGETURL = WebRequest.Create(sURL);



            Stream objStream;

            objStream = wrGETURL.GetResponse().GetResponseStream();

            StreamReader objReader = new StreamReader(objStream);

            string sLine = "";



            sLine      = objReader.ReadLine();
            tempString = sLine;
            if (tempString.Substring(78, 1) == ":")
            {
                tempSubString = tempString.Substring(79, 6);
            }
            else
            {
                tempSubString = tempString.Substring(78, 6);
            }
            Console.WriteLine(tempSubString);
            ambientTemp = Convert.ToDouble(tempSubString) - 273.15;
            OutputText.AppendText("\n" + "Ambient Temperature Update: " + ambientTemp);
            OutputText.ScrollToEnd();

            //Console.WriteLine(tempString);
            ambientTempLabel.Content = "Ambient Temperature: " + ambientTemp;

            if (ambientTemp < lowerBoundTemp)
            {
                OutputText.AppendText("\n" + "Ambient Temperature is lower than the predefined values. ");
                OutputText.AppendText("\n" + "Lower Bound: " + lowerBoundTemp);
                OutputText.AppendText("\n" + "Setting Temp to Auto");
                OutputText.ScrollToEnd();
                autoTempCheck.IsChecked = true;
            }
            else if (ambientTemp > upperBoundTemp)
            {
                OutputText.AppendText("\n" + "Ambient Temperature is higher than the predefined values. ");
                OutputText.AppendText("\n" + "Upper Bound: " + upperBoundTemp);
                OutputText.AppendText("\n" + "Setting Temp to Auto");
                OutputText.ScrollToEnd();
                autoTempCheck.IsChecked = true;
            }
        } //MANUALLLY UPDATE TEMP ONLINE
Пример #29
0
 public override void ProcessText()
 {
     OutputText = _inputText.Replace("\t", " ");
     OutputText = OutputText.Replace("(\r\n|\r|\n){1,}", " ");
     OutputText = OutputText.Replace("\n", " ");
     OutputText = Regex.Replace(OutputText, AllExceptDotAndAZ().ToString(), " ");
     OutputText = Regex.Replace(OutputText, MoreThanOneSpace().ToString(), " ");
     OutputText = OutputText.Trim().ToLowerInvariant();
 }
Пример #30
0
        private void Button_Send_ROM_Click(object sender, EventArgs e)
        {
            string Selection;

            OutputString = "R";     // All rom commands belong to the R-family

            switch (ROM_Selection)
            {
            case 3:
                Selection     = "Skip-ROM";
                OutputString += "SK";
                break;

            case 4:
                Selection     = "Match-ROM";
                OutputString += "MT";
                OutputString += MatchRomID;
                //OutputString += "/n";
                break;

            case 5:
                Selection     = "Resume";
                OutputString += "RS";
                break;

            case 6:
                Selection     = "Read-ROM";
                OutputString += "RD";
                break;

            case 7:
                Selection     = "OD Skip-ROM";
                OutputString += "OS";
                break;

            case 8:
                Selection     = "OD Match-ROM";
                OutputString += "OM";
                OutputString += MatchRomID;
                break;

            default:
                OutputText.AppendText("Please select a ROM command\r\n");
                OutputText.AppendText("------------------------------------------------------------------------------------------\r\n");
                return;
            }

            try
            {
                serialPort1.WriteLine(OutputString);
            }
            catch (System.InvalidOperationException)
            {
                MessageBox.Show("You are not connected to a Serial Port!", "Serial Error");
                return;
            }
        }