private void UpdateProfile() { string last = "Default"; if (AppSettings.Settings.ImageAdjustProfiles.Count == 0) { AppSettings.Settings.ImageAdjustProfiles.Add(new ClsImageAdjust("Default")); } if (!string.IsNullOrEmpty(this.comboBox1.Text.Trim())) { last = this.comboBox1.Text.Trim(); this.CurIA = AITOOL.GetImageAdjustProfileByName(this.comboBox1.Text.Trim(), false); if (this.CurIA == null) { this.CurIA = new ClsImageAdjust(this.comboBox1.Text, tb_jpegquality.Text, tb_SizePercent.Text, tb_Width.Text, tb_Height.Text, tb_brightness.Text, tb_contrast.Text); AppSettings.Settings.ImageAdjustProfiles.Add(this.CurIA); } else { this.CurIA.Update(this.comboBox1.Text, tb_jpegquality.Text, tb_SizePercent.Text, tb_Width.Text, tb_Height.Text, tb_brightness.Text, tb_contrast.Text); } } this.comboBox1.Items.Clear(); int i = 0; int oldidx = 0; foreach (ClsImageAdjust ia in AppSettings.Settings.ImageAdjustProfiles) { this.comboBox1.Items.Add(ia.Name); if (string.Equals(last.Trim(), ia.Name.Trim(), StringComparison.OrdinalIgnoreCase)) { oldidx = i + 1; } i++; } if (this.comboBox1.Items.Count > 0) { this.comboBox1.SelectedIndex = oldidx; } this.CurIA = AITOOL.GetImageAdjustProfileByName(this.comboBox1.Text.Trim(), false); }
private void UpdateCombo() { string last = "Default"; if (AppSettings.Settings.ImageAdjustProfiles.Count == 0) { AppSettings.Settings.ImageAdjustProfiles.Add(new ClsImageAdjust("Default")); } if (!string.IsNullOrEmpty(this.comboBox1.Text.Trim())) { last = this.comboBox1.Text.Trim(); } if (!AITOOL.HasImageAdjustProfile(this.comboBox1.Text.Trim()) && !string.IsNullOrEmpty(this.comboBox1.Text.Trim())) { AppSettings.Settings.ImageAdjustProfiles.Add(new ClsImageAdjust(this.comboBox1.Text.Trim())); } this.comboBox1.Items.Clear(); int i = 0; int oldidx = 0; foreach (ClsImageAdjust ia in AppSettings.Settings.ImageAdjustProfiles) { this.comboBox1.Items.Add(ia.Name); if (string.Equals(last.Trim(), ia.Name.Trim(), StringComparison.OrdinalIgnoreCase)) { oldidx = i + 1; } i++; } if (this.comboBox1.Items.Count > 0) { this.comboBox1.SelectedIndex = oldidx; } this.CurIA = AITOOL.GetImageAdjustProfileByName(this.comboBox1.Text.Trim()); }