/// <summary> /// Loads the settings /// </summary> /// <returns></returns> public static GallerySettings Load() { string dbPath = FileUtil.GetExecutingDirectory(); string settingsFile = dbPath + "\\Settings.config"; GallerySettings settings = new GallerySettings(); if (File.Exists(settingsFile)) { string settingsText = File.ReadAllText(settingsFile); settings = StringSerialization.DeserializeFromString <GallerySettings>(settingsText); } return(settings); }
/// <summary> /// Finds the controller. /// </summary> /// <param name="settings">The settings.</param> /// <returns></returns> private static ControllerBase FindController(GallerySettings settings) { List<ControllerBase> controllers = GetControllers(); ControllerBase controllerBase = null; //Find which Controller to execute foreach (ControllerBase controller in controllers) { if (controller.View == settings.PresentationMode) { //retreive the contorl controllerBase = controller; break; } } return controllerBase; }
/// <summary> /// Handles the Click event of the saveButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void saveButton_Click(object sender, EventArgs e) { GallerySettings settings = new GallerySettings(); try { settings.GalleryTitle = galleryTitle.Text.Trim(); //set thumbnail height and Width settings.ThumbnailDimensions.Height = Convert.ToInt32(thumbnailHeight.Text.Trim()); settings.ThumbnailDimensions.Width = Convert.ToInt32(thumbnailWidth.Text.Trim()); //Set method of storage settings.DataStorage = EnumParse<DataStorage>.Parse(storageSelection.SelectedValue); //Set presentation mode settings.PresentationMode = EnumParse<PresentationMode>.Parse(presentationModeRadioButtonList.SelectedItem.Text); //Set current theme settings.Theme = themeDropdown.SelectedValue; //set fullsize height and Width settings.FullsizeDimensions.Height = Convert.ToInt32(fullsizeHeight.Text.Trim()); settings.FullsizeDimensions.Width = Convert.ToInt32(fullsizeWidth.Text.Trim()); //Sets the crossdomain file to the correct hosts. SaveCrossDomainXml(); settings.Save(); message.Text = AdminResources.SettingsSaved; } catch (Exception ex) { message.Text = ex.Message; } }
/// <summary> /// Loads the settings /// </summary> /// <returns></returns> public static GallerySettings Load() { string dbPath = FileUtil.GetExecutingDirectory(); string settingsFile = dbPath + "\\Settings.config"; GallerySettings settings = new GallerySettings(); if (File.Exists(settingsFile)) { string settingsText = File.ReadAllText(settingsFile); settings = StringSerialization.DeserializeFromString<GallerySettings>(settingsText); } return settings; }