public static void ChangeTheme(Application app, Accent newAccent, Theme newTheme) { if (app == null) throw new ArgumentNullException("app"); var oldTheme = DetectTheme(app); ChangeTheme(app.Resources, oldTheme, newAccent, newTheme); }
// SelectTheme public static List<Theme> FakeThemesByCurriculumId() { Theme fakeTheme = new Theme(); fakeTheme.Id = 1; fakeTheme.Name = "Тема1"; return new List<Theme>() { fakeTheme }; }
public ActionResult Create(int stageId, CreateThemeModel model) { try { Theme theme = new Theme { CourseRef = model.CourseId == Constants.NoCourseId ? (int?)null : model.CourseId, StageRef = model.StageId, ThemeTypeRef = model.ThemeTypeId, Name = model.ThemeName }; AddValidationErrorsToModelState(Validator.ValidateTheme(theme).Errors); if (ModelState.IsValid) { Storage.AddTheme(theme); return RedirectToAction("Index", new { StageId = model.StageId }); } else { SaveValidationErrors(); return RedirectToAction("Create"); } } catch (Exception e) { throw e; } }
public static string GetName(Theme type) { string result = String.Empty; switch (type) { case Theme.Blue: result = "blue"; break; case Theme.Gray: result = "gray"; break; case Theme.Access: result = "access"; break; //case ThemeType.Slate: // result = "slate"; // break; //case ThemeType.Black: // result = "black"; // break; } return result; }
public ThemeListItemViewModel(Theme theme) { this.Guid = theme.Guid; this.Title = theme.Title; this.Cost = theme.Cost; this.ImageUrl = theme.Images.First().Url; }
public long CreateTheme(string bgColor, string fColor, string hColor, string mColor, int userId) { long themeId = 0; string result = string.Empty; try { Theme theme = new Theme() { UserId = userId, BackgroundColor = System.Drawing.ColorTranslator.FromHtml(String.Format("{0}", bgColor)), HighlightColor = System.Drawing.ColorTranslator.FromHtml(String.Format("{0}", hColor)), FontColor = System.Drawing.ColorTranslator.FromHtml(String.Format("{0}", fColor)), MagnificationColor = System.Drawing.ColorTranslator.FromHtml(String.Format("{0}", mColor)) }; result = OBSDataSource.CreateTheme(theme, out themeId); if (string.IsNullOrEmpty(result)) { return themeId; } } catch (Exception ex) { ExceptionLogger.LogException(ex, "AccountController.CreateTheme"); } return 0; }
internal void AddTheme(Theme theme, DateTime partyDate) { if (!this.Items.Any(o => o.Product.Guid == theme.Guid)) { this.Items.Add(new CartItem(theme, partyDate)); } }
/// <summary> /// Checks if related to theme package has been already uploaded. /// In case it was not uploaded - upload package. /// Check attempt has been created and get attempt id. /// </summary> /// <param name="theme">Theme object represents specified theme.</param> /// <returns>Long integer value representing attempt id.</returns> public long GetAttemptId(Theme theme) { GetCurrentUserIdentifier(); AttemptItemIdentifier attemptId = null; ActivityPackageItemIdentifier organizationId; var packageId = GetPackageIdentifier(theme.CourseRef.Value); // in case package has not been uploaded yet. if (packageId == null) { string zipPath = CourseService.Export(theme.CourseRef.Value); Package package = new ZipPackage(zipPath); package.CourseID = theme.CourseRef.Value; packageId = AddPackage(package); organizationId = GetOrganizationIdentifier(packageId); attemptId = CreateAttempt(organizationId.GetKey(), theme.Id); } // otherwise check if attempt was created else { organizationId = GetOrganizationIdentifier(packageId); AttemptItemIdentifier attId = GetAttemptIdentifier(organizationId, theme.Id); if (attId != null) { attemptId = attId; } else { attemptId = CreateAttempt(organizationId.GetKey(), theme.Id); } } return attemptId.GetKey(); }
public ThemeChooser() { var theme1 = new Theme("/Content/Images/Application/MainViewPanoramaBackgrounds/empty_background.png", "/Content/Images/Application/MainViewPanoramaBackgrounds/CroppedImages/empty_background.png") { AccentColor1 = new PortableSolidColorBrush(255, 128, 0, 128), AccentColor2 = new PortableSolidColorBrush(255, 0, 128, 0), AccentColor3 = new PortableSolidColorBrush(255, 155, 165, 0), AppBarBackgroundBrush = new PortableSolidColorBrush("#FF333333"), AppBarButtonBrush = new PortableSolidColorBrush("#FFFFFFFF"), AppBarButtonClickBrush = new PortableSolidColorBrush("#FFFFFFFF"), }; var theme2 = new Theme("/Content/Images/Application/MainViewPanoramaBackgrounds/MainViewPanorama_cats_blue.png", "/Content/Images/Application/MainViewPanoramaBackgrounds/CroppedImages/MainViewPanorama_cats_blue_small.png") { AccentColor1 = new PortableSolidColorBrush(255, 128, 0, 128), AccentColor2 = new PortableSolidColorBrush(255, 0, 128, 0), AccentColor3 = new PortableSolidColorBrush(255, 155, 165, 0), AppBarBackgroundBrush = new PortableSolidColorBrush(255, 50, 50, 50) }; var theme3 = new Theme("/Content/Images/Application/MainViewPanoramaBackgrounds/MainViewPanorama_cats_pink.png", "/Content/Images/Application/MainViewPanoramaBackgrounds/CroppedImages/MainViewPanorama_cats_pink_small.png") { AccentColor1 = new PortableSolidColorBrush(255, 128, 0, 128), AccentColor2 = new PortableSolidColorBrush(255, 0, 128, 0), AccentColor3 = new PortableSolidColorBrush(255, 155, 165, 0), AppBarBackgroundBrush = new PortableSolidColorBrush(255, 50, 50, 50) }; _themes = new ObservableCollection<Theme>() {theme1, theme2, theme3}; _selectedTheme = _themes[0]; }
public static void ApplyTheme(this Application application, Theme? theme, SolidColorBrush accentBrush, SolidColorBrush contrastBrush) { ValidationHelper.NotNull(application, () => application); application.Dispatcher.Invoke(new ApplyThemeToApplicationDelegate(ApplyThemeInternal), DispatcherPriority.Render, application, theme, accentBrush, contrastBrush); }
public static void Setup() { var theme = new Theme(); CurrentTheme = theme; CodeFramework.iOS.Theme.CurrentTheme = theme; RepositoryCellView.RoundImages = false; MonoTouch.Dialog.StyledStringElement.DefaultTitleFont = UIFont.SystemFontOfSize(15f); MonoTouch.Dialog.NameTimeStringElement.NameColor = Theme.CurrentTheme.MainTitleColor; UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent; UINavigationBar.Appearance.TintColor = UIColor.White; UINavigationBar.Appearance.BarTintColor = UIColor.FromRGB(50, 50, 50); UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes { TextColor = UIColor.White, Font = UIFont.SystemFontOfSize(18f) }); CodeFramework.iOS.Utils.Hud.BackgroundTint = UIColor.FromRGBA(228, 228, 228, 128); UserVoice.UVStyleSheet.Instance.NavigationBarTintColor = UIColor.White; UserVoice.UVStyleSheet.Instance.NavigationBarTextColor = UIColor.White; UISegmentedControl.Appearance.TintColor = UIColor.FromRGB(110, 110, 117); UITableViewHeaderFooterView.Appearance.TintColor = UIColor.FromRGB(228, 228, 228); UILabel.AppearanceWhenContainedIn(typeof(UITableViewHeaderFooterView)).TextColor = UIColor.FromRGB(136, 136, 136); UILabel.AppearanceWhenContainedIn(typeof(UITableViewHeaderFooterView)).Font = UIFont.SystemFontOfSize(13f); UIToolbar.Appearance.BarTintColor = UIColor.FromRGB(245, 245, 245); UIBarButtonItem.AppearanceWhenContainedIn(typeof(UISearchBar)).SetTitleTextAttributes(new UITextAttributes {TextColor = UIColor.White}, UIControlState.Normal); // CodeFramework.Elements.NewsFeedElement.LinkColor = theme.MainTitleColor; // CodeFramework.Elements.NewsFeedElement.TextColor = theme.MainTextColor; // CodeFramework.Elements.NewsFeedElement.NameColor = theme.MainTitleColor; }
public MenuItem(Theme theme, TextFormat font, float x, float y, float width, float height, Menu parentMenu, string text, string extraData) : base(theme, font, x, y, width, height) { this.parentMenu = parentMenu; this.Text = text; this.extraData = extraData; }
/// <summary> /// Embed a YouTube video with the Player API options /// https://developers.google.com/youtube/youtube_player_demo /// </summary> /// <param name="videoItem">The video item</param> /// <param name="width">The width of the video the height will be automatically calculated at 16:9 ratio. Default is 640</param> /// <param name="autoPlay">A boolean to enable the video to autoplay. Default is false</param> /// <param name="showControls">A boolean to show or hide the controls. Default is true</param> /// <param name="enableJsApi">A boolean to enable the video to be controlled with the JS API. Default is false</param> /// <param name="loop">A boolean to enable the video to loop when finished. Default is false</param> /// <param name="modestBranding">A boolean to show more modest YouTube branding & logos. Default is false</param> /// <param name="rel">A boolean to enable related videos to be displaed at the end of the video playing. Default is true</param> /// <param name="showInfo">A boolean to display the video title & rating before the video plays. Default is true</param> /// <param name="theme">An enum of styles that change the control styles</param> /// <returns>A raw string with the iframe embed HTML with the appeneded options</returns> public static string EmbedVideoWithOptions(this Video videoItem, int width = 640, bool autoPlay = false, bool showControls = true, bool enableJsApi = false, bool loop = false, bool modestBranding = false, bool rel = true, bool showInfo = true, Theme theme = Theme.dark) { // From width calculate height (16:9 ratio) // 640 width = 340 height // 640 / 16 = 40 // 40 * 9 = 340 var height = (width/16) * 9; //Convert booleans to 0 or 1 strings for YouTube querystring params var autoPlayString = autoPlay ? "1" : "0"; var showControlsString = showControls ? "1" : "0"; var enableJsApiString = enableJsApi ? "1" : "0"; var loopString = loop ? "1" : "0"; var modestBrandingString = modestBranding ? "1" : "0"; var relString = rel ? "1" : "0"; var showInfoString = showInfo ? "1" : "0"; //If we use JS API ensure the ID for the iframe is unique var uniqueHtmlId = string.Format("youtubevideo-{0}", videoItem.Id); var embedHtml = string.Format("<iframe id='{0}' type='text/html' width='{1}' height='{2}' src='https://www.youtube.com/embed/{3}?autoplay={4}&controls={5}&enablejsapi={6}&loop={7}&modestbranding={8}&rel={9}&showinfo={10}&theme={11}' frameborder='0' allowfullscreen></iframe>", uniqueHtmlId, width, height, videoItem.Id, autoPlayString, showControlsString, enableJsApiString, loopString, modestBrandingString, relString, showInfoString, theme); return embedHtml; }
public Window(Form targetForm, Theme theme, Size maximumSize, Padding margin) { // ... Suspend(); // Properties first TargetForm = targetForm; Theme = theme; Margin = margin; // Throw an exception, if maximum size is less than bitmap if (maximumSize.Width < theme.Width || maximumSize.Height < theme.Height) { throw new Exception($"Maximum size of layered windows must be greater than bitmap size. MaximumSize: {maximumSize}; Bitmap.Size: Width={theme.Width}, Height={theme.Height};"); } // Think about Window class as a single window, it's definetly larger than target form. maximumSize = new Size( maximumSize.Width + theme.Metrics.Left.Width + theme.Metrics.Right.Width + Math.Abs(margin.Horizontal), maximumSize.Height + theme.Metrics.Top.Height + theme.Metrics.Bottom.Height + Math.Abs(margin.Vertical) ); // Creating each side with specific surface sizes depending on how they will be used _left = new WindowSide(this, new Size(theme.Metrics.Left.Width, maximumSize.Height)); _right = new WindowSide(this, new Size(theme.Metrics.Right.Width, maximumSize.Height)); // Horizontal sides _top = new WindowSide(this, new Size(maximumSize.Width, theme.Metrics.Top.Height)); _bottom = new WindowSide(this, new Size(maximumSize.Width, theme.Metrics.Bottom.Height)); // ... Resume(false); }
protected override void Initialize(System.Web.Routing.RequestContext requestContext) { base.Initialize(requestContext); HttpContext ctx = System.Web.HttpContext.Current; ViewBag.year = UDF.GetYearCookie(ctx); ViewBag.make = UDF.GetMakeCookie(ctx); ViewBag.model = UDF.GetModelCookie(ctx); ViewBag.style = UDF.GetStyleCookie(ctx); ViewBag.vehicleID = UDF.GetVehicleCookie(ctx); // Get the theme ID int themeID = new Theme().getTheme(ctx); ViewBag.themeID = themeID; if (themeID > 0) { // if there is an active theme, get the files string cname = this.ControllerContext.Controller.ToString(); Dictionary<int, List<ThemeFile>> themefiles = new Theme().getFiles(ctx,UDF.GetControllerName(cname)); ViewBag.themefiles = themefiles; } // We're gonna dump our Customer Session object out Customer customer = new Customer(); customer.GetFromStorage(ctx); Settings settings = new Settings(); ViewBag.settings = settings; ViewBag.customer = customer; }
public GeneralOptions(Theme theme, bool highlightTail, double highlightTailDuration, int scale) { Theme = theme; HighlightTail = highlightTail; HighlightDuration = highlightTailDuration; Scale = scale; }
public static void ChangeTheme(ResourceDictionary r, Accent accent, Theme theme) { ThemeIsDark = (theme == Theme.Dark); var themeResource = (theme == Theme.Light) ? LightResource : DarkResource; Util.ApplyResourceDictionary(themeResource, r); Util.ApplyResourceDictionary(accent.Resources, r); }
public ActionLink BuildLink(Theme theme) { RouteValueDictionary routeValueDictionary = new RouteValueDictionary(); routeValueDictionary.Add("id", theme.Id); ActionLink actionLink = new ActionLink("Play", "Training", routeValueDictionary); return actionLink; }
public void CalculateSpecializedResultTest() { User usr = new User() { Username = "******" }; Theme thm = new Theme() { Name = "Theme One" }; IUDICO.Common.Models.Shared.Statistics.AttemptResult AR = new IUDICO.Common.Models.Shared.Statistics.AttemptResult(1, usr, thm, IUDICO.Common.Models.Shared.Statistics.CompletionStatus.Completed, IUDICO.Common.Models.Shared.Statistics.AttemptStatus.Completed, IUDICO.Common.Models.Shared.Statistics.SuccessStatus.Passed, DateTime.Now, 0.5f); ThemeResult themeRes = new ThemeResult(usr, thm); List<AttemptResult> ARL = new List<AttemptResult>(); ARL.Add(AR); themeRes.AttemptResults = ARL; themeRes.GetThemeResultScore(); CurriculumResult currRes = new CurriculumResult(); currRes.ThemeResult.Add(themeRes); Curriculum curr = null; currRes.CalculateSumAndMax(usr, curr); SpecializedResult target = new SpecializedResult(); target.CurriculumResult.Add(currRes); target.CalculateSpecializedResult(usr); double? ExpectedSum = 50.0; double? ExpectedMax = 100.0; double? ExpectedPercent = 50.0; char ExpextedECTS = 'F'; Assert.AreEqual(ExpectedSum, target.Sum); Assert.AreEqual(ExpectedMax, target.Max); Assert.AreEqual(ExpectedPercent, target.Percent); Assert.AreEqual(ExpextedECTS, target.ECTS); }
public void CreateAssets() { if (_sandboxProject == null) { _sandboxProject = SandboxProject; _andre = Instance.Get.MemberByID("Member:1000"); _danny = Instance.Get.MemberByID("Member:1005"); Theme theme1 = _sandboxProject.CreateTheme("Theme 1"); Theme theme2 = _sandboxProject.CreateTheme("Theme 2"); Theme theme11 = theme1.CreateChildTheme("Child Theme 1"); theme1.Customer = _andre; theme1.Source.CurrentValue = "Customer"; theme1.Risk.CurrentValue = "Medium"; theme1.Priority.CurrentValue = "Medium"; theme1.Save(); theme2.Customer = _danny; theme2.Source.CurrentValue = "Sales"; theme2.Risk.CurrentValue = "Low"; theme2.Priority.CurrentValue = "Low"; theme2.Save(); theme11.Customer = _andre; theme11.Source.CurrentValue = "Customer"; theme11.Risk.CurrentValue = "Medium"; theme11.Priority.CurrentValue = "Medium"; theme11.Source.CurrentValue = "Sales"; theme11.Save(); _theme1 = theme1; } }
public static void ChangeTheme(Window window, Accent newAccent, Theme newTheme) { if (window == null) throw new ArgumentNullException("window"); var oldTheme = DetectTheme(window); ChangeTheme(window.Resources, oldTheme, newAccent, newTheme); }
void ChangeTheme() { if (currentTheme == Theme.Dark) { // remove old theme Application.Current.Resources.MergedDictionaries.Remove( Application.Current.Resources.MergedDictionaries.FirstOrDefault( x => x.Source.OriginalString.Equals(DarkThemePath) ) ); // apply new theme var newTheme = new ResourceDictionary(); newTheme.Source = new Uri(LightThemePath, UriKind.Relative); Application.Current.Resources.MergedDictionaries.Add(newTheme); currentTheme = Theme.Light; } else { // remove old theme Application.Current.Resources.MergedDictionaries.Remove( Application.Current.Resources.MergedDictionaries.FirstOrDefault( x => x.Source.OriginalString.Equals(LightThemePath) ) ); // apply new theme var newTheme = new ResourceDictionary(); newTheme.Source = new Uri(DarkThemePath, UriKind.Relative); Application.Current.Resources.MergedDictionaries.Add(newTheme); currentTheme = Theme.Dark; } }
internal static void UpdateTheme(ResourceDictionary resourceDictionary, Theme theme) { ResourceDictionary brushResourceDictionary = resourceDictionary.FindDictionary(BrushDictionaryUri.ToString()); if (brushResourceDictionary != null) { if (theme == Theme.Dark) { brushResourceDictionary.ReplaceDictionary(LightColorDictionaryUri, DarkColorDictionaryUri); } else { brushResourceDictionary.ReplaceDictionary(DarkColorDictionaryUri, LightColorDictionaryUri); } } else { if (theme == Theme.Dark) { resourceDictionary.MergedDictionaries.Add( new ResourceDictionary() { Source = DarkColorDictionaryUri }); } else { resourceDictionary.MergedDictionaries.Add( new ResourceDictionary() { Source = LightColorDictionaryUri }); } } }
public ActionLink BuildLink(Theme theme) { var c = PluginController.LmsService.FindService<ICourseService>().GetCourse(theme.CourseRef.Value); RouteValueDictionary routeValueDictionary = new RouteValueDictionary(); routeValueDictionary.Add("id", c.Id); ActionLink actionLink = new ActionLink("Training", "Play", new RouteValueDictionary(routeValueDictionary)); return actionLink; }
private void TestLoadedFromJson(Theme theme) { var styleManager = Utils.CreateStyleManager(theme); var stylesProperty = styleManager.GetType().GetProperty("Styles", BindingFlags.Instance | BindingFlags.NonPublic); var styles = (IDictionary<String, FormatDefinitionStyle>)stylesProperty.GetGetMethod(true).Invoke(styleManager, new Object[0]); Assert.IsTrue(styles.Count > 0, $"Styles for {theme} theme not loaded"); }
public void AddTheme(Theme theme, bool isDefault) { _themes.Register(theme); if (isDefault) { _defaultThemeName = theme.Name; } }
private void ApplyTheme(Theme theme) { var uri = new Uri($"ms-appx:///Styles/{theme}.xaml", UriKind.Absolute); var resourceDictionary = new ResourceDictionary { Source = uri }; Resources.MergedDictionaries.Add(resourceDictionary); }
//Set init value from FileReader private void SetValue() { //Playback switch (sPlayback) { case "ORDER": PlayManager._Playback = PlayManager.Playback.ORDER; break; case "RANDOM": PlayManager._Playback = PlayManager.Playback.RANDOM; break; default: break; } //Repeat switch (sRepeat) { case "ALL": PlayManager._Repeat = PlayManager.Repeat.ALL; break; case "NO": PlayManager._Repeat = PlayManager.Repeat.NO; break; case "ONE": PlayManager._Repeat = PlayManager.Repeat.ONE; break; default: break; } //Theme switch (sTheme) { case "WINTER": _Theme = SettingManager.Theme.WINTER; break; case "SPRING": _Theme = SettingManager.Theme.SPRING; break; default: break; } //Color switch (sColor) { case "BLUE": _Color = SettingManager.Color.BLUE; break; case "RED": _Color = SettingManager.Color.RED; break; case "YELLOW": _Color = SettingManager.Color.YELLOW; break; default: break; } }
/// <summary> /// Changes the theme. /// </summary> /// <param name="window">The window.</param> /// <param name="theme">The theme.</param> /// <param name="themeColor">Color of the theme.</param> public static void ChangeTheme( Window window, Theme theme, string themeColor) { Accent accent = ThemeManager.DefaultAccents.First(x => x.Name == themeColor); ThemeManager.ChangeTheme(window.Resources, accent, theme); }
/// <summary> /// Changes the theme. /// </summary> /// <param name="theme">The theme.</param> /// <param name="themeColor">Color of the theme.</param> public void ChangeTheme( Theme theme, string themeColor) { ThemeManagerExtensions.ChangeTheme( this, theme, themeColor); }
public void SetRoute(Analyze.Route route, bool state) { if (route == null) { return; } var n = route.Count; var trackEntity = Ctx.TrackEntity; for (int idx = 1; idx < n - 1; ++idx) { var r = route[idx]; if (r == null) { continue; } if (trackEntity?.Viewer != null) { string themeIcon = null; var trackInfo = trackEntity.Track.Get(r.X, r.Y); if (trackInfo != null) { var themeInfo = Theme?.Get(trackInfo.ThemeId); if (themeInfo != null) { TrackCheckResult checkResult = null; TrackInformation.S88 s88item = null; var w = Ctx.Dispatcher.Weaver; var objItems = w.GetObject(trackInfo); if (objItems != null && objItems.Count > 0) { s88item = objItems[0] as S88; var checkFnc = w.GetCheckFnc(s88item, trackInfo); if (checkFnc != null) { checkResult = checkFnc(); } } if (checkResult == null) { if (state) { if (Route.HasPoint(route, trackInfo.X, trackInfo.Y)) { themeIcon = themeInfo.Off.Route; } else { themeIcon = themeInfo.Off.Default; } } else { themeIcon = themeInfo.Off.Default; } } else { bool rS88 = checkResult?.State != null && checkResult.State.Value; if (rS88 && s88item != null) { if (s88item.IsRouted) { themeIcon = themeInfo.Active.Route; } else { themeIcon = themeInfo.Active.Occ; } } else { if (s88item != null && s88item.IsRouted) { themeIcon = themeInfo.Off.Route; } else { if (state && Route.HasPoint(route, trackInfo.X, trackInfo.Y)) { themeIcon = themeInfo.Off.Route; } else { themeIcon = themeInfo.Off.Default; } } } } } } if (!string.IsNullOrEmpty(themeIcon)) { var x = trackInfo.X; var y = trackInfo.Y; var themeId = trackInfo.ThemeId; var orientation = trackInfo.Orientation; var symbol = themeIcon; var isSwitch = RailwayEssentialCore.Globals.SwitchIds.Contains(themeId); if (r.HasTurn && isSwitch) { var parts = symbol.Split(new[] { '-' }, StringSplitOptions.RemoveEmptyEntries); if (parts.Length == 2) { symbol = parts[0] + "-t-" + parts[1]; } else if (parts.Length == 1) { symbol = parts[0] + "-t"; } } Ctx.ExecuteJs($"changeSymbol({x}, {y}, {themeId}, \"{orientation}\", \"{symbol}\");"); } } } }
public override Widget build(BuildContext context) { if (width == null) { width = MediaQuery.of(context).size.width; } return (new Container( child: new Center( child: new Card( shape: new RoundedRectangleBorder( borderRadius: BorderRadius.all(5.0f) ), child: new Container( width: width * 0.95f , child: new Padding( padding: EdgeInsets.only(8, 8, 8, 8) , child: new Column( children: new List <Widget>() { new Container( alignment: Alignment.centerLeft , padding: EdgeInsets.only(0, 4, 0, 4) , child: new Text(data: "这是名字标题", style: Theme.of(context).textTheme.headline) ) , new Row( children: new List <Widget>() { Image.asset( "products/backpack", fit: BoxFit.cover, width: 60, height: 60 ) , new Expanded( child: new Column( children: new List <Widget>() { new Container( height: 60 , padding: EdgeInsets.only(12, 4, 12, 4) , alignment: Alignment.topLeft , child: new Text(data: "这是一个帅气的简介这是一个帅气这是一个帅气这是一个帅气这是一个帅气这是一个帅气这是一个帅气" , style: Theme.of(context).textTheme.body1.copyWith(color: Colors.black54) , overflow: Unity.UIWidgets.rendering.TextOverflow.ellipsis , maxLines: 2) ) } ) ) } ) } ) ) ) ) ) )); }
/// <summary> /// Gets a list of <see cref="FanArtImage"/>s for a requested <paramref name="mediaType"/>, <paramref name="fanArtType"/> and <paramref name="name"/>. /// The name can be: Series name, Actor name, Artist name depending on the <paramref name="mediaType"/>. /// </summary> /// <param name="mediaType">Requested FanArtMediaType</param> /// <param name="fanArtType">Requested FanArtType</param> /// <param name="name">Requested name of Series, Actor, Artist...</param> /// <param name="maxWidth">Maximum width for image. <c>0</c> returns image in original size.</param> /// <param name="maxHeight">Maximum height for image. <c>0</c> returns image in original size.</param> /// <param name="singleRandom">If <c>true</c> only one random image URI will be returned</param> /// <param name="result">Result if return code is <c>true</c>.</param> /// <returns><c>true</c> if at least one match was found.</returns> public bool TryGetFanArt(string mediaType, string fanArtType, string name, int maxWidth, int maxHeight, bool singleRandom, out IList <IResourceLocator> result) { result = null; if (mediaType != FanArtMediaTypes.ChannelTv && mediaType != FanArtMediaTypes.ChannelRadio) { return(false); } try { string designsFolder = FileUtils.BuildAssemblyRelativePath("Designs"); ChannelType logoChannelType = mediaType == FanArtMediaTypes.ChannelTv ? ChannelType.Tv : ChannelType.Radio; ThemeHandler themeHandler = new ThemeHandler(); Theme theme = themeHandler.Load(Path.Combine(designsFolder, _settings.LogoTheme)); string logoFolder = Path.Combine(_dataFolder, string.Format("{0}-{1}-{2}", logoChannelType, theme.DesignName, theme.ThemeName)); string logoFileName = Path.Combine(logoFolder, FileUtils.GetSafeFilename(string.Format("{0}.png", name))); if (!Directory.Exists(logoFolder)) { Directory.CreateDirectory(logoFolder); } if (File.Exists(logoFileName)) { result = new List <IResourceLocator> { new ResourceLocator(ResourcePath.BuildBaseProviderPath(LocalFsResourceProviderBase.LOCAL_FS_RESOURCE_PROVIDER_ID, logoFileName)) }; return(true); } LogoProcessor processor = new LogoProcessor { DesignsFolder = designsFolder }; // From repository using (var repo = new LogoRepository { RepositoryUrl = _settings.RepositoryUrl }) { var stream = repo.Download(name, logoChannelType, _country.TwoLetterISORegionName); if (stream == null) { return(false); } using (stream) if (processor.CreateLogo(theme, stream, logoFileName)) { result = new List <IResourceLocator> { new ResourceLocator(ResourcePath.BuildBaseProviderPath(LocalFsResourceProviderBase.LOCAL_FS_RESOURCE_PROVIDER_ID, logoFileName)) }; return(true); } } } catch (Exception ex) { ServiceRegistration.Get <ILogger>().Error("SlimTv Logos: Error processing logo image.", ex); } return(false); }
private void OnThemeClick(object sender, RoutedEventArgs e) { var theme = Theme.ThemeType == ThemeType.Light ? ThemeType.Dark : ThemeType.Light; Theme.LoadThemeType(theme); }
/// <summary> /// Update chart theme. /// 切换图表主题。 /// </summary> /// <param name="theme">theme</param> public void UpdateTheme(Theme theme) { m_ThemeInfo.theme = theme; OnThemeChanged(); RefreshChart(); }
private void _DisplayColor(Color color) { txtLocation.Text = lblPixel.Text; lblPixel.BackColor = Color.Transparent; panelColor.BackColor = color; // RGBA color ----------------------------------------------- if (Configs.IsColorPickerRGBA) { lblRGB.Text = "RGBA:"; txtRGB.Text = $"{color.R}, {color.G}, {color.B}, {Math.Round(color.A / 255.0, 3)}"; } else { lblRGB.Text = "RGB:"; txtRGB.Text = $"{color.R}, {color.G}, {color.B}"; } // HEXA color ----------------------------------------------- if (Configs.IsColorPickerHEXA) { lblHEX.Text = "HEXA:"; txtHEX.Text = Theme.ConvertColorToHEX(color); } else { lblHEX.Text = "HEX:"; txtHEX.Text = Theme.ConvertColorToHEX(color, true); } // CMYK color ----------------------------------------------- var cmyk = Theme.ConvertColorToCMYK(color); txtCMYK.Text = $"{cmyk[0]}%, {cmyk[1]}%, {cmyk[2]}%, {cmyk[3]}%"; // HSLA color ----------------------------------------------- var hsla = Theme.ConvertColorToHSLA(color); if (Configs.IsColorPickerHSLA) { lblHSL.Text = "HSLA:"; txtHSL.Text = $"{hsla[0]}, {hsla[1]}%, {hsla[2]}%, {hsla[3]}"; } else { lblHSL.Text = "HSL:"; txtHSL.Text = $"{hsla[0]}, {hsla[1]}%, {hsla[2]}%"; } // HSVA color ----------------------------------------------- var hsva = Theme.ConvertColorToHSVA(color); if (Configs.IsColorPickerHSVA) { lblHSV.Text = "HSVA:"; txtHSV.Text = $"{hsva[0]}, {hsva[1]}%, {hsva[2]}%, {hsva[3]}"; } else { lblHSV.Text = "HSV:"; txtHSV.Text = $"{hsva[0]}, {hsva[1]}%, {hsva[2]}%"; } lblPixel.ForeColor = Theme.InvertBlackAndWhiteColor(color); }
protected override void OnRealized() { base.OnRealized(); theme = Hyena.Gui.Theming.ThemeEngine.CreateTheme(this); }
public SaveActionMenuItem(Theme theme, TextFormat font, float x, float y, float width, float height, Menu parentMenu, string text, string fileName) : this(theme, font, x, y, width, height, parentMenu, text, fileName, true) { }
public SaveActionMenuItem(Theme theme, TextFormat font, float x, float y, float width, float height, Menu parentMenu, string text, string fileName, bool autoCloseMenu) : base(theme, font, x, y, width, height, parentMenu, text, autoCloseMenu) { this.fileName = fileName; }
public SaveActionMenuItem(Theme theme, TextFormat font, Menu parentMenu, string text, string fileName) : this(theme, font, 0f, 0f, 100f, 20f, parentMenu, text, fileName, true) { }
/// <summary> /// Check that access for the provided index is valid into the definitions and history of the provided Theme /// </summary> /// <param name="target">Theme container object to inspector</param> /// <param name="index">index of ThemeDefinintion and History cache to access</param> /// <returns>true if access at index is possible, false otherwise</returns> private static bool ValidThemeHistoryAccess(Theme target, uint index) { return(target != null && target.History != null && target.Definitions != null && index < target.History.Count); }
public void SetTheme(Theme newTheme) { // Change app style to the custom accent and current theme var accent = MahAppsThemeManager.GetAccent(CustomAccentKey); var theme = MahAppsThemeManager.GetAppTheme(newTheme.Style == Style.Light ? "BaseLight" : "BaseDark"); // Modify resource values to new theme values // Set accent colors if (accent.Resources.Contains(AccentBaseColorKey)) { // Set base accent color accent.Resources[AccentBaseColorKey] = newTheme.AccentBaseColor.ToMediaColor(); // Set other accent colors with reduced transparency // Set 80% transparency accent color if (accent.Resources.Contains(AccentColor1Key)) { accent.Resources[AccentColor1Key] = newTheme.AccentBaseColor.SetTransparencyFraction(0.8).ToMediaColor(); } // Set 60% transparency accent color if (accent.Resources.Contains(AccentColor2Key)) { accent.Resources[AccentColor2Key] = newTheme.AccentBaseColor.SetTransparencyFraction(0.6).ToMediaColor(); } // Set 40% transparency accent color if (accent.Resources.Contains(AccentColor3Key)) { accent.Resources[AccentColor3Key] = newTheme.AccentBaseColor.SetTransparencyFraction(0.4).ToMediaColor(); } // Set 20% transparency accent color if (accent.Resources.Contains(AccentColor4Key)) { accent.Resources[AccentColor4Key] = newTheme.AccentBaseColor.SetTransparencyFraction(0.2).ToMediaColor(); } } // Set highlight color if (accent.Resources.Contains(HighlightColorKey)) { accent.Resources[HighlightColorKey] = newTheme.HighlightColor.ToMediaColor(); } // Set window border color if (accent.Resources.Contains(WindowBorderColorKey)) { accent.Resources[WindowBorderColorKey] = newTheme.WindowBorderColor.ToMediaColor(); // Set 80% transparency window border color if (accent.Resources.Contains(WindowBorderColor2Key)) { accent.Resources[WindowBorderColor2Key] = newTheme.WindowBorderColor.SetTransparencyFraction(0.8).ToMediaColor(); } } MahAppsThemeManager.ChangeAppStyle(Application.Current, accent, theme); this.CurrentTheme = newTheme; }
/// <summary> /// Callback when windows theme is changed. /// </summary> /// <param name="oldTheme">Previous Theme</param> /// <param name="newTheme">Current Theme</param> private void OnThemeChanged(Theme oldTheme, Theme newTheme) { ImageLoader.UpdateIconPath(newTheme); _mainVM.Query(); }
public MainWindow() { MainWindowServiceDispatcher.Instance.MainWindow = this; Theme.Initialize(); InitializeComponent(); WPFDoEvents.SetHourglassCursor(); DataContext = ConfigurationManager.Instance.ConfigurationRecord_Bindable; // Set a DEV title if necessary Title = String.Format("Qiqqa v{0}", ClientVersion.CurrentBuild); if (WebsiteAccess.IsTestEnvironment) { Title = String.Format("Qiqqa v{0} (TEST ENVIRONMENT)", ClientVersion.CurrentBuild); } // Check that we actually are fitting on the user's screen if (Left > SystemParameters.VirtualScreenWidth || Width > SystemParameters.FullPrimaryScreenWidth) { Left = 0; Width = SystemParameters.FullPrimaryScreenWidth; } if (Top > SystemParameters.VirtualScreenHeight || Height > SystemParameters.FullPrimaryScreenHeight) { Top = 0; Height = SystemParameters.FullPrimaryScreenHeight; } DockingManager.WindowIcon = Icons.GetAppIconICO(Icons.Qiqqa); DockingManager.OwnerWindow = this; DockingManager.AddContent(TITLE_START_PAGE, TITLE_START_PAGE, Icons.GetAppIcon(Icons.ModuleStartPage), false, true, ObjStartPage); DockingManager.MakeActive(TITLE_START_PAGE); ObjStatusBar.Background = ThemeColours.Background_Brush_Blue_LightToDark; ObjTabBackground.Background = ThemeColours.Background_Brush_Blue_VeryDark; SizeChanged += MainWindow_SizeChanged; KeyUp += MainWindow_KeyUp; Closing += MainWindow_Closing; Closed += MainWindow_Closed; // We've looked for the LAST event that triggers dependably at the start of the application: // ContentRendered // is the last one triggered of this bunch: // //this.Activated += MainWindow_Activated; ContentRendered += MainWindow_ContentRendered; //this.Initialized += MainWindow_Initialized; //this.LayoutUpdated += MainWindow_LayoutUpdated; //this.Loaded += MainWindow_Loaded; //this.ManipulationCompleted += MainWindow_ManipulationCompleted; //this.ManipulationStarting += MainWindow_ManipulationStarting; //this.SourceInitialized += MainWindow_SourceInitialized; //this.StateChanged += MainWindow_StateChanged; ObjTabWelcome.GetGoing += ObjTabWelcome_GetGoing; // Put this in a background thread Dispatcher.BeginInvoke(((Action)(() => PostStartupWork())), DispatcherPriority.Normal); }
public virtual string BarShade(Theme theme) => $"navbar-{Theme( theme )}";
public static void SetWallpapers(List <MonitorSettings> monitorSettings, WallpaperPosition position, Theme newTheme) { IDesktopWallpaper handler = (IDesktopWallpaper) new DesktopWallpaperClass(); handler.SetPosition(position); for (uint i = 0; i < handler.GetMonitorDevicePathCount(); i++) { string monitorId = handler.GetMonitorDevicePathAt(i); MonitorSettings monitorSetting = monitorSettings.Find(s => s.Id == monitorId); if (monitorSetting != null) { if (newTheme == Theme.Dark) { if (!File.Exists(monitorSetting.DarkThemeWallpaper)) { Logger.Warn($"target {Enum.GetName(typeof(Theme), newTheme)} wallpaper does not exist (skipping) path: {monitorSetting.DarkThemeWallpaper ?? "null"}, monitor ${monitorId}"); } else { handler.SetWallpaper(monitorId, monitorSetting.DarkThemeWallpaper); } } else { if (!File.Exists(monitorSetting.LightThemeWallpaper)) { Logger.Warn($"wallpaper does not exist. path ${monitorSetting.DarkThemeWallpaper}, monitor ${monitorId}"); } handler.SetWallpaper(monitorId, monitorSetting.LightThemeWallpaper); } } else { Logger.Warn($"no wallpaper config found for monitor {monitorId}, adding missing monitors"); DetectMonitors(); } } }
/// <summary> /// Renders the layer /// </summary> /// <param name="g">Graphics object reference</param> /// <param name="map">Map which is rendered</param> public override void Render(Graphics g, Map map) { if (Style.Enabled && Style.MaxVisible >= map.Zoom && Style.MinVisible < map.Zoom) { if (DataSource == null) { throw (new ApplicationException("DataSource property not set on layer '" + LayerName + "'")); } g.TextRenderingHint = TextRenderingHint; g.SmoothingMode = SmoothingMode; BoundingBox envelope = map.Envelope; //View to render var lineClipping = new CohenSutherlandLineClipping(envelope.Min.X, envelope.Min.Y, envelope.Max.X, envelope.Max.Y); if (CoordinateTransformation != null) { #if !DotSpatialProjections CoordinateTransformation.MathTransform.Invert(); envelope = GeometryTransform.TransformBox(envelope, CoordinateTransformation.MathTransform); CoordinateTransformation.MathTransform.Invert(); #else envelope = GeometryTransform.TransformBox(envelope, CoordinateTransformation.Target, CoordinateTransformation.Source); #endif } FeatureDataSet ds = new FeatureDataSet(); DataSource.Open(); DataSource.ExecuteIntersectionQuery(envelope, ds); DataSource.Close(); if (ds.Tables.Count == 0) { base.Render(g, map); return; } FeatureDataTable features = ds.Tables[0]; //Initialize label collection List <BaseLabel> labels = new List <BaseLabel>(); //List<System.Drawing.Rectangle> LabelBoxes; //Used for collision detection //Render labels for (int i = 0; i < features.Count; i++) { FeatureDataRow feature = features[i]; if (CoordinateTransformation != null) #if !DotSpatialProjections { features[i].Geometry = GeometryTransform.TransformGeometry(features[i].Geometry, CoordinateTransformation. MathTransform); } #else { features[i].Geometry = GeometryTransform.TransformGeometry(features[i].Geometry, CoordinateTransformation.Source, CoordinateTransformation.Target); } #endif LabelStyle style; if (Theme != null) //If thematics is enabled, lets override the style { style = Theme.GetStyle(feature) as LabelStyle; } else { style = Style; } float rotationStyle = style != null ? style.Rotation : 0f; float rotationColumn = 0f; if (!String.IsNullOrEmpty(RotationColumn)) { Single.TryParse(feature[RotationColumn].ToString(), NumberStyles.Any, Map.NumberFormatEnUs, out rotationColumn); } float rotation = rotationStyle + rotationColumn; int priority = Priority; if (_getPriorityMethod != null) { priority = _getPriorityMethod(feature); } else if (!String.IsNullOrEmpty(PriorityColumn)) { Int32.TryParse(feature[PriorityColumn].ToString(), NumberStyles.Any, Map.NumberFormatEnUs, out priority); } string text; if (_getLabelMethod != null) { text = _getLabelMethod(feature); } else { text = feature[LabelColumn].ToString(); } if (!String.IsNullOrEmpty(text)) { // for lineal geometries, try clipping to ensure proper labeling if (feature.Geometry is ILineal) { if (feature.Geometry is LineString) { feature.Geometry = lineClipping.ClipLineString(feature.Geometry as LineString); } else if (feature.Geometry is MultiLineString) { feature.Geometry = lineClipping.ClipLineString(feature.Geometry as MultiLineString); } } if (feature.Geometry is GeometryCollection) { if (MultipartGeometryBehaviour == MultipartGeometryBehaviourEnum.All) { foreach (Geometry geom in (feature.Geometry as GeometryCollection)) { BaseLabel lbl = CreateLabel(feature, geom, text, rotation, priority, style, map, g, _getLocationMethod); if (lbl != null) { labels.Add(lbl); } } } else if (MultipartGeometryBehaviour == MultipartGeometryBehaviourEnum.CommonCenter) { BaseLabel lbl = CreateLabel(feature, feature.Geometry, text, rotation, priority, style, map, g, _getLocationMethod); if (lbl != null) { labels.Add(lbl); } } else if (MultipartGeometryBehaviour == MultipartGeometryBehaviourEnum.First) { if ((feature.Geometry as GeometryCollection).Collection.Count > 0) { BaseLabel lbl = CreateLabel(feature, (feature.Geometry as GeometryCollection).Collection[0], text, rotation, style, map, g); if (lbl != null) { labels.Add(lbl); } } } else if (MultipartGeometryBehaviour == MultipartGeometryBehaviourEnum.Largest) { GeometryCollection coll = (feature.Geometry as GeometryCollection); if (coll.NumGeometries > 0) { double largestVal = 0; int idxOfLargest = 0; for (int j = 0; j < coll.NumGeometries; j++) { Geometry geom = coll.Geometry(j); if (geom is LineString && ((LineString)geom).Length > largestVal) { largestVal = ((LineString)geom).Length; idxOfLargest = j; } if (geom is MultiLineString && ((MultiLineString)geom).Length > largestVal) { largestVal = ((MultiLineString)geom).Length; idxOfLargest = j; } if (geom is Polygon && ((Polygon)geom).Area > largestVal) { largestVal = ((Polygon)geom).Area; idxOfLargest = j; } if (geom is MultiPolygon && ((MultiPolygon)geom).Area > largestVal) { largestVal = ((MultiPolygon)geom).Area; idxOfLargest = j; } } BaseLabel lbl = CreateLabel(feature, coll.Geometry(idxOfLargest), text, rotation, priority, style, map, g, _getLocationMethod); if (lbl != null) { labels.Add(lbl); } } } } else { BaseLabel lbl = CreateLabel(feature, feature.Geometry, text, rotation, priority, style, map, g, _getLocationMethod); if (lbl != null) { labels.Add(lbl); } } } } if (labels.Count > 0) //We have labels to render... { if (Style.CollisionDetection && _labelFilter != null) { _labelFilter(labels); } for (int i = 0; i < labels.Count; i++) { // Don't show the label if not necessary if (!labels[i].Show) { continue; } if (labels[i] is Label) { var label = labels[i] as Label; VectorRenderer.DrawLabel(g, label.Location, label.Style.Offset, label.Style.Font, label.Style.ForeColor, label.Style.BackColor, Style.Halo, label.Rotation, label.Text, map); } else if (labels[i] is PathLabel) { var plbl = labels[i] as PathLabel; var lblStyle = plbl.Style; g.DrawString(lblStyle.Halo, new SolidBrush(lblStyle.ForeColor), plbl.Text, lblStyle.Font.FontFamily, (int)lblStyle.Font.Style, lblStyle.Font.Size, lblStyle.GetStringFormat(), lblStyle.IgnoreLength, plbl.Location); } } } } base.Render(g, map); }
public Journal(string name, double edition, int copies, Theme theme, Categories category, double price) : base(name, edition, copies, theme, category, price) { ItemCollection.AddToLibrary(this); }
public AvalonStatusTheme(Theme theme, CompositeCollection backgroundResourceKeys, CompositeCollection foregroundResourceKeys) { this.Theme = theme; this.BackgroundResourceKeys = backgroundResourceKeys; this.ForegroundResourceKeys = foregroundResourceKeys; }
private void OnThemeChanged(Theme currentTheme, Theme newTheme) { UpdateIconPath(newTheme); }
private void OnThemeChanged(Theme oldtheme, Theme newTheme) { UpdateIconPath(newTheme); UpdateBrowserIconPath(newTheme); }
public void SetTheme(Theme theme) { this.Theme = theme; base.AddScript("Ext.net.ResourceMgr.setTheme(\"{0}\");", this.GetThemeUrl(theme)); }
public override void Render(IRenderContext rc, PlotModel model1) { PlotModel model = this.PlotModel; this.YAxis = ((MapPlotModel)model).GetAxis(this.YKey); if (!SeriesVisible || !((IAxis)this.YAxis).AxisVisible) { return; } //AjustAxis(); if (_pts.Count == 0) { return; } OxyColor average_color = OxyColors.Green; OxyColor limit_color = OxyColors.Red; if (Theme != null) { LineSeriesStyle style = Theme.GetStyle(ThemeMode) as LineSeriesStyle; this.FillColor = Helper.ConvertColorToOxyColor(style.LineColor); average_color = Helper.ConvertColorToOxyColor(style.AverageColor); limit_color = Helper.ConvertColorToOxyColor(style.AlarmColor); } rc.ResetClip(); IAxis y_axis = this.YAxis as IAxis; OxyRect clippingRect = y_axis.Bound; double width = model.PlotArea.Width; List <FeatureText> features = new List <FeatureText>(); //compute offset List <string> column_serieses = new List <string>(); for (int i = 0; i < model1.Series.Count; i++) { if (model1.Series[i] is PointColumnSeries || (model1.Series[i] is PointLineSeries && ((PointLineSeries)model1.Series[i]).PointLineStyle == ePointLineStyle.Cloumn)) { column_serieses.Add(((ISeries)model.Series[i]).Id); } } int column_padding = 3; double total_width = this.XAxis.Transform(1) - this.XAxis.Transform(0); double column_width = this.ColumnWidth; if ((this.ColumnWidth + column_padding) * column_serieses.Count > total_width) { //auto width; column_width = (total_width - column_serieses.Count * column_padding) / column_serieses.Count; } if (column_width < 1) { column_width = 1; } int index = column_serieses.IndexOf(this.Id); double total_column_width = column_width * column_serieses.Count + (column_serieses.Count - 1) * column_padding; double offset = 0; if (index >= 0) { offset = index * (column_width + column_padding) - total_column_width / 2 + column_width / 2;; } for (int i = 0; i < Count; i++) { double value = double.Parse(this[i].Value); double x = this.XAxis.Transform(this[i].Index) + offset; if (value == 0) { continue; } double y = this.YAxis.Transform(value); ScreenPoint center_point = new ScreenPoint(x, y); string text = PointLineSeries.FormatValue(value); if (double.Parse(text) == 0) { continue; } features.Add(new FeatureText(text, center_point, new OxySize(10, 10), center_point)); ScreenPoint left_top = new ScreenPoint(center_point.X - ColumnWidth / 2, center_point.Y); ScreenPoint right_top = new ScreenPoint(center_point.X + ColumnWidth / 2, center_point.Y); double y1 = this.YAxis.Transform(0); ScreenPoint right_bottom = new ScreenPoint(right_top.X, y1 - 2); ScreenPoint left_bottom = new ScreenPoint(left_top.X, y1 - 2); IList <ScreenPoint> poligon = new List <ScreenPoint>(); poligon.Add(left_top); poligon.Add(right_top); poligon.Add(right_bottom); poligon.Add(left_bottom); rc.DrawClippedPolygon(clippingRect, poligon, 2, FillColor, FillColor); } if (_is_average && ShowEverage) { double y = this.YAxis.Transform(_average); double left = model.PlotArea.Left; double right = model.PlotArea.Right; rc.DrawLine(left, y, right, y, new OxyPen(average_color, 1, LineStyle.Dash, LineJoin.Miter)); string average_text = PointLineSeries.FormatValue(_average); rc.DrawText(new ScreenPoint(left + 10, y - 15), average_text, average_color, "Arial"); } if (LimitValue != Helper.InvalidData && ShowLimit) { double y = this.YAxis.Transform(LimitValue); double left = model.PlotArea.Left; double right = model.PlotArea.Right; if (y >= this.YAxis.ScreenMin.Y && y <= this.YAxis.ScreenMax.Y) { rc.DrawLine(left, y, right, y, new OxyPen(limit_color, 1, LineStyle.Solid, LineJoin.Miter)); string limit_text = PointLineSeries.FormatValue(LimitValue); rc.DrawText(new ScreenPoint(left + 10, y - 15), limit_text, limit_color, "Arial"); } } if (LabelVisible) { foreach (FeatureText feature in features) { if (double.Parse(feature.Text) == 0) { continue; } PointLineSeries.RenderBoxText(rc, ThemeMode, clippingRect, feature.Text, TextPadding, feature.Position, TextOffset, FillColor, PointLineSeries.BoxPosition.Middle); } } }
private void OnThemeChanged(Theme _, Theme newTheme) { UpdateIconPath(newTheme); }
protected override void OnParametersSet() { iconCssBuilder = HtmlPropertyBuilder.CreateCssClassBuilder() .AddIf(Closable, "el-tag__close", "el-icon-close"); tagCssBuilder = HtmlPropertyBuilder.CreateCssClassBuilder() .Add("el-tag", $"el-tag--{Size.ToString().ToLower()}", $"el-tag--{Theme.ToString().ToLower()}", $"el-tag--{Type.ToString().ToLower()}"); tagStyleBuilder = HtmlPropertyBuilder.CreateCssStyleBuilder() .AddIf(!string.IsNullOrEmpty(Style), Style.Split(';')); }
public void OnEnable() { theme = target as Theme; themeDefinitions = serializedObject.FindProperty("definitions"); states = serializedObject.FindProperty("states"); }
public void TestGetThemeName() { Assert.That(Theme.GetThemeName(new ResourceDictionary()), Is.Null.Or.Empty); Assert.That(Theme.GetThemeName(GenerateValidResourceDictionary()), Is.EqualTo("Generated")); }
private void loadTheme(string themeName) { updateMs = (int)Math.Round(1000 / (double)SharedData.settings.UpdateFPS); overlayUpdateTimer.Interval = new TimeSpan(0, 0, 0, 0, updateMs); // web timing SharedData.webError = ""; SharedData.web = new WebTiming.webTiming(SharedData.settings.WebTimingUrl); /* * for (int i = 0; i < SharedData.webUpdateWait.Length; i++) * { * SharedData.webUpdateWait[i] = true; * } */ // disable overlay update SharedData.runOverlay = false; try { SharedData.theme = new Theme(themeName); SharedData.theme.readExternalData(); } catch (Exception ex) { logger.Fatal("Error loading Theme {0}: {1}", themeName, ex.ToString()); MessageBox.Show(ex.Message, "Error loading Theme"); Application.Current.Shutdown(); return; } canvas.Children.Clear(); objects = new Canvas[SharedData.theme.objects.Length]; labels = new Label[SharedData.theme.objects.Length][]; images = new Image[SharedData.theme.images.Length]; tickers = new Canvas[SharedData.theme.tickers.Length]; tickerLabels = new Label[SharedData.theme.tickers.Length][]; tickerHeaders = new Label[SharedData.theme.tickers.Length]; tickerFooters = new Label[SharedData.theme.tickers.Length]; tickerStackpanels = new StackPanel[SharedData.theme.tickers.Length]; tickerRowpanels = new StackPanel[SharedData.theme.tickers.Length][]; videos = new MediaElement[SharedData.theme.videos.Length]; videoBoxes = new Rectangle[SharedData.theme.videos.Length]; videoBrushes = new VisualBrush[SharedData.theme.videos.Length]; sounds = new MediaPlayer[SharedData.theme.sounds.Length]; tickerAnimations = new ThicknessAnimation[SharedData.theme.tickers.Length]; tickerStoryboards = new Storyboard[SharedData.theme.tickers.Length]; tickerScrolls = new Canvas[SharedData.theme.tickers.Length]; SharedData.tickerReady = new Boolean[SharedData.theme.tickers.Length]; SharedData.lastPage = new Boolean[SharedData.theme.objects.Length]; // create images for (int i = 0; i < SharedData.theme.images.Length; i++) { images[i] = new Image(); loadImage(images[i], SharedData.theme.images[i]); /* * images[i].Width = SharedData.theme.width; * images[i].Height = SharedData.theme.height; */ images[i].Visibility = System.Windows.Visibility.Hidden; canvas.Children.Add(images[i]); Canvas.SetZIndex(images[i], SharedData.theme.images[i].zIndex); } // create videos for (int i = 0; i < SharedData.theme.videos.Length; i++) { videos[i] = new MediaElement(); videos[i].LoadedBehavior = MediaState.Manual; if (File.Exists(Directory.GetCurrentDirectory() + "\\" + SharedData.theme.path + "\\" + SharedData.theme.videos[i].filename)) { videos[i].Source = new Uri(Directory.GetCurrentDirectory() + "\\" + SharedData.theme.path + "\\" + SharedData.theme.videos[i].filename); } else { MessageBox.Show("Could not load video \"" + Directory.GetCurrentDirectory() + "\\" + SharedData.theme.path + "\\" + SharedData.theme.videos[i].filename + "\""); } videoBrushes[i] = new VisualBrush(); videoBrushes[i].Visual = videos[i]; videoBoxes[i] = new Rectangle(); videoBoxes[i] = new System.Windows.Shapes.Rectangle(); videoBoxes[i].Fill = videoBrushes[i]; // width if (SharedData.theme.videos[i].width == 0) { videoBoxes[i].Width = SharedData.theme.width; } else { videoBoxes[i].Width = SharedData.theme.videos[i].width; } // height if (SharedData.theme.videos[i].height == 0) { videoBoxes[i].Height = SharedData.theme.height; } else { videoBoxes[i].Height = SharedData.theme.videos[i].height; } Thickness videoMargin = new Thickness(); // left if (SharedData.theme.videos[i].left != 0) { videoMargin.Left = SharedData.theme.videos[i].left; } // top if (SharedData.theme.videos[i].top != 0) { videoMargin.Top = SharedData.theme.videos[i].top; } videoBoxes[i].Margin = videoMargin; videoBoxes[i].Visibility = System.Windows.Visibility.Hidden; canvas.Children.Add(videoBoxes[i]); Canvas.SetZIndex(videoBoxes[i], SharedData.theme.videos[i].zIndex); } // create sounds for (int i = 0; i < SharedData.theme.sounds.Length; i++) { sounds[i] = new MediaPlayer(); //sounds[i].LoadedBehavior = MediaState.Manual; if (File.Exists(Directory.GetCurrentDirectory() + "\\" + SharedData.theme.path + "\\" + SharedData.theme.sounds[i].filename)) { sounds[i].Open(new Uri(Directory.GetCurrentDirectory() + "\\" + SharedData.theme.path + "\\" + SharedData.theme.sounds[i].filename)); } else { MessageBox.Show("Could not load sound \"" + Directory.GetCurrentDirectory() + "\\" + SharedData.theme.path + "\\" + SharedData.theme.sounds[i].filename + "\""); } } // create objects for (int i = 0; i < SharedData.theme.objects.Length; i++) { // init canvas objects[i] = new Canvas(); objects[i].Margin = new Thickness(SharedData.theme.objects[i].left, SharedData.theme.objects[i].top, 0, 0); objects[i].Width = SharedData.theme.objects[i].width; objects[i].Height = SharedData.theme.objects[i].height; objects[i].ClipToBounds = true; // create labels if (SharedData.theme.objects[i].dataset == DataSets.standing || SharedData.theme.objects[i].dataset == DataSets.points || SharedData.theme.objects[i].dataset == DataSets.pit) { labels[i] = new Label[SharedData.theme.objects[i].labels.Length * SharedData.theme.objects[i].itemCount]; for (int j = 0; j < SharedData.theme.objects[i].labels.Length; j++) // items { // fix top preaddition //SharedData.theme.objects[i].labels[j].top -= SharedData.theme.objects[i].itemSize; for (int k = 0; k < SharedData.theme.objects[i].itemCount; k++) // subitems { Theme.LabelProperties label = Theme.setLabelPosition(SharedData.theme.objects[i], SharedData.theme.objects[i].labels[j], k); //SharedData.theme.objects[i].labels[j].top += SharedData.theme.objects[i].itemSize; labels[i][(j * SharedData.theme.objects[i].itemCount) + k] = DrawLabel(label); objects[i].Children.Add(labels[i][(j * SharedData.theme.objects[i].itemCount) + k]); } } } else { labels[i] = new Label[SharedData.theme.objects[i].labels.Length]; for (int j = 0; j < SharedData.theme.objects[i].labels.Length; j++) { labels[i][j] = DrawLabel(SharedData.theme.objects[i].labels[j]); objects[i].Children.Add(labels[i][j]); } } objects[i].Visibility = System.Windows.Visibility.Hidden; canvas.Children.Add(objects[i]); Canvas.SetZIndex(objects[i], SharedData.theme.objects[i].zIndex); /* * * if (SharedData.settings.ShowBorders) * { * objects[i].BorderBrush = System.Windows.Media.Brushes.LightGreen; * objects[i].BorderThickness = new Thickness(1); * }*/ } // create tickers for (int i = 0; i < SharedData.theme.tickers.Length; i++) { // init canvas tickers[i] = new Canvas(); tickers[i].Margin = new Thickness(SharedData.theme.tickers[i].left, SharedData.theme.tickers[i].top, 0, 0); tickers[i].Width = SharedData.theme.tickers[i].width; tickers[i].Height = SharedData.theme.tickers[i].height; tickers[i].ClipToBounds = true; tickerScrolls[i] = new Canvas(); tickerStackpanels[i] = new StackPanel(); tickerStackpanels[i].CacheMode = new BitmapCache(1.0); tickerAnimations[i] = new ThicknessAnimation(); Timeline.SetDesiredFrameRate(tickerAnimations[i], SharedData.settings.UpdateFPS); tickerStoryboards[i] = new Storyboard(); tickers[i].Visibility = System.Windows.Visibility.Hidden; canvas.Children.Add(tickers[i]); Canvas.SetZIndex(tickers[i], SharedData.theme.tickers[i].zIndex); tickers[i].Children.Add(tickerScrolls[i]); tickerHeaders[i] = new Label(); tickerFooters[i] = new Label(); } // XSplit Type xsplitType = Type.GetType("XSplit.Wpf.TimedBroadcasterPlugin"); if (xsplitType != null) { XSplit.Wpf.TimedBroadcasterPlugin xsplit = XSplit.Wpf.TimedBroadcasterPlugin.CreateInstance("415CD379-CD8A-4D88-A06C-D238FB38DF6A", canvas, SharedData.settings.OverlayW, SharedData.settings.OverlayH, (int)(1000 / SharedData.settings.UpdateFPS)); if (xsplit != null) { xsplit.StartTimer(); } } SharedData.triggers.Push(TriggerTypes.init); SharedData.runOverlay = true; }
protected override bool AllowSwitchToTheTheme(Type moduleType, Theme theme) { return(moduleType != typeof(MainDemoModule) || theme != Theme.HybridApp); }
public static void SetSelectedTheme(Theme theme, int index) { selectedTheme = theme; playerData.selectedThemeIndex = index; SavePlayerData(); }