Пример #1
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (listview.Items.Count == 0)
            {
                MessageBox.Show("You need to add 1 item first !");
                return;
            }

            Driving_Cycle_Segments dcs = new Driving_Cycle_Segments();

            try
            {
                foreach (var item in listview.Items)
                {
                    dcs.Insert((DrivingCycleSegment)item);
                }
                MessageBox.Show("Segments Successfuly added");
                listview.Items.Clear();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            foreach (var t in stpTextboxes1.Children)
            {
                if (t.GetType() == typeof(TextBox))
                {
                    TextBox tt = (TextBox)t;
                    Console.WriteLine(tt.Name);
                    tt.Text = string.Empty;
                }
            }
            timerpicker.Text = string.Empty;
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Driving_Cycle_Segments dcms = new Driving_Cycle_Segments();

            try
            {
                dcms.Insert(new DrivingCycleSegment
                {
                    SegID       = "SEG2",
                    DcId        = "DC1",
                    AddedLoad   = 10,
                    Defaultload = 10,
                    GetRpm      = 10,
                    Gradient    = 10,
                    RunTime     = DateTime.Now
                });
                MessageBox.Show("successfully added");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }