/// <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 = ""; } }
private void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { GroupBox.IsEnabled = true; DownloadButton.IsEnabled = true; if (e.Error != null) { #if DEBUG DemoSchedule demo = new DemoSchedule(); IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication(); using (StreamWriter sw = new StreamWriter( storage.CreateFile(IsolatedStorageSettings.ApplicationSettings["DownloadGroupName"] + Extension) )) { sw.Write(demo.GetScheduleString()); } #else MessageBox.Show(AppResources.error_DownloadFile + Environment.NewLine + e.Error.Message); #endif } else { IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication(); using (StreamWriter sw = new StreamWriter( storage.CreateFile(IsolatedStorageSettings.ApplicationSettings["DownloadGroupName"] + Extension) )) { sw.Write(e.Result); } } IsolatedStorageSettings.ApplicationSettings.Remove("DownloadGroupName"); RefreshScheduleList(); }