using System; using System.Collections.Generic; using System.Text; using System.ComponentModel; namespace Volian.CSLA.Library { [Serializable] [TypeConverter(typeof(ExpandableObjectConverter))] public class FolderConfig:INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; private void OnPropertyChanged(String info) { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(info)); } private XMLProperties _Xp; private XMLProperties Xp { get { return _Xp; } } public FolderConfig(string xml) { if (xml == string.Empty) xml = ""; _Xp = new XMLProperties(xml); } public FolderConfig() { _Xp = new XMLProperties(); } public override string ToString() { string s = _Xp.ToString(); if (s == "" || s == "") return string.Empty; return s; } #region FormatCategory public enum FormatColumns : int { Default=0,OneColumn,TwoColumn,ThreeColumn,FourColumns } [Category("Format")] [DisplayName("Column Layout")] [RefreshProperties(RefreshProperties.All)] [Description("Column Layout")] public FormatColumns Format_Columns { get { string s = _Xp["format", "columns"]; if (s == string.Empty) return (FormatColumns)0; return (FormatColumns)int.Parse(_Xp["format", "columns"]); //return Enum.Parse(typeof(FormatColumns),_Xp["format", "columns"]); } set { if (value == 0) _Xp["format", "columns"] = string.Empty; else _Xp["format", "columns"] = ((int)value).ToString(); OnPropertyChanged("Format_Columns"); } } [Category("Format")] [DisplayName("Plant Format Name")] [RefreshProperties(RefreshProperties.All)] [Description("Default Plant Format")] public string Format_Plant { get { return _Xp["format", "plant"]; } set { _Xp["format", "plant"] = value; OnPropertyChanged("Format_Plant"); } } #endregion #region DefaultsCategory [Category("Defaults")] [DisplayName("Default Setpoint Prefix")] [RefreshProperties(RefreshProperties.All)] [Description("Default Setpoint Prefix")] public string Default_SPPrefix { get { return _Xp["default", "spprefix"]; } set { _Xp["default", "spprefix"] = value; OnPropertyChanged("Default_SPPrefix"); } } [Category("Defaults")] [DisplayName("Default Image Prefix")] [RefreshProperties(RefreshProperties.All)] [Description("Default Image Prefix")] public string Default_IMPrefix { get { return _Xp["default", "imprefix"]; } set { _Xp["default", "imprefix"] = value; OnPropertyChanged("RO_IMPrefix"); } } #endregion #region PrintSettingsCategory [Category("Print Settings")] [DisplayName("Number of Copies")] [RefreshProperties(RefreshProperties.All)] [Description("Number of Copies")] public int Print_NumCopies { get { string s = _Xp["PrintSettings", "numcopies"]; if (s == string.Empty) return 1; return int.Parse(_Xp["PrintSettings", "numcopies"]); } set { _Xp["PrintSettings", "numcopies"] = value.ToString(); OnPropertyChanged("Print_NumCopies"); } } public enum PrintPagination : int { Free = 0, Fixed, Auto } [Category("Print Settings")] [DisplayName("Pagination")] [RefreshProperties(RefreshProperties.All)] [Description("Pagination")] public PrintPagination Print_Pagination { get { string s = _Xp["PrintSettings", "Pagination"]; if (s == string.Empty) return PrintPagination.Auto; return (PrintPagination)int.Parse(_Xp["PrintSettings", "Pagination"]); } set { if (value == PrintPagination.Auto) _Xp["PrintSettings", "Pagination"] = string.Empty; else _Xp["PrintSettings", "Pagination"] = ((int)value).ToString(); OnPropertyChanged("Print_Pagination"); } } public enum PrintWatermark : int { None = 0, Reference, Draft, Master, Sample, InformationOnly } [Category("Print Settings")] [DisplayName("Watermark")] [RefreshProperties(RefreshProperties.All)] [Description("Watermark")] public PrintWatermark Print_Watermark { get { string s = _Xp["PrintSettings", "Watermark"]; if (s == string.Empty) return PrintWatermark.Draft; return (PrintWatermark)int.Parse(_Xp["PrintSettings", "Watermark"]); } set { if (value == PrintWatermark.Draft) _Xp["PrintSettings", "Watermark"] = string.Empty; else _Xp["PrintSettings", "Watermark"] = ((int)value).ToString(); OnPropertyChanged("Print_Watermark"); } } [Category("Print Settings")] [DisplayName("Disable Duplex Printing")] [RefreshProperties(RefreshProperties.All)] [Description("Disable Duplex Printing")] public bool Print_DisableDuplex { get { string s = _Xp["PrintSettings", "disableduplex"]; if (s == string.Empty) return false; return bool.Parse(_Xp["PrintSettings", "disableduplex"]); } set { _Xp["PrintSettings", "disableduplex"] = value.ToString(); OnPropertyChanged("Print_DisableDuplex"); } } // Change Bar Use from 16-bit code: // No Default // Without Change Bars // With Default Change Bars // With User Specified Change Bars public enum PrintChangeBar : int { NoDefault=0, Without, WithDefault, WithUserSpecified } [Category("Print Settings")] [DisplayName("Change Bar")] [RefreshProperties(RefreshProperties.All)] [Description("Change Bar Use")] public PrintChangeBar Print_ChangeBar { get { string s = _Xp["PrintSettings", "ChangeBar"]; if (s == string.Empty) return PrintChangeBar.NoDefault; return (PrintChangeBar)int.Parse(_Xp["PrintSettings", "ChangeBar"]); } set { if (value == PrintChangeBar.NoDefault) _Xp["PrintSettings", "ChangeBar"] = string.Empty; else _Xp["PrintSettings", "ChangeBar"] = ((int)value).ToString(); OnPropertyChanged("Print_ChangeBar"); } } // User Specified Change Bar Location from16-bit code: // With Text // Outside Box // AER on LEFT, RNO on Right // To the Left of Text public enum PrintChangeBarLoc : int { WithText = 0, OutsideBox, AERleftRNOright, LeftOfText } [Category("Print Settings")] [DisplayName("Change Bar Location")] [RefreshProperties(RefreshProperties.All)] [Description("User Specified Change Bar Location")] public PrintChangeBarLoc Print_ChangeBarLoc { get { string s = _Xp["PrintSettings", "ChangeBarLoc"]; if (s == string.Empty) return PrintChangeBarLoc.WithText; return (PrintChangeBarLoc)int.Parse(_Xp["PrintSettings", "ChangeBarLoc"]); } set { if (value == PrintChangeBarLoc.WithText) _Xp["PrintSettings", "ChangeBarLoc"] = string.Empty; else _Xp["PrintSettings", "ChangeBarLoc"] = ((int)value).ToString(); OnPropertyChanged("Print_ChangeBarLoc"); } } // Change Bar Text from16-bit code: // Date and Change ID // Revision Number // Change ID // No Change Bar Message // User Defined Message public enum PrintChangeBarText : int { DateChgID = 0, RevNum, ChgID, None, UserDef } [Category("Print Settings")] [DisplayName("Change Bar Text")] [RefreshProperties(RefreshProperties.All)] [Description("Change Bar Text")] public PrintChangeBarText Print_ChangeBarText { get { string s = _Xp["PrintSettings", "ChangeBarText"]; if (s == string.Empty) return PrintChangeBarText.DateChgID; return (PrintChangeBarText)int.Parse(_Xp["PrintSettings", "ChangeBarText"]); } set { if (value == PrintChangeBarText.DateChgID) _Xp["PrintSettings", "ChangeBarText"] = string.Empty; else _Xp["PrintSettings", "ChangeBarText"] = ((int)value).ToString(); OnPropertyChanged("Print_ChangeBarText"); } } [Category("Print Settings")] [DisplayName("User Format")] [RefreshProperties(RefreshProperties.All)] [Description("User Format")] public string Print_UserFormat { get { return _Xp["PrintSettings", "userformat"]; } set { _Xp["PrintSettings", "userformat"] = value; OnPropertyChanged("Print_UserFormat"); } } [Category("Print Settings")] [DisplayName("User Change Bar Message1")] [RefreshProperties(RefreshProperties.All)] [Description("User Change Bar Message1")] public string Print_UserCBMess1 { get { return _Xp["PrintSettings", "usercbmess1"]; } set { _Xp["PrintSettings", "usercbmess1"] = value; OnPropertyChanged("Print_UserCBMess1"); } } [Category("Print Settings")] [DisplayName("User Change Bar Message2")] [RefreshProperties(RefreshProperties.All)] [Description("User Change Bar Message2")] public string Print_UserCBMess2 { get { return _Xp["PrintSettings", "usercbmess2"]; } set { _Xp["PrintSettings", "usercbmess2"] = value; OnPropertyChanged("Print_UserCBMess2"); } } #endregion } }