private void load(ApplicationConfigManager config) { type = config.GetBindable <BackgroundType>(ApplicationSetting.Background); type.ValueChanged += _ => updateDisplay(); image = config.GetBindable <string>(ApplicationSetting.BackgroundImageFile); image.ValueChanged += _ => updateDisplay(); video = config.GetBindable <string>(ApplicationSetting.BackgroundVideoFile); video.ValueChanged += _ => updateDisplay(); updateDisplay(); }
public ActionResult Upgrading_Database_Ready() { SqlConnection sqlConnection = GetConnection(); //注册应用中的Application.Config foreach (var applicationConfig in ApplicationConfigManager.Instance().GetAllApplicationConfigs()) { if (applicationConfig.Element("tenantAttachmentSettings") != null) { TenantAttachmentSettings.RegisterSettings(applicationConfig.Element("tenantAttachmentSettings")); } if (applicationConfig.Element("tenantLogoSettings") != null) { TenantLogoSettings.RegisterSettings(applicationConfig.Element("tenantLogoSettings")); } } ConcurrentDictionary <string, string> messages = new ConcurrentDictionary <string, string>(); //修改3.2版本的表名 string reNameSqlFile = SetupHelper.GetUpgradeReNameFile(); try { SetupHelper.ExecuteInFile(sqlConnection, reNameSqlFile, out messages); } catch (Exception e) { if (!messages.ContainsKey("在文件:" + reNameSqlFile + " 中产生异常")) { messages["在文件:" + reNameSqlFile + " 中产生异常"] = e.Message + "\r\n"; } else { messages["在文件:" + reNameSqlFile + " 中产生异常"] += e.Message + "\r\n"; } } foreach (var message in messages) { WriteLogFile(string.Format("{0}:{1}", message.Key, message.Value)); } if (messages.Count > 0) { return(Json(new StatusMessageData(StatusMessageType.Error, "升级数据库准备失败,请查看升级日志"))); } else { return(Json(new StatusMessageData(StatusMessageType.Success, "升级数据库准备就绪。"))); } }
private void load(ApplicationConfigManager config, BackgroundImageStore images, BackgroundVideoStore videos) { ox = config.GetBindable <float>(ApplicationSetting.BackgroundOffsetX); ox.ValueChanged += _ => updatePosition(); oy = config.GetBindable <float>(ApplicationSetting.BackgroundOffsetY); oy.ValueChanged += _ => updatePosition(); sx = config.GetBindable <float>(ApplicationSetting.BackgroundScaleXY); sx.ValueChanged += _ => updatePosition(); switch (Type) { case BackgroundType.Color: AddInternal(new Box()); break; case BackgroundType.Image: if (string.IsNullOrEmpty(asset)) { return; } AddInternal(new Sprite { Texture = images.Get(asset), Size = Vector2.One, FillMode = FillMode.Fill }); break; case BackgroundType.Video: if (string.IsNullOrEmpty(asset)) { return; } AddInternal(new Video(videos.Get(asset))); break; } InternalChild.RelativeSizeAxes = Axes.Both; colour = config.GetBindable <string>(ApplicationSetting.BackgroundColor); colour.BindValueChanged((e) => updateColour(), true); }
private void load(ApplicationConfigManager config, BackgroundImageStore images, BackgroundVideoStore videos) { type = config.GetBindable <BackgroundType>(ApplicationSetting.Background); ox = config.GetBindable <float>(ApplicationSetting.BackgroundOffsetX); oy = config.GetBindable <float>(ApplicationSetting.BackgroundOffsetY); sx = config.GetBindable <float>(ApplicationSetting.BackgroundScaleXY); colorConfig = config.GetBindable <string>(ApplicationSetting.BackgroundColor); imageConfig = config.GetBindable <string>(ApplicationSetting.BackgroundImageFile); videoConfig = config.GetBindable <string>(ApplicationSetting.BackgroundVideoFile); Children = new Drawable[] { new ThemedSpriteText { Font = SegoeUI.Bold.With(size: 18), Text = "Preview" }, new Container { RelativeSizeAxes = Axes.X, CornerRadius = 5.0f, Masking = true, Margin = new MarginPadding { Bottom = 10 }, Height = 250, Width = 0.95f, Children = new Drawable[] { new Box { Colour = Colour4.Black, RelativeSizeAxes = Axes.Both, }, new Background(false) { RelativeSizeAxes = Axes.Both, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, }, EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Shadow, Colour = Colour4.Black.Opacity(0.2f), Radius = 10.0f, Hollow = true, }, }, new ThemedSpriteText { Font = SegoeUI.Bold.With(size: 18), Text = "Display" }, new LabelledEnumDropdown <BackgroundType> { Label = "Type", Current = type, }, imagesDropdown = new LabelledFileDropdown <Texture> { Label = "Image", ItemSource = images.Loaded, }, videosDropdown = new LabelledFileDropdown <Stream> { Label = "Video", ItemSource = videos.Loaded, }, colourPicker = new ColourPicker { Current = new Bindable <Colour4>(), }, new ThemedTextButton { Text = "Open Folder", Width = 200, Action = () => images.OpenInNativeExplorer(), }, offsetConfigContainer = new FillFlowContainer { Spacing = new Vector2(0, 10), AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Direction = FillDirection.Vertical, Children = new Drawable[] { new ThemedSpriteText { Font = SegoeUI.Bold.With(size: 18), Text = "Offset" }, new FillFlowContainer { Alpha = type.Value != BackgroundType.Color ? 1 : 0, Direction = FillDirection.Horizontal, AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Spacing = new Vector2(10, 0), Children = new Drawable[] { new LabelledNumberBox { Label = "X", Width = 50, Current = inputOffsetX, }, new LabelledNumberBox { Label = "Y", Width = 50, Current = inputOffsetY, }, new LabelledNumberBox { Label = "Scale", Width = 50, Current = inputScaleXY, }, new ThemedIconButton { Icon = FluentSystemIcons.Filled.Drag24, Size = new Vector2(25), Style = ButtonStyle.Override, Action = enableBackgroundAdjustments, IconSize = new Vector2(15), LabelColour = ThemeColour.NeutralPrimary, Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, }, new ThemedIconButton { Icon = FluentSystemIcons.Filled.ArrowUndo24, Size = new Vector2(25), Style = ButtonStyle.Override, Action = resetBackgroundOffsets, IconSize = new Vector2(15), LabelColour = ThemeColour.NeutralPrimary, Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, }, } }, } }, }; type.BindValueChanged(handleTypeChange, true); imagesDropdown.Current.ValueChanged += e => imageConfig.Value = e.NewValue?.Name ?? string.Empty; imagesDropdown.Current.Value = images.GetReference(imageConfig.Value); videosDropdown.Current.ValueChanged += e => videoConfig.Value = e.NewValue?.Name ?? string.Empty; videosDropdown.Current.Value = videos.GetReference(videoConfig.Value); colourPicker.Current.ValueChanged += e => colorConfig.Value = e.NewValue.ToHex(); colourPicker.Current.Value = Colour4.FromHex(colorConfig.Value); inputOffsetX.ValueChanged += e => { if (float.TryParse(e.NewValue, out float x)) { ox.Value = x; } }; inputOffsetY.ValueChanged += e => { if (float.TryParse(e.NewValue, out float y)) { oy.Value = y; } }; inputScaleXY.ValueChanged += e => { if (float.TryParse(e.NewValue, out float s)) { sx.Value = s; } }; ox.ValueChanged += e => inputOffsetX.Value = e.NewValue.ToString(); oy.ValueChanged += e => inputOffsetY.Value = e.NewValue.ToString(); sx.ValueChanged += e => inputScaleXY.Value = e.NewValue.ToString(); }
private void load(ApplicationConfigManager appConfig, FrameworkConfigManager frameworkConfig, VignetteApplicationBase app, GameHost host, TextureStore textures, ThemeStore themes, Storage storage) { if (host.Window != null) { currentDisplay.BindTo(host.Window.CurrentDisplayBindable); windowModes.BindTo(host.Window.SupportedWindowModes); } var windowSizeBindable = frameworkConfig.GetBindable <Size>(FrameworkSetting.WindowedSize); var brandingText = new ThemedTextFlowContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, AutoSizeAxes = Axes.Y, TextAnchor = Anchor.BottomCentre, RelativeSizeAxes = Axes.X, }; brandingText.AddText(app.Version, (s) => s.Font = SegoeUI.SemiBold.With(size: 16, fixedWidth: true)); Children = new Drawable[] { new ThemedSpriteText { Font = SegoeUI.Bold.With(size: 18), Text = "Interface" }, themesDropdown = new ThemeSettingDropdown { Label = "Theme", ItemSource = themes.Loaded, }, new ThemedTextButton { Text = "Open Themes Folder", Width = 200, Action = () => themes.OpenInNativeExplorer(), }, new ThemedSpriteText { Font = SegoeUI.Bold.With(size: 18), Text = "Graphics" }, new LabelledDropdown <WindowMode> { Label = "Window Mode", ItemSource = windowModes, Current = frameworkConfig.GetBindable <WindowMode>(FrameworkSetting.WindowMode), }, resizableCheckbox = new ThemedCheckbox { Text = "Resizable Window", Current = appConfig.GetBindable <bool>(ApplicationSetting.WindowResizable), }, resolutionDropdown = new ResolutionSettingDropdown { Label = "Resolution", ItemSource = resolutions, Current = frameworkConfig.GetBindable <Size>(FrameworkSetting.SizeFullscreen), }, new LabelledEnumDropdown <FrameSync> { Label = "Frame Limiter", Current = frameworkConfig.GetBindable <FrameSync>(FrameworkSetting.FrameSync), }, new LabelledEnumDropdown <ExecutionMode> { Label = "Threading Mode", Current = frameworkConfig.GetBindable <ExecutionMode>(FrameworkSetting.ExecutionMode), }, new ThemedSpriteText { Font = SegoeUI.Bold.With(size: 18), Text = "Debug" }, new ThemedCheckbox { Text = "Show FPS", Current = appConfig.GetBindable <bool>(ApplicationSetting.ShowFpsOverlay), }, new ThemedCheckbox { Text = "Show Log Overlay", Current = frameworkConfig.GetBindable <bool>(FrameworkSetting.ShowLogOverlay), }, new ThemedTextButton { Text = "Open Vignette Folder", Width = 200, Action = () => storage.OpenInNativeExplorer(), }, new ThemedTextButton { Text = "Open Logs Folder", Width = 200, Action = () => storage.OpenPathInNativeExplorer("./logs"), }, new FillFlowContainer { Margin = new MarginPadding { Top = 30 }, Spacing = new Vector2(0, 15), Direction = FillDirection.Vertical, AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Children = new Drawable[] { new ThemedSprite { Size = new Vector2(32), Anchor = Anchor.Centre, Origin = Anchor.Centre, Texture = textures.Get("branding"), }, brandingText } } }; resolutionDropdown.Current.BindValueChanged((e) => windowSizeBindable.Value = e.NewValue, true); resizableCheckbox.Current.BindValueChanged((e) => { if (host.Window is SDL2DesktopWindow window) { window.Resizable = e.NewValue; } resolutionDropdown.Alpha = !e.NewValue ? 1 : 0; if (!e.NewValue) { resolutionDropdown.Current.TriggerChange(); } }, true); var themeConfig = appConfig.GetBindable <string>(ApplicationSetting.Theme); themesDropdown.Current.Value = themes.GetReference(themeConfig.Value); themesDropdown.Current.ValueChanged += e => themeConfig.Value = e.NewValue.Name; }