/// <summary> /// Adds a GameObject reference to the Objects dictionary /// If a CollidableObject is passed, it is also added to the CollidableObjects List /// </summary> /// <param name="name">GameObject name</param> /// <param name="g">GameObject reference</param> public static void Add(string name, GameObject g) { Objects.Add(name, g); if (g is CollidableObject) { CollidableObject c = (CollidableObject)g; CollidableObjects.Add(c); NonUIObjects.Add(g); } else if (g is Background) { Background b = (Background)g; Backgrounds.Add(b); } else if (g is UIObject) { UIObject ui = (UIObject)g; UIObjects.Add(ui); } else if (g is SFXWrapper) { SFXWrapper wrap = (SFXWrapper)g; SoundEffects.Add(wrap); } else { NonUIObjects.Add(g); } }
public SlideStyle(string text) { Styles.Add(DefaultStyle); Colors.Add(DefaultColor); Texts.Add(text); Backgrounds.Add(DefaultBackground); }
// Read all backgrounds from ROM. private void ReadBackgrounds(Rom rom, List <Tuple <int, string> > backgrounds) { foreach (var b in backgrounds) { Background newBackground = new Background() { Name = b.Item2 }; newBackground.ReadFromROM(rom, b.Item1); Backgrounds.Add(newBackground); } /* * List <int> addressesPC = new List <int> (); * foreach (RoomState r in RoomStates) { * int address = Tools.LRtoPC (r.BackgroundPtr); * if (address != 0) // Skip invalid addresses * addressesPC.Add (address); * } * Tools.RemoveDuplicates (addressesPC); * Backgrounds.Clear (); * for (int n = 0; n < addressesPC.Count; n++) * { * Backgrounds.Add (new Background ()); * Backgrounds [n].ReadFromROM (rom, addressesPC [n]); * } */ }
public void AddBackground(Background bg) { Backgrounds.Add(bg); var entity = Scene.CreateEntity(); var bgBody = new GameObject(); bgBody.Position = new Vector2(0, 0); entity.Attach(bgBody); entity.Attach(bg); entity.Attach(new Renderer(bg.Texture)); }
public void VisitNodeChangeBackground(NodeChangeBackground ncb) { var resourcePath = "resource/" + _projectService.GetRelativePath(ncb.Background.Path).Replace('\\', '/').Replace(".png", ".DDS"); Backgrounds.Add(resourcePath); _writer.WriteStartElement("NodeChangeBackground"); if (ncb.Background != null) { _writer.WriteAttributeString("Path", resourcePath); } _writer.WriteAttributeString("TransitionType", ncb.TransitionType.ToString()); _writer.WriteAttributeString("TransitionSpeed", ncb.TransitionSpeed.ToString()); _writer.WriteEndElement(); }
void LoadBackgrouds(string zipPath, string[] backgrouds) {//Принимает названия картинок и загружает их из игровых архивов foreach (string back in backgrouds) { if (!Backgrounds.ContainsKey(back)) { BitmapImage image = ReadFromZip(zipPath, back).toBitmapImage(); Backgrounds.Add(back, image); } else { continue; } } }
public void Background_Load(Stream _s) { int num = _s.ReadInteger(); int num2 = _s.ReadInteger(); for (int i = 0; i < num2; i++) { Stream s = _s; if (num == 800) { s = _s.ReadStreamC(); } bool flag = s.ReadBoolean(); KeyValuePair <string, GMBackground> item = default(KeyValuePair <string, GMBackground>); if (flag) { string key = s.ReadString(); GMBackground value = new GMBackground(this, s); item = new KeyValuePair <string, GMBackground>(key, value); } Backgrounds.Add(item); } }
public void Load() { // Music testing CodeVariant = 3; if (CodeVariant == 1) { BackgroundMusicIntro = Engine.AssetLoader.Get <AudioAsset>("Audio/Frozen Cave Intro.wav"); BackgroundMusic = Engine.AssetLoader.Get <AudioAsset>("Audio/Frozen Cave 12.wav"); IntroLayer = Engine.Host.Audio.CreateLayer("Audio/Intro layer", 1); CustomAudioTrack fcIntro = new CustomAudioTrack(BackgroundMusicIntro, 11.29f, PlayMainTrackOnMainLayer); IntroLayer.AddToQueue(fcIntro); MainLayer = Engine.Host.Audio.CreateLayer("Main layer", 1); } else if (CodeVariant == 2) { //BackgroundMusicIntro = Engine.AssetLoader.Get<AudioAsset>("Frozen Cave Intro 2.wav"); //BackgroundMusic = Engine.AssetLoader.Get<AudioAsset>("Frozen Cave 12.wav"); BackgroundMusicIntro = Engine.AssetLoader.Get <AudioAsset>("Audio/Frozen Cave Intro 4.wav"); BackgroundMusic = Engine.AssetLoader.Get <AudioAsset>("Audio/Frozen Cave Loop 3.wav"); SecondaryLayer = Engine.Host.Audio.CreateLayer("Secondary layer", 1); SecondaryLayer.AddToQueue(BackgroundMusicIntro); SecondaryLayer.AddToQueue(BackgroundMusic); } // Texture loading should be done before any texture usages // to make sure they are loaded in parallel TextureLoader.Load(LoadedRoom.Textures); // Init the player Player = new Midori(LoadedRoom.Spawn); Units.Add(Player); // Init the camera Engine.Renderer.Camera = new ScalableArtCamera(new Vector3(Player.X, 540, 0), 1f); // Set the TextureArrayLimit to 1 for GPU's that support only zero indexing // Engine.Renderer.TextureArrayLimit = 1; // Create units foreach (ConfigUnit configUnit in LoadedRoom.Units) { Unit unit; switch (configUnit.Type) { case "Shishi": unit = new Shishi(configUnit.Name, configUnit.TextureName, configUnit.Position, configUnit.Size); break; default: throw new Exception("No applicable classes"); } Units.Add(unit); NonPlayerUnits.Add(unit); } // Magic Flows MagicFlow m = new MagicFlow(); m.AddSegment(new Collision.LineSegment(100, 5400, 950, 4600)); m.AddSegment(new Collision.LineSegment(950, 4600, 1450, 4800)); m.AddSegment(new Collision.LineSegment(1450, 4800, 2000, 4200)); MagicFlows.Add(m); m = new MagicFlow(); m.AddSegment(new Collision.LineSegment(1450, 5400, 1750, 5300)); m.AddSegment(new Collision.LineSegment(1750, 5300, 1950, 5200)); m.AddSegment(new Collision.LineSegment(1950, 5200, 2050, 5100)); m.AddSegment(new Collision.LineSegment(2050, 5100, 2100, 5000)); m.AddSegment(new Collision.LineSegment(2100, 5000, 2100, 4900)); m.AddSegment(new Collision.LineSegment(2100, 4900, 2050, 4800)); m.AddSegment(new Collision.LineSegment(2050, 4800, 1950, 4700)); m.AddSegment(new Collision.LineSegment(1950, 4700, 1750, 4600)); MagicFlows.Add(m); // Create platforms for (int i = 0; i < LoadedRoom.CollisionPlatforms.Count; i++) { ConfigCollisionPlatform configPlatform = LoadedRoom.CollisionPlatforms[i]; Collision.LineSegment realPlatform = new Collision.LineSegment(configPlatform.PointA, configPlatform.PointB); if (realPlatform.IsSloped) { SlopedCollisionPlatforms.Add(realPlatform); } else { AxisAlignedCollisionPlatforms.Add(realPlatform); } CollisionPlatforms.Add(realPlatform); } // Create decorations // Backgrounds for (int i = 0; i < LoadedRoom.Backgrounds.Count; i++) { ConfigDecoration configDecor = LoadedRoom.Backgrounds[i]; Backgrounds.Add( new Decoration( configDecor.Name, configDecor.TextureName, configDecor.Size, configDecor.Position, configDecor.DisplaySize, configDecor.TextureArea, configDecor.FlipX, configDecor.BlurIntensity, configDecor.ShadowReverseIntensity ) ); } // Background Decorations for (int i = 0; i < LoadedRoom.BackgroundDecorations.Count; i++) { ConfigDecoration configDecor = LoadedRoom.BackgroundDecorations[i]; BackgroundDecorations.Add( new Decoration( configDecor.Name, configDecor.TextureName, configDecor.Size, configDecor.Position, configDecor.DisplaySize, configDecor.TextureArea, configDecor.FlipX, configDecor.BlurIntensity, configDecor.ShadowReverseIntensity ) ); } // Foreground Decorations for (int i = 0; i < LoadedRoom.ForegroundDecorations.Count; i++) { ConfigDecoration configDecor = LoadedRoom.ForegroundDecorations[i]; ForegroundDecorations.Add( new Decoration( configDecor.Name, configDecor.TextureName, configDecor.Size, configDecor.Position, configDecor.DisplaySize, configDecor.TextureArea, configDecor.FlipX, configDecor.BlurIntensity, configDecor.ShadowReverseIntensity ) ); } for (int i = 0; i < LoadedRoom.SceneChangers.Count; i++) { SceneChanger sceneChanger = LoadedRoom.SceneChangers[i]; SceneChangers.Add(sceneChanger); } }
//#region PreviewColorCommand //private static RelayCommand _previewColorCommand; ///// <summary> ///// Command khi rê chuột chọn màu ///// </summary> //public static RelayCommand PreviewColorCommand //{ // get { return _previewColorCommand ?? (_previewColorCommand = new RelayCommand(p => PreviewExecute(p))); } //} //private static void PreviewExecute(object p) //{ // if (p is GalleryItem galleryItem) // { // Global.BeginInit(); // EColorManagment eColor = galleryItem.Content as EColorManagment; // if ((Application.Current as IAppGlobal).SelectedTheme != null && (Application.Current as IAppGlobal).DocumentControl != null) // { // (Application.Current as IAppGlobal).SelectedTheme.Colors = eColor; // if ((Application.Current as IAppGlobal).SelectedThemeView != null) // (Application.Current as IAppGlobal).SelectedThemeView.Colors = eColor; // (Application.Current as IAppGlobal).SelectedSlide.UpdateThemeColor(); // } // Global.EndInit(); // } //} //#endregion //#region PreviewColorCancelCommand //private static RelayCommand _PreviewColorCancelCommand; //public static RelayCommand PreviewColorCancelCommand //{ // get { return _PreviewColorCancelCommand ?? (_PreviewColorCancelCommand = new RelayCommand(p => PreviewColorCancelExecute(p))); } //} //private static void PreviewColorCancelExecute(object p) //{ // if (BackupColor != null) // { // Global.BeginInit(); // if (!IsChangeColor) // { // if ((Application.Current as IAppGlobal).SelectedTheme != null && (Application.Current as IAppGlobal).DocumentControl != null) // { // (Application.Current as IAppGlobal).SelectedTheme.Colors = BackupColor; // if ((Application.Current as IAppGlobal).SelectedThemeView != null) // (Application.Current as IAppGlobal).SelectedThemeView.Colors = BackupColor; // foreach (var item in (Application.Current as IAppGlobal).DocumentControl.Slides) // { // item.UpdateThemeColor(); // } // } // } // else // { // IsChangeColor = false; // } // Global.EndInit(); // } //} //#endregion //#region ColorDropDownCommand //private static RelayCommand _colorDropDownCommand; //public static RelayCommand ColorDropDownCommand //{ // get { return _colorDropDownCommand ?? (_colorDropDownCommand = new RelayCommand(p => ColorDropDownExecute())); } //} //private static void ColorDropDownExecute() //{ // BackupColor = (Application.Current as IAppGlobal).SelectedTheme.Colors; //} //#endregion //private RelayCommand _treeviewCommand; //public RelayCommand TreeViewCommand //{ // get { return _treeviewCommand ?? (_treeviewCommand = new RelayCommand(p => TreeViewExecute(p))); } //} //private void TreeViewExecute(object p) //{ // SlideMaster slide = null; // if ((Application.Current as IAppGlobal).SelectedSlide is SlideMaster slideMaster) // { // slide = slideMaster; // } // else if ((Application.Current as IAppGlobal).SelectedSlide is LayoutMaster layoutMaster) // { // slide = layoutMaster.SlideParent; // } // if (slide != null) // { // foreach (EThemes item in (Application.Current as IAppGlobal).LocalThemesCollection) // { // if (slide.ThemesName == item.Name) // { // (Application.Current as IAppGlobal).SelectedThemes = item; // } // } // ThemeDesign.SelectedValue = (Application.Current as IAppGlobal).SelectedThemes; // } //} //#endregion #region GenerateBackgroundStype /// <summary> /// Tạo ra các Background Style /// </summary> private void GenerateBackgroundStype() { //Style1 BackgroundItem bgItem = new BackgroundItem(); ColorGradientBrush gradientColor = new ColorGradientBrush(); gradientColor.GradientStops = new ObservableCollection <CustomGradientStop>(); LinearGradientBrush gradientBrush = new LinearGradientBrush(); gradientBrush.StartPoint = new Point(0, 0); gradientBrush.EndPoint = new Point(1, 1); GradientStop gradientStop = new GradientStop(); gradientStop.Offset = 0.0; gradientStop.Color = Colors.Transparent; gradientBrush.GradientStops.Add(gradientStop); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "", Brightness = 1 }, Offset = 0.0 }); bgItem.ColorDataStyle = gradientColor; bgItem.ColorStyle = gradientBrush; bgItem.Name = "Style 1"; Backgrounds.Add(bgItem); //Style2 bgItem = new BackgroundItem(); gradientBrush = new LinearGradientBrush(); gradientBrush.StartPoint = new Point(0, 0); gradientBrush.EndPoint = new Point(1, 1); gradientColor = new ColorGradientBrush(); gradientColor.GradientStops = new ObservableCollection <CustomGradientStop>(); Binding _binding = new Binding("SelectedTheme.Colors.Accent4.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 0.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nhấn mạnh 4", Brightness = 1 }, Offset = 0.0 }); gradientBrush.GradientStops.Add(gradientStop); _binding = new Binding("SelectedTheme.Colors.Accent4.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 1.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nhấn mạnh 4", Brightness = 1 }, Offset = 1.0 }); gradientBrush.GradientStops.Add(gradientStop); bgItem.ColorDataStyle = gradientColor; bgItem.ColorStyle = gradientBrush; bgItem.Name = "Style 2"; Backgrounds.Add(bgItem); //Style3 bgItem = new BackgroundItem(); gradientColor = new ColorGradientBrush(); gradientColor.GradientStops = new ObservableCollection <CustomGradientStop>(); gradientBrush = new LinearGradientBrush(); gradientBrush.StartPoint = new Point(0, 0); gradientBrush.EndPoint = new Point(1, 1); _binding = new Binding("SelectedTheme.Colors.Accent5.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 0.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nhấn mạnh 5", Brightness = 1 }, Offset = 0.0 }); gradientBrush.GradientStops.Add(gradientStop); _binding = new Binding("SelectedTheme.Colors.Accent5.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 1.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nhấn mạnh 5", Brightness = 1 }, Offset = 1.0 }); gradientBrush.GradientStops.Add(gradientStop); bgItem.ColorDataStyle = gradientColor; bgItem.ColorStyle = gradientBrush; bgItem.Name = "Style 3"; Backgrounds.Add(bgItem); //Style4 bgItem = new BackgroundItem(); gradientColor = new ColorGradientBrush(); gradientColor.GradientStops = new ObservableCollection <CustomGradientStop>(); gradientBrush = new LinearGradientBrush(); gradientBrush.StartPoint = new Point(0, 0); gradientBrush.EndPoint = new Point(1, 1); _binding = new Binding("SelectedTheme.Colors.Accent6.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 0.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nhấn mạnh 6", Brightness = 1 }, Offset = 0.0 }); gradientBrush.GradientStops.Add(gradientStop); _binding = new Binding("SelectedTheme.Colors.Accent6.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 1.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nhấn mạnh 6", Brightness = 1 }, Offset = 1.0 }); gradientBrush.GradientStops.Add(gradientStop); bgItem.ColorDataStyle = gradientColor; bgItem.ColorStyle = gradientBrush; bgItem.Name = "Style 4"; Backgrounds.Add(bgItem); //Style5 bgItem = new BackgroundItem(); gradientColor = new ColorGradientBrush(); gradientColor.GradientStops = new ObservableCollection <CustomGradientStop>(); gradientBrush = new LinearGradientBrush(); gradientBrush.StartPoint = new Point(0, 0); gradientBrush.EndPoint = new Point(1, 0); _binding = new Binding("SelectedTheme.Colors.BackgroundLight1.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 0.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientBrush.GradientStops.Add(gradientStop); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nền sáng 1", Brightness = 1 }, Offset = 0.0 }); _binding = new Binding("SelectedTheme.Colors.BackgroundDark1.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 1.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nền tối 1", Brightness = 1 }, Offset = 1.0 }); gradientBrush.GradientStops.Add(gradientStop); bgItem.ColorDataStyle = gradientColor; bgItem.ColorStyle = gradientBrush; bgItem.Name = "Style 5"; Backgrounds.Add(bgItem); //Style6 bgItem = new BackgroundItem(); gradientColor = new ColorGradientBrush(); gradientColor.GradientStops = new ObservableCollection <CustomGradientStop>(); gradientBrush = new LinearGradientBrush(); gradientBrush.StartPoint = new Point(0, 0); gradientBrush.EndPoint = new Point(1, 0); _binding = new Binding("SelectedTheme.Colors.BackgroundLight1.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 0.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientBrush.GradientStops.Add(gradientStop); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nền sáng 1", Brightness = 1 }, Offset = 0.0 }); _binding = new Binding("SelectedTheme.Colors.Accent4.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 1.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nhấn mạnh 4", Brightness = 1 }, Offset = 1.0 }); gradientBrush.GradientStops.Add(gradientStop); bgItem.ColorDataStyle = gradientColor; bgItem.ColorStyle = gradientBrush; bgItem.Name = "Style 6"; Backgrounds.Add(bgItem); //Style7 bgItem = new BackgroundItem(); gradientColor = new ColorGradientBrush(); gradientColor.GradientStops = new ObservableCollection <CustomGradientStop>(); gradientBrush = new LinearGradientBrush(); gradientBrush.StartPoint = new Point(0, 0); gradientBrush.EndPoint = new Point(1, 0); _binding = new Binding("SelectedTheme.Colors.BackgroundLight1.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 0.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientBrush.GradientStops.Add(gradientStop); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nền sáng 1", Brightness = 1 }, Offset = 0.0 }); _binding = new Binding("SelectedTheme.Colors.Accent5.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 1.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nhấn mạnh 5", Brightness = 1 }, Offset = 1.0 }); gradientBrush.GradientStops.Add(gradientStop); bgItem.ColorDataStyle = gradientColor; bgItem.ColorStyle = gradientBrush; bgItem.Name = "Style 7"; Backgrounds.Add(bgItem); //Style8 bgItem = new BackgroundItem(); gradientColor = new ColorGradientBrush(); gradientColor.GradientStops = new ObservableCollection <CustomGradientStop>(); gradientBrush = new LinearGradientBrush(); gradientBrush.StartPoint = new Point(0, 0); gradientBrush.EndPoint = new Point(1, 0); _binding = new Binding("SelectedTheme.Colors.BackgroundLight1.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 0.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientBrush.GradientStops.Add(gradientStop); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nền sáng 1", Brightness = 1 }, Offset = 0.0 }); _binding = new Binding("SelectedTheme.Colors.Accent6.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 1.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nhấn mạnh 6", Brightness = 1 }, Offset = 1.0 }); gradientBrush.GradientStops.Add(gradientStop); bgItem.ColorDataStyle = gradientColor; bgItem.ColorStyle = gradientBrush; bgItem.Name = "Style 8"; Backgrounds.Add(bgItem); //Style9 bgItem = new BackgroundItem(); gradientColor = new ColorGradientBrush(); gradientColor.GradientStops = new ObservableCollection <CustomGradientStop>(); RadialGradientBrush radialGradient = new RadialGradientBrush(); _binding = new Binding("SelectedTheme.Colors.BackgroundLight1.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 0.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); radialGradient.GradientStops.Add(gradientStop); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nền sáng 1", Brightness = 1 }, Offset = 0.0 }); _binding = new Binding("SelectedTheme.Colors.BackgroundDark1.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 1.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nền tối 1", Brightness = 1 }, Offset = 1.0 }); radialGradient.GradientStops.Add(gradientStop); bgItem.ColorDataStyle = gradientColor; bgItem.ColorStyle = radialGradient; bgItem.Name = "Style 9"; Backgrounds.Add(bgItem); //Style10 bgItem = new BackgroundItem(); gradientColor = new ColorGradientBrush(); gradientColor.GradientStops = new ObservableCollection <CustomGradientStop>(); radialGradient = new RadialGradientBrush(); _binding = new Binding("SelectedTheme.Colors.BackgroundLight1.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 0.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); radialGradient.GradientStops.Add(gradientStop); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nền sáng 1", Brightness = 1 }, Offset = 0.0 }); _binding = new Binding("SelectedTheme.Colors.Accent4.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 1.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nhấn mạnh 4", Brightness = 1 }, Offset = 1.0 }); radialGradient.GradientStops.Add(gradientStop); bgItem.ColorDataStyle = gradientColor; bgItem.ColorStyle = radialGradient; bgItem.Name = "Style 10"; Backgrounds.Add(bgItem); //Style11 bgItem = new BackgroundItem(); gradientColor = new ColorGradientBrush(); gradientColor.GradientStops = new ObservableCollection <CustomGradientStop>(); radialGradient = new RadialGradientBrush(); _binding = new Binding("SelectedTheme.Colors.BackgroundLight1.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 0.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); radialGradient.GradientStops.Add(gradientStop); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nền sáng 1", Brightness = 1 }, Offset = 0.0 }); _binding = new Binding("SelectedTheme.Colors.Accent5.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 1.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nhấn mạnh 5", Brightness = 1 }, Offset = 1.0 }); radialGradient.GradientStops.Add(gradientStop); bgItem.ColorDataStyle = gradientColor; bgItem.ColorStyle = radialGradient; bgItem.Name = "Style 11"; Backgrounds.Add(bgItem); //Style12 bgItem = new BackgroundItem(); gradientColor = new ColorGradientBrush(); gradientColor.GradientStops = new ObservableCollection <CustomGradientStop>(); radialGradient = new RadialGradientBrush(); _binding = new Binding("SelectedTheme.Colors.BackgroundLight1.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 0.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); radialGradient.GradientStops.Add(gradientStop); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nền sáng 1", Brightness = 1 }, Offset = 0.0 }); _binding = new Binding("SelectedTheme.Colors.Accent6.Color"); _binding.Source = (Application.Current as IAppGlobal); _binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; _binding.Mode = BindingMode.TwoWay; gradientStop = new GradientStop(); gradientStop.Offset = 1.0; BindingOperations.SetBinding(gradientStop, GradientStop.ColorProperty, _binding); gradientColor.GradientStops.Add(new CustomGradientStop() { Color = new INV.Elearning.Controls.SolidColor() { Color = gradientStop.Color.ToString(), Name = "Nhấn mạnh 6", Brightness = 1 }, Offset = 1.0 }); radialGradient.GradientStops.Add(gradientStop); bgItem.ColorDataStyle = gradientColor; bgItem.ColorStyle = radialGradient; bgItem.Name = "Style 12"; Backgrounds.Add(bgItem); }