Exemple #1
0
        private void btnStart_Click(object sender, RoutedEventArgs e)
        {
            btnStart.IsEnabled = false;

            if (!demo)
            {
                MainWindow Schnittstelle = new MainWindow();  // Serial Connection definieren
                Schnittstelle.SerialConnection();
                string[] portname = Schnittstelle.getPortNames();
                txtbWerte.Text = "Portname: " + portname[0];
                //         Console.WriteLine("Portname: " + portname[0]);
                Schnittstelle.portName(portname[0]);                         // Portnamen festlegen

                myPort.Open();                                          // Port öffnen
                string[] value = new string[6];                         // 6, da sonst exception
                for (int k = 1; k < 6; k++)
                {
                    Schnittstelle.WertAnfordern();                      // Port offen?
                    value[k] = Schnittstelle.WertHolen();               // k als Wertvariable
                    txtbWerte.Text += System.Environment.NewLine + "Wert " + k + ": " + value[k];

                    //          Console.WriteLine("Wert " + k + ": " + value[k]);   // Wert ausgeben
                }
                myPort.Close();                                         // Port schließen
                btnStart.IsEnabled = true;

            }
            else if (demo)
            {

                for (double i = 0; i < 10; i = i + 0.1)
                {
                    Random r = new Random();
                    v.AddPoint(i, r.NextDouble());
                }
                Line.Refresh();
            }

            btnStart.IsEnabled = true;
        }
Exemple #2
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.Metex = ((wpfMetex.MainWindow)(target));
     return;
     case 2:
     this.btnSettings = ((System.Windows.Controls.Button)(target));
     
     #line 22 "..\..\MainWindow.xaml"
     this.btnSettings.Click += new System.Windows.RoutedEventHandler(this.btnSettings_Click);
     
     #line default
     #line hidden
     return;
     case 3:
     this.gridWindow = ((System.Windows.Controls.Grid)(target));
     return;
     case 4:
     this.gridContent = ((System.Windows.Controls.Grid)(target));
     return;
     case 5:
     this.btnStart = ((System.Windows.Controls.Button)(target));
     
     #line 29 "..\..\MainWindow.xaml"
     this.btnStart.Click += new System.Windows.RoutedEventHandler(this.btnStart_Click);
     
     #line default
     #line hidden
     return;
     case 6:
     this.txtbWerte = ((System.Windows.Controls.TextBox)(target));
     return;
     case 7:
     this.chart = ((Sparrow.Chart.SparrowChart)(target));
     return;
     case 8:
     this.Line = ((Sparrow.Chart.LineSeries)(target));
     return;
     case 9:
     this.gridSettings = ((System.Windows.Controls.Grid)(target));
     return;
     case 10:
     this.rbtnEmpfangen = ((System.Windows.Controls.RadioButton)(target));
     
     #line 45 "..\..\MainWindow.xaml"
     this.rbtnEmpfangen.Unchecked += new System.Windows.RoutedEventHandler(this.rbtnEmpfangen_Unchecked);
     
     #line default
     #line hidden
     
     #line 45 "..\..\MainWindow.xaml"
     this.rbtnEmpfangen.Checked += new System.Windows.RoutedEventHandler(this.rbtnEmpfangen_Checked);
     
     #line default
     #line hidden
     return;
     case 11:
     this.rbtnUebertragen = ((System.Windows.Controls.RadioButton)(target));
     
     #line 46 "..\..\MainWindow.xaml"
     this.rbtnUebertragen.Checked += new System.Windows.RoutedEventHandler(this.rbtnUebertragen_Checked);
     
     #line default
     #line hidden
     
     #line 46 "..\..\MainWindow.xaml"
     this.rbtnUebertragen.Unchecked += new System.Windows.RoutedEventHandler(this.rbtnUebertragen_Unchecked);
     
     #line default
     #line hidden
     return;
     case 12:
     this.btnStarten = ((System.Windows.Controls.Button)(target));
     
     #line 47 "..\..\MainWindow.xaml"
     this.btnStarten.Click += new System.Windows.RoutedEventHandler(this.btnStarten_Click);
     
     #line default
     #line hidden
     return;
     case 13:
     this.txtbIP = ((System.Windows.Controls.TextBox)(target));
     return;
     case 14:
     this.cbxCSV = ((System.Windows.Controls.CheckBox)(target));
     return;
     case 15:
     this.cbxPlotten = ((System.Windows.Controls.CheckBox)(target));
     return;
     case 16:
     this.btnServerStart = ((System.Windows.Controls.Button)(target));
     
     #line 51 "..\..\MainWindow.xaml"
     this.btnServerStart.Click += new System.Windows.RoutedEventHandler(this.btnServerStart_Click);
     
     #line default
     #line hidden
     return;
     case 17:
     this.btnSpeichern = ((System.Windows.Controls.Button)(target));
     return;
     case 18:
     this.txtbMessintervall = ((System.Windows.Controls.TextBox)(target));
     return;
     case 19:
     this.txtbMessdauer = ((System.Windows.Controls.TextBox)(target));
     return;
     case 20:
     this.lblMessintervall = ((System.Windows.Controls.Label)(target));
     return;
     case 21:
     this.lblMessdauer = ((System.Windows.Controls.Label)(target));
     return;
     }
     this._contentLoaded = true;
 }
Exemple #3
0
        private void msg(MainWindow form)
        {
            if (!Dispatcher.CurrentDispatcher.CheckAccess())

                Dispatcher.CurrentDispatcher.Invoke(new MethodInvoker(msg));

            else

                form.txtbWerte.Text = form.txtbWerte.Text + Environment.NewLine + " >> " + readData;
        }