private string SetThemes(string Name, Color A, Color B, Color C) { if (A.IsNamedColor == false || B.IsNamedColor == false || C.IsNamedColor == false) { return("Unnamed color will not work"); } Themes theme = new Themes(); theme.ThemeName = Name; theme.TextColor = B.Name; theme.BackColor = A.Name; theme.TopColor = C.Name; TCDataFiltering.ForeColor = Color.FromName(theme.TextColor); TCDataFiltering.BackColor = Color.FromName(theme.BackColor); TCSettings.BackColor = Color.FromName(theme.BackColor); TCSettings.ForeColor = Color.FromName(theme.TextColor); TCEmailTemplate.BackColor = Color.FromName(theme.BackColor); TCEmailTemplate.ForeColor = Color.FromName(theme.TextColor); TCEmail.BackColor = Color.FromName(theme.BackColor); TCEmail.ForeColor = Color.FromName(theme.TextColor); panel1.BackColor = Color.FromName(theme.TopColor); panel1.ForeColor = Color.FromName(theme.TextColor); TabControl1.Update(); var x = ThemesCollection.Contains(theme); ThemesCollection.themesList.Remove(x); ThemesCollection.themesList.Add(theme); return(null); }
private void comboBoxColors_SelectedIndexChanged(object sender, EventArgs e) { LabelErrorMessage.Text = ""; string message = SetThemes(comboBoxColors.SelectedItem.ToString()); LabelErrorMessage.Text = message; ThemesCollection.TurnActive(comboBoxColors.SelectedItem.ToString()); }
public void ReadList() { Themes theme = new Themes(); using (XmlReader reader = XmlReader.Create("Themes.xml")) { while (reader.Read()) { if (reader.IsStartElement()) { switch (reader.Name.ToString()) { case "Name": theme = new Themes(); theme.ThemeName = reader.ReadString(); break; case "BackColor": theme.BackColor = reader.ReadString(); break; case "TextColor": theme.TextColor = reader.ReadString(); break; case "TopColor": theme.TopColor = reader.ReadString(); break; case "IsActive": bool temp; bool.TryParse(reader.ReadString(), out temp); theme.IsActive = temp; if (theme.ThemeName.Equals("Default") == false) { if (ThemesCollection.Contains(theme.ThemeName) == null) { ThemesCollection.themesList.Add(theme); } } break; } } } } }
private string SetThemes(string themeName) { Themes theme = ThemesCollection.Contains(themeName); if (theme == null) { return("This theme is not specified"); } TCDataFiltering.ForeColor = Color.FromName(theme.TextColor); TCDataFiltering.BackColor = Color.FromName(theme.BackColor); TCSettings.BackColor = Color.FromName(theme.BackColor); TCSettings.ForeColor = Color.FromName(theme.TextColor); TCEmailTemplate.BackColor = Color.FromName(theme.BackColor); TCEmailTemplate.ForeColor = Color.FromName(theme.TextColor); TCEmail.BackColor = Color.FromName(theme.BackColor); TCEmail.ForeColor = Color.FromName(theme.TextColor); panel1.BackColor = Color.FromName(theme.TopColor); panel1.ForeColor = Color.FromName(theme.TextColor); TabControl1.Update(); return("Theme is updated"); }
public Form1() { InitializeComponent(); SerializationHandler shandler = new SerializationHandler(); shandler.Deserialize(); foreach (var x in ProfileLog.profileList) { richTextBox2.Text += x.Email; } xmlHandler handler = new xmlHandler(); try { comboBoxColors.Items.Clear(); handler.ReadList(); foreach (var x in ThemesCollection.themesList) { comboBoxColors.Items.Add(x.ThemeName); } comboBoxColors.Update(); } catch (Exception) { ThemesCollection.InitializeList(); LabelErrorMessage.Text = "File Not Found"; } LabelErrorMessage.Text = ""; buttonSetColor.Enabled = false; radioButtonThemes.Checked = true; radioButtonSpecificDate.Checked = true; progressBar1.Visible = false; comboBoxColors.SelectedItem = "default"; SetThemes("Default"); // comboBoxColors.DataSource = ThemesCollection.themesList; ThemesCollection.themesList.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(themesList_CollectionChanged); }
public Form1() { InitializeComponent(); /* Commenting out This Dangerous Code * * Form1.CheckForIllegalCrossThreadCalls = false; */ textBoxFolderAdress.Text = "D:\\"; RelativePath = textBoxFolderAdress.Text; w = new DynamoWebClient(RelativePath); w.InformationDownloadEvent += new InformationDownloadHandler(w_InformationDownloadEvent); button2.Enabled = false; button3.Enabled = false; SerializationHandler shandler = new SerializationHandler(); shandler.Deserialize(); shandler.DeserializeJobs(); shandler.DeserializeApplicants(); ProfileLog profilelog = ProfileLog.Create; foreach (var x in profilelog.ProfileList) { if (String.IsNullOrEmpty(x.Email) == false) { comboBoxEmails.Items.Add(x.Email); } if (x.IsActive == true) { comboBoxEmails.Text = x.Email; } } xmlHandler handler = new xmlHandler(); try { comboBoxColors.Items.Clear(); handler.ReadList(); foreach (var x in ThemesCollection.themesList) { comboBoxColors.Items.Add(x.ThemeName); } comboBoxColors.Update(); } catch (Exception) { ThemesCollection.InitializeList(); LabelErrorMessage.Text = "File Not Found"; } LabelErrorMessage.Text = ""; buttonSetColor.Enabled = false; radioButtonThemes.Checked = true; radioButtonSpecificDate.Checked = true; progressBar1.Visible = false; if (ThemesCollection.themesList.Count > 0) { ThemesCollection.InitializeList(); // comboBoxColors.SelectedItem = "default"; Themes x = ThemesCollection.GetActive(); if (x != null && String.IsNullOrEmpty(x.ThemeName) == false) { SetThemes(x.ThemeName); comboBoxColors.SelectedText = x.ThemeName; comboBoxColors.Text = x.ThemeName; } } else { SetThemes("default"); } radioButtonRecent.Checked = true; ThemesCollection.themesList.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(themesList_CollectionChanged); }