Beispiel #1
0
        /// <summary>
        /// SChreiben der Parameter für Funktion writeParameter
        /// </summary>
        /// <param name="mainForm"></param>
        /// <param name="value"></param>
        private void parameterWrite(FormMain mainForm, ParameterSets.ParameterSetsStruc value)
        {
            try
            {
                string temp;
                sp.WriteLine("M");
                // log über sendekey
                Log.write(mainForm, "send: \"M\"", 1);
                temp = sp.ReadLine();
                // alle inputs durchgehen
                while (temp != "Register ")
                {
                    temp = sp.ReadLine();
                    // log schreiben wenn debuglevel
                    Log.write(mainForm, temp, 1);
                }
                sp.WriteLine(Convert.ToInt16(value.Command.Substring(9)).ToString("00"));
                temp = sp.ReadLine();
                while (temp != (Convert.ToInt16(value.Command.Substring(9)).ToString("00") + " = "))
                {
                    temp = sp.ReadLine();
                    // log schreiben wenn debuglevel
                    Log.write(mainForm, temp, 1);
                }
                sp.WriteLine(Convert.ToInt16(value.Value).ToString("00"));
                temp = sp.ReadLine();
                while (temp != ">")
                {
                    temp = sp.ReadLine();
                    // log schreiben wenn debuglevel
                    Log.write(mainForm, temp, 1);
                }
                // log über sendekey
                Log.write(mainForm, (labels.GetString("writeParameter") +
                                     Convert.ToInt16(value.Command.Substring(9)).ToString("00") + " = " +
                                     Convert.ToInt16(value.Value).ToString("00")), 0);

                // Progressbar hochzählen
                mainForm.toolStripProgressBar.Increment(4);
                // Infotext in status schreiben
                mainForm.infoleisteToolStripStatusLabel.Text = labels.GetString("writeParameter") + Convert.ToInt16(value.Command.Substring(9)).ToString("00") + " = " + Convert.ToInt16(value.Value).ToString("00");
                Application.DoEvents();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }
Beispiel #2
0
 public ParameterSets.ParameterSetsStruc[] GetChapter(string chapter)
 {
     ParameterSets.ParameterSetsStruc[] rueckgabe = new ParameterSets.ParameterSetsStruc[0];
     foreach (inidatei i in inizeilen)
     {
         if (i.abschnitt == chapter)
         {
             Array.Resize(ref rueckgabe, rueckgabe.Length + 1);
             rueckgabe[rueckgabe.Length - 1].Chapter = chapter;
             rueckgabe[rueckgabe.Length - 1].Command = i.befehl;
             rueckgabe[rueckgabe.Length - 1].Comment = i.kommentar;
             rueckgabe[rueckgabe.Length - 1].Value   = i.wert;
         }
     }
     return(rueckgabe);
 }
Beispiel #3
0
        //Verwenden der ParameterSets.Struc
        //public struct Return
        //{
        //    public string Command;
        //    public string Value;
        //    public string Comment;
        //    public string Chapter;
        //}

        public ParameterSets.ParameterSetsStruc Get(string befehl)
        {
            ParameterSets.ParameterSetsStruc rueckgabe = new ParameterSets.ParameterSetsStruc();
            rueckgabe.Command = befehl;
            rueckgabe.Value   = "";
            rueckgabe.Comment = "";
            foreach (inidatei i in inizeilen)
            {
                if (i.befehl == befehl)
                {
                    rueckgabe.Value   = i.wert;
                    rueckgabe.Comment = i.kommentar;
                    rueckgabe.Chapter = i.abschnitt;
                }
            }
            return(rueckgabe);
        }
Beispiel #4
0
        /// <summary>
        /// SChreiben der Parameter für Funktion writeParameter
        /// </summary>
        /// <param name="mainForm"></param>
        /// <param name="value"></param>
        private bool parameterWrite(FormMain mainForm, ParameterSets.ParameterSetsStruc value)
        {
            mainForm.Cursor = Cursors.WaitCursor;
            try
            {
                string temp;
                //sp.Write("M");
                sp.WriteLine("M");
                // log über sendekey
                if (Properties.Settings.Default.logLevel > 0)
                {
                    Log.write(mainForm, "send: \"M\" for Parameter: " + Convert.ToInt16(value.Command.Substring(9)).ToString("00"), 1);
                }
                temp = sp.ReadLine();


                // alle inputs durchgehen
                //while (temp != ">M\r")
                // hier auf Parameter warten - es ist sonst immer zu einem timeout gekommen
                while (temp != "Register ")
                {
                    temp = sp.ReadLine();
                    // log schreiben wenn debuglevel
                    if (Properties.Settings.Default.logLevel > 0)
                    {
                        Log.write(mainForm, temp + "first write M", 1);
                    }
                }
                ////sp.WriteLine(Convert.ToInt16(value.Command.Substring(9)).ToString("00"));
                ////temp = sp.ReadLine();
                ////while (temp != (Convert.ToInt16(value.Command.Substring(9)).ToString("00") + " = "))
                ////{
                ////    temp = sp.ReadLine();
                ////    // log schreiben wenn debuglevel
                ////    if (Properties.Settings.Default.logLevel > 0)
                ////    {
                ////        Log.write(mainForm, temp, 1);
                ////    }
                ////}
                ////sp.WriteLine(Convert.ToInt16(value.Value).ToString("00"));
                // schreiben auf einmal
                sp.Write(Convert.ToInt16(value.Command.Substring(9)).ToString("00"));
                sp.Write(Convert.ToInt16(value.Value).ToString("00"));
                temp = sp.ReadLine();
                if (temp != Convert.ToInt16(value.Command.Substring(9)).ToString("00") +
                    " = " + Convert.ToInt16(value.Value).ToString("00") + "\r")
                {
                    throw (new Exception());
                }
                ////while (temp != ">")
                ////{
                ////    temp = sp.ReadLine();
                ////    // log schreiben wenn debuglevel
                ////    if (Properties.Settings.Default.logLevel > 0)
                ////    {
                ////        Log.write(mainForm, temp, 1);
                ////    }
                ////}
                // log über sendekey
                Log.write(mainForm, (labels.GetString("writeParameter") +
                                     Convert.ToInt16(value.Command.Substring(9)).ToString("00") + " = " +
                                     Convert.ToInt16(value.Value).ToString("00")), 0);

                // Progressbar hochzählen
                mainForm.toolStripProgressBar.Increment(4);
                // Infotext in status schreiben
                mainForm.infoleisteToolStripStatusLabel.Text = labels.GetString("writeParameter") + Convert.ToInt16(value.Command.Substring(9)).ToString("00") + " = " + Convert.ToInt16(value.Value).ToString("00");
                Application.DoEvents();
                mainForm.Cursor = Cursors.Default;
                return(true);
            }
            catch (Exception e)
            {
                MessageBox.Show(errorLabels.GetString("askPic"), "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log.write(mainForm, e.ToString() + "\r\nTest Return from Pic", 1);
                mainForm.Cursor = Cursors.Default;
                return(false);
            }
        }