//===================================================================== public object SetOption(string OptionName, object OptionValue) { ApplicationOption option = this.FindOrCreateOption(OptionName); option.OptionValue = OptionValue; return(option.OptionValue); }
//===================================================================== public ApplicationOption RemoveOption(string OptionName) { ApplicationOption option = this.FindOption(OptionName); if (option == null) { return(null); } this.Options.Remove(option); return(option); }
//===================================================================== public object GetOption(string OptionName) { if (this.Options == null) { return(null); } ApplicationOption option = this.FindOption(OptionName); if (option == null) { return(null); } return(option.OptionValue); }
//===================================================================== public void GetOption_WindowCoordinates(string WindowName, Form Window) { ApplicationOption location_x = this.FindOption(WindowName + ".Window.Location.X"); ApplicationOption location_y = this.FindOption(WindowName + ".Window.Location.Y"); ApplicationOption size_width = this.FindOption(WindowName + ".Window.Size.Width"); ApplicationOption size_height = this.FindOption(WindowName + ".Window.Size.Height"); if ((location_x != null) && (location_y != null)) { Window.Location = new Point((int)location_x.OptionValue, (int)location_y.OptionValue); } if ((size_width != null) && (size_height != null)) { Window.Size = new Size((int)size_width.OptionValue, (int)size_height.OptionValue); } return; }
//===================================================================== public ApplicationOption FindOrCreateOption(string OptionName) { if (this.Options == null) { return(null); } foreach (ApplicationOption option in this.Options) { if (option.OptionName == OptionName) { return(option); } } ApplicationOption new_option = new ApplicationOption(); new_option.OptionName = OptionName; this.Options.Add(new_option); return(new_option); }