Example #1
0
 private void SaveExperimentButton_Click(object sender, RoutedEventArgs e)
 {
     YSeries.Insert(YSeries.Count - 1, YSeries.Last());
     XSeries.Insert(XSeries.Count - 1, XSeries.Last());
     YSpeedSeries.Insert(YSpeedSeries.Count - 1, YSpeedSeries.Last());
     XSpeedSeries.Insert(XSpeedSeries.Count - 1, XSpeedSeries.Last());
     Parameters.Insert(Parameters.Count - 1, Parameters.Last());
     AddEllipse = true;
     ++colorIndex;
     Update();
 }
Example #2
0
        private void ListBox_OnPreviewMouseDown(object sender, MouseButtonEventArgs e)
        {
            var item = ItemsControl.ContainerFromElement((ItemsControl)sender, (DependencyObject)e.OriginalSource) as ListBoxItem;

            if (item == null)
            {
                return;
            }
            var series = (LineSeries)item.Content;

            if (e.LeftButton == MouseButtonState.Pressed)
            {
                series.Visibility = series.Visibility == Visibility.Visible
                    ? Visibility.Hidden
                    : Visibility.Visible;
            }
            else if (e.RightButton == MouseButtonState.Pressed)
            {
                int index = -1;
                if (YRadioButton.IsChecked.Value)
                {
                    index = YSeries.IndexOf(series);
                }
                else if (XRadioButton.IsChecked.Value)
                {
                    index = XSeries.IndexOf(series);
                }
                else if (YSpeedRadioButton.IsChecked.Value)
                {
                    index = YSpeedSeries.IndexOf(series);
                }
                else
                {
                    index = XSpeedSeries.IndexOf(series);
                }
                if (index == YSeries.Count - 1)
                {
                    return;
                }
                YSeries.RemoveAt(index);
                XSeries.RemoveAt(index);
                YSpeedSeries.RemoveAt(index);
                XSpeedSeries.RemoveAt(index);
                AnimCanvas.Children.Remove(Ellipsies[index]);
                AnimCanvas.Children.Remove(Polylines[index]);
                Ellipsies.RemoveAt(index);
                Polylines.RemoveAt(index);
                YAnimations.RemoveAt(index);
                XAnimations.RemoveAt(index);
                Parameters.RemoveAt(index);
                UpdateAnimation = true;
                DataChanged     = true;
            }
        }
Example #3
0
 private void TRTB_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (AnimCanvas != null)
     {
         AnimCanvas.Children.Clear();
         AnimCanvas.Children.Add(XAxis);
         AnimCanvas.Children.Add(YAxis);
     }
     YSeries.Clear();
     XSeries.Clear();
     YSpeedSeries.Clear();
     XSpeedSeries.Clear();
     Ellipsies.Clear();
     Polylines.Clear();
     YAnimations.Clear();
     XAnimations.Clear();
     Parameters.Clear();
     AddEllipse = true;
     colorIndex = 0;
     TB_TextChanged(sender, e);
 }