Пример #1
0
 public override void Init(Kernel kernel)
 {
     try
     {
         kernel.AddTheme("Chocolate", "resx://Chocolate/Chocolate.Resources/Page#PageChocolate", "resx://Chocolate/Chocolate.Resources/DetailMovieView#ChocolateMovieView");
         if (AppDomain.CurrentDomain.FriendlyName.Contains("ehExtHost"))
         {
             this.config = new MyConfig();
             kernel.AddConfigPanel("Chocolate General", "resx://Chocolate/Chocolate.Resources/ConfigPanel#ConfigPanel", this.config);
             kernel.AddConfigPanel("Chocolate Views", "resx://Chocolate/Chocolate.Resources/ConfigPanelViews#ConfigPanelViews", this.config);
         }
         else
         {
             Logger.ReportInfo("Not creating menus for Chocolate.  Appear to not be in MediaCenter.  AppDomain is: " + AppDomain.CurrentDomain.FriendlyName);
         }
         kernel.StringData.AddStringData(MyStrings.FromFile(LocalizedStringData.GetFileName("Chocolate-")));
         CustomResourceManager.AppendFonts("Chocolate", Resources.Fonts, Resources.FontsSmall);
         CustomResourceManager.AppendStyles("Chocolate", Resources.Colors, Resources.Colors);
         Logger.ReportInfo("Chocolate Theme (version " + this.Version + ") Loaded.");
     }
     catch (Exception exception)
     {
         Logger.ReportException("Error adding theme - probably incompatable MB version", exception);
     }
 }
Пример #2
0
        private static void CheckLocalizedStrings(List <LocalizedStringData> localizedStrings, TypeSet t, Action CheckContents, ref ParameterType modifiedType)
        {
            LocalizedStringData string1 = new LocalizedStringData("string1", ParameterType.Parse("03d7b9f3-cc7e-4639-b809-20f92860c041"));
            LocalizedStringData string2 = new LocalizedStringData("repeat", ParameterType.Parse("3f0af919-8c61-4863-9039-9d4b59a2b2e6"));
            LocalizedStringData string3 = new LocalizedStringData("repeat", ParameterType.Parse("3771aec9-a2ea-4f06-a426-fb245de56199"));

            var a = string1;

            t.AddLocalizedString(a);
            localizedStrings.Add(a);
            Assert.That(modifiedType, Is.EqualTo(a.TypeId));
            modifiedType = null;
            CheckContents();

            a = string2;
            t.AddLocalizedString(a);
            localizedStrings.Add(a);
            Assert.That(modifiedType, Is.EqualTo(a.TypeId));
            modifiedType = null;
            CheckContents();

            a = string1;
            t.Remove(a.TypeId);
            localizedStrings.Remove(a);
            Assert.That(modifiedType, Is.EqualTo(a.TypeId));
            modifiedType = null;
            CheckContents();

            a = string3;
            t.AddLocalizedString(a);
            localizedStrings.Add(a);
            Assert.That(modifiedType, Is.EqualTo(a.TypeId));
            modifiedType = null;
            CheckContents();

            LocalizedStringData string2Replacement = new LocalizedStringData("string2 replacement", string2.TypeId);

            t.ModifyLocalizedString(string2Replacement);
            localizedStrings[localizedStrings.IndexOf(string2)] = string2Replacement;
            Assert.That(modifiedType, Is.EqualTo(string2Replacement.TypeId));
            modifiedType = null;
            CheckContents();

            LocalizedStringData string3Replacement = new LocalizedStringData("replacement string 3", string3.TypeId);

            t.RenameType(string3.TypeId, string3Replacement.Name);
            localizedStrings[localizedStrings.IndexOf(string3)] = string3Replacement;
            Assert.That(modifiedType, Is.EqualTo(string3Replacement.TypeId));
            modifiedType = null;
            CheckContents();
        }