private void ReadFromControls(MySettings mySettings) { mySettings.ULSMN_Section1LineColor = new MyColor((Color)colorPicker_ULS_MN_Line1.SelectedColor); mySettings.ULSMN_Section2LineColor = new MyColor((Color)colorPicker_ULS_MN_Line2.SelectedColor); mySettings.ULSMN_DataPointColor = new MyColor((Color)colorPicker_ULS_MN_Points.SelectedColor); mySettings.ULSMN_Section1LineWeight = slider_sec1_ULS_MN.Value; mySettings.ULSMN_Section2LineWeight = slider_sec2_ULS_MN.Value; mySettings.ULSMN_DataPointWeight = slider_points_ULS_MN.Value; mySettings.ULSVN_VrdcLineColor = new MyColor((Color)colorPicker_ULS_VN_Line1.SelectedColor); mySettings.ULSVN_VrdLineColor = new MyColor((Color)colorPicker_ULS_VN_Line2.SelectedColor); mySettings.ULSVN_DataPointColor = new MyColor((Color)colorPicker_ULS_VN_Points.SelectedColor); mySettings.ULSVN_VrdcLineWeight = slider_line1_ULS_VN.Value; mySettings.ULSVN_VrdLineWeight = slider_line2_ULS_VN.Value; mySettings.ULSVN_DataPointWeight = slider_points_ULS_VN.Value; mySettings.SLS_Crack_Cracked_LineColor = new MyColor((Color)colorPicker_SLS_Crack_Cracked_Line.SelectedColor); mySettings.SLS_Crack_NonCracked_LineColor = new MyColor((Color)colorPicker_SLS_Crack_NonCracked_Line.SelectedColor); mySettings.SLS_Crack_DataPointColor = new MyColor((Color)colorPicker_SLS_Crack_Points.SelectedColor); mySettings.SLS_Crack_Cracked_LineWeight = slider_SLS_Crack_Cracked_Line.Value; mySettings.SLS_Crack_NonCracked_LineWeight = slider_SLS_Crack_NonCracked_Line.Value; mySettings.SLS_Crack_DataPointWeight = slider_SLS_Crack_Points.Value; mySettings.SLS_ConcreteStress_LineColor = new MyColor((Color)colorPicker_SLS_ConcreteStress_Line.SelectedColor); mySettings.SLS_SteelStress_LineColor = new MyColor((Color)colorPicker_SLS_SteelStress_Line.SelectedColor); mySettings.SLS_Stress_DataPointColor = new MyColor((Color)colorPicker_SLS_Stress_DataPoint.SelectedColor); mySettings.SLS_Crack_Cracked_LineWeight = slider_SLS_ConcreteStress_Line.Value; mySettings.SLS_Crack_NonCracked_LineWeight = slider_SLS_SteelStress_Line.Value; mySettings.SLS_Crack_DataPointWeight = slider_SLS_Stress_DataPoint.Value; }
private void SetControls(MySettings mySettings) { colorPicker_ULS_MN_Line1.SelectedColor = mySettings.ULSMN_Section1LineColor.GetMedia(); colorPicker_ULS_MN_Line2.SelectedColor = mySettings.ULSMN_Section2LineColor.GetMedia(); colorPicker_ULS_MN_Points.SelectedColor = mySettings.ULSMN_DataPointColor.GetMedia(); slider_sec1_ULS_MN.Value = mySettings.ULSMN_Section1LineWeight; slider_sec2_ULS_MN.Value = mySettings.ULSMN_Section2LineWeight; slider_points_ULS_MN.Value = mySettings.ULSMN_DataPointWeight; colorPicker_ULS_VN_Line1.SelectedColor = mySettings.ULSVN_VrdcLineColor.GetMedia(); colorPicker_ULS_VN_Line2.SelectedColor = mySettings.ULSVN_VrdLineColor.GetMedia(); colorPicker_ULS_VN_Points.SelectedColor = mySettings.ULSVN_DataPointColor.GetMedia(); slider_line1_ULS_VN.Value = mySettings.ULSVN_VrdcLineWeight; slider_line2_ULS_VN.Value = mySettings.ULSVN_VrdLineWeight; slider_points_ULS_VN.Value = mySettings.ULSVN_DataPointWeight; colorPicker_SLS_Crack_Cracked_Line.SelectedColor = mySettings.SLS_Crack_Cracked_LineColor.GetMedia(); colorPicker_SLS_Crack_NonCracked_Line.SelectedColor = mySettings.SLS_Crack_NonCracked_LineColor.GetMedia(); colorPicker_SLS_Crack_Points.SelectedColor = mySettings.SLS_Crack_DataPointColor.GetMedia(); slider_SLS_Crack_Cracked_Line.Value = mySettings.SLS_Crack_Cracked_LineWeight; slider_SLS_Crack_NonCracked_Line.Value = mySettings.SLS_Crack_NonCracked_LineWeight; slider_SLS_Crack_Points.Value = mySettings.SLS_Crack_DataPointWeight; colorPicker_SLS_ConcreteStress_Line.SelectedColor = mySettings.SLS_ConcreteStress_LineColor.GetMedia(); colorPicker_SLS_SteelStress_Line.SelectedColor = mySettings.SLS_SteelStress_LineColor.GetMedia(); colorPicker_SLS_Stress_DataPoint.SelectedColor = mySettings.SLS_Stress_DataPointColor.GetMedia(); slider_SLS_ConcreteStress_Line.Value = mySettings.SLS_Crack_Cracked_LineWeight; slider_SLS_SteelStress_Line.Value = mySettings.SLS_Crack_NonCracked_LineWeight; slider_SLS_Stress_DataPoint.Value = mySettings.SLS_Crack_DataPointWeight; }
public MainWindow() { InitializeComponent(); this.Title = defaultTitle; wspolczynniki = new Factors(Factors.Settings.zachowane); SetControlls(); ustawienia = new MySettings(Source.zapisane); //ustawienia = new MySettings(Source.domyslne); //ustawienia.SaveToFile(); }
public Window_DisplaySet(MySettings set) { InitializeComponent(); mySettings = new MySettings(Source.zapisane); mySettings = set; /*Settings ustawienia = new Settings(); * ustawienia.SaveToFile(); * ustawienia.ReadFromFile(); * MyColor c = ustawienia.ULSMN_Section1LineColor;*/ SetControls(mySettings); }
public void ReadFromFile() { MySettings zapisane; try { using (Stream input = File.OpenRead(@"data/settings.dat")) { BinaryFormatter formatter = new BinaryFormatter(); zapisane = (MySettings)formatter.Deserialize(input); } this.SLS_ConcreteStress_LineColor = zapisane.SLS_ConcreteStress_LineColor; this.SLS_ConcreteStress_LineWeight = zapisane.SLS_ConcreteStress_LineWeight; this.SLS_Crack_DataPointColor = zapisane.SLS_Crack_DataPointColor; this.SLS_Crack_DataPointWeight = zapisane.SLS_Crack_DataPointWeight; this.SLS_Crack_NonCracked_LineColor = zapisane.SLS_Crack_NonCracked_LineColor; this.SLS_Crack_NonCracked_LineWeight = zapisane.SLS_Crack_NonCracked_LineWeight; this.SLS_Crack_Cracked_LineColor = zapisane.SLS_Crack_Cracked_LineColor; this.SLS_Crack_Cracked_LineWeight = zapisane.SLS_Crack_Cracked_LineWeight; this.SLS_SteelStress_LineColor = zapisane.SLS_SteelStress_LineColor; this.SLS_SteelStress_LineWeight = zapisane.SLS_SteelStress_LineWeight; this.SLS_Stress_DataPointColor = zapisane.SLS_Stress_DataPointColor; this.SLS_Stress_DataPointWeight = zapisane.SLS_Stress_DataPointWeight; this.ULSMN_DataPointColor = zapisane.ULSMN_DataPointColor; this.ULSMN_DataPointWeight = zapisane.ULSMN_DataPointWeight; this.ULSMN_Section1LineColor = zapisane.ULSMN_Section1LineColor; this.ULSMN_Section1LineWeight = zapisane.ULSMN_Section1LineWeight; this.ULSMN_Section2LineColor = zapisane.ULSMN_Section2LineColor; this.ULSMN_Section2LineWeight = zapisane.ULSMN_Section2LineWeight; this.ULSVN_DataPointColor = zapisane.ULSVN_DataPointColor; this.ULSVN_DataPointWeight = zapisane.ULSVN_DataPointWeight; this.ULSVN_VrdcLineColor = zapisane.ULSVN_VrdcLineColor; this.ULSVN_VrdcLineWeight = zapisane.ULSVN_VrdcLineWeight; this.ULSVN_VrdLineColor = zapisane.ULSVN_VrdLineColor; this.ULSVN_VrdLineWeight = zapisane.ULSVN_VrdLineWeight; } catch (Exception) { MessageBox.Show("Saved display settings file not found. Defaults settings were loaded.", "Loading failed", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK); MySettings def = new MySettings(Source.domyslne); this.SLS_ConcreteStress_LineColor = def.SLS_ConcreteStress_LineColor; this.SLS_ConcreteStress_LineWeight = def.SLS_ConcreteStress_LineWeight; this.SLS_Crack_DataPointColor = def.SLS_Crack_DataPointColor; this.SLS_Crack_DataPointWeight = def.SLS_Crack_DataPointWeight; this.SLS_Crack_NonCracked_LineColor = def.SLS_Crack_NonCracked_LineColor; this.SLS_Crack_NonCracked_LineWeight = def.SLS_Crack_NonCracked_LineWeight; this.SLS_Crack_Cracked_LineColor = def.SLS_Crack_Cracked_LineColor; this.SLS_Crack_Cracked_LineWeight = def.SLS_Crack_Cracked_LineWeight; this.SLS_SteelStress_LineColor = def.SLS_SteelStress_LineColor; this.SLS_SteelStress_LineWeight = def.SLS_SteelStress_LineWeight; this.SLS_Stress_DataPointColor = def.SLS_Stress_DataPointColor; this.SLS_Stress_DataPointWeight = def.SLS_Stress_DataPointWeight; this.ULSMN_DataPointColor = def.ULSMN_DataPointColor; this.ULSMN_DataPointWeight = def.ULSMN_DataPointWeight; this.ULSMN_Section1LineColor = def.ULSMN_Section1LineColor; this.ULSMN_Section1LineWeight = def.ULSMN_Section1LineWeight; this.ULSMN_Section2LineColor = def.ULSMN_Section2LineColor; this.ULSMN_Section2LineWeight = def.ULSMN_Section2LineWeight; this.ULSVN_DataPointColor = def.ULSVN_DataPointColor; this.ULSVN_DataPointWeight = def.ULSVN_DataPointWeight; this.ULSVN_VrdcLineColor = def.ULSVN_VrdcLineColor; this.ULSVN_VrdcLineWeight = def.ULSVN_VrdcLineWeight; this.ULSVN_VrdLineColor = def.ULSVN_VrdLineColor; this.ULSVN_VrdLineWeight = def.ULSVN_VrdLineWeight; } }
private void button_RestoreDef_Click(object sender, RoutedEventArgs e) { MySettings mySet = new MySettings(Source.domyslne); SetControls(mySet); }