/// <summary> /// load model from setting /// </summary> /// <param name="model"></param> public void LoadViewModel(DemoControlViewModel model) { model.Width = Width; model.Height = Height; model.Brightness = Brightness; model.CycleAnimations = CycleAnimation; model.FramesPerSecond = FramesPerSecond; if (model.Device != null) { model.Device.PortName = PortName; } model.AnimationLength = TimePerAnimation; model.Strands = Strands; model.GammaCorrection = Gamma; model.UseGammaCorrection = UseGamma; model.BaudRate = BaudRate; model.DemoManager.VisualizationSchedule.Clear(); foreach (var v in DemoSchedule) { model.DemoManager.VisualizationSchedule.Add(v); } model.SelectedRemapping = model.Remappings.FirstOrDefault(z => z.GetType().Name == RemappingName); }
/// <summary> /// save model to setting /// </summary> /// <param name="model"></param> public void SaveViewModel(DemoControlViewModel model) { Width = model.Width; Height = model.Height; Brightness = model.Brightness; CycleAnimation = model.CycleAnimations; FramesPerSecond = model.FramesPerSecond; PortName = model.Device == null ? "" : model.Device.PortName; TimePerAnimation = model.AnimationLength; Strands = model.Strands; Gamma = model.GammaCorrection; UseGamma = model.UseGammaCorrection; BaudRate = model.BaudRate; DemoSchedule.Clear(); foreach (var v in model.DemoManager.VisualizationSchedule) { DemoSchedule.Add(v); } if (model.SelectedRemapping != null) { RemappingName = model.SelectedRemapping.GetType().Name; } else { RemappingName = ""; } }