public UISetting GetUISetting() { try { if (System.IO.File.Exists(UI_SETTING_PATH)) { XmlDocument _doc = new XmlDocument(); _doc.Load(UI_SETTING_PATH); //Get root element XmlElement _root = _doc.DocumentElement; //Get the record at the current index XmlElement _currentUI = (XmlElement)_root.ChildNodes[0]; if (_currentUI.ChildNodes.Count > 0) { //Show the record information UISetting _uiSetting = new UISetting(); _uiSetting.Type = _currentUI.Attributes["Type"].Value; _uiSetting.Name = _currentUI.GetElementsByTagName("Name")[0].InnerText; return(_uiSetting); } } return(null); } catch (Exception ex) { return(null); } }
public SplashScreen1() { InitializeComponent(); lblCopyright.Text = String.Format("Copyright © 2009 - {0}", DateTime.Now.Year.ToString()); SettingBL settingBL = new SettingBL(); UISetting uiSetting = new UISetting(); uiSetting = settingBL.GetUISetting(); if (uiSetting != null) { Singleton.Instance.UISettings = uiSetting; DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle(Singleton.Instance.UISettings.Name); } }
public frmDbUtility() { InitializeComponent(); oDbUtilityBL = new DbUtilityBL(); oDbUtilityBL.CurrentProgress = 0; oDbUtilityBL.HasError = false; settingBL = new SettingBL(); uiSetting = new UISetting(); //dbUtilityBL.OnProgressUpdate += dbUtility_OnProgressUpdate; UpdateCompletionStatus.OnNewCompletionStatus += dbUtility_OnProgressUpdate; barDevExpressStyle.Checked = true; Initialize(); }
private void barSkin_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { if (!String.IsNullOrWhiteSpace(e.Item.Caption)) { DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle(e.Item.Caption); ((BarCheckItem)e.Item).Checked = true; uiSetting = new UISetting() { Type = "Skin", Name = e.Item.Caption }; settingBL.Add(uiSetting); } }catch (Exception ex) { DbUtilityHelper.DisplayMessageBox(ex.Message, "error"); } }
public bool Add(UISetting uiSetting) { try { XmlDocument _doc = new XmlDocument(); //Create neccessary nodes XmlDeclaration _declaration = _doc.CreateXmlDeclaration("1.0", "UTF-8", "yes"); XmlElement _root = _doc.CreateElement("Settings"); XmlElement _ui = _doc.CreateElement("UI"); XmlAttribute _type = _doc.CreateAttribute("Type"); XmlElement _name = _doc.CreateElement("Name"); //Add the values for each nodes _type.Value = uiSetting.Type; _name.InnerText = uiSetting.Name; //Construct the document _doc.AppendChild(_declaration); //doc.AppendChild(comment); _doc.AppendChild(_root); _root.AppendChild(_ui); _ui.Attributes.Append(_type); _ui.AppendChild(_name); if (!Directory.Exists(LOCAL_APP_DATA)) { Directory.CreateDirectory(LOCAL_APP_DATA); } _doc.Save(UI_SETTING_PATH); return(true); } catch (Exception ex) { return(false); } }