private void button_Save_Click(object sender, RoutedEventArgs e) { controller.Pause(); button.Content = "Paused"; var unit4save = new OneDemExample(); unit4save.Rebuild(); int newVal = (int)slider.Value; int index = newVal < vm.SolPointList.Value.Count ? newVal : vm.SolPointList.Value.Count - 1; if (index < 0) { return; } unit4save.SynchMeTo(vm.SolPointList.Value[index]); var sd = new SaveFileDialog() { Filter = "XML Files|*.xml", FileName = "sph1D" }; if (sd.ShowDialog() == true) { var sw = new StreamWriter(sd.FileName); unit4save.Serialize(sw); sw.Close(); } }
public ViewModel() { _curr4Draw = new OneDemExample(); _curr4Draw.Rebuild(); Model1Rx = new VMPropRx <PlotModel, SolPoint>(() => { var Model1 = GetNewModel("params", "X", "p,Ro,V"); P = new ScatterSeries() { Title = "P", MarkerType = MarkerType.Triangle, MarkerSize = 2, MarkerFill = OxyColors.Green }; Model1.Series.Add(P); Ro = new ScatterSeries() { Title = "Ro", MarkerType = MarkerType.Diamond, MarkerSize = 2, MarkerFill = OxyColors.DarkOrange }; Model1.Series.Add(Ro); V = new ScatterSeries() { Title = "V", MarkerType = MarkerType.Circle, MarkerSize = 2, MarkerFill = OxyColors.Blue }; Model1.Series.Add(V); E = new ScatterSeries() { Title = "E", MarkerType = MarkerType.Circle, MarkerSize = 2, MarkerFill = OxyColors.Red }; Model1.Series.Add(E); return(Model1); }, (sp, pm) => { _curr4Draw.SynchMeTo(sp); Draw(sp.T, pm); return(pm); } ); SolPointList = new VMPropRx <List <SolPoint>, SolPoint>( () => new List <SolPoint>(), (sp, lst) => { lst.Add(sp); return(lst); }); }