AutoSkin (1 Viewer)

GetWell

Portal Pro
October 4, 2006
205
32
Home Country
Denmark Denmark
Hello

I'm a new developer starting my first plugin :p

Lets see how far I can get :)

The idea of this plugin is that you can thoose witch skin you would like to have en a periode.

F.eks. I would personal like the x-mas skin i december :)

I know it takes 2 sek to change it manual, but hey you have to start somewhere!!


But i'm allready running in to trouble...

I have tryed to ask in the IRC-channel, but nobody answers :(

There fore ill try here :)
(I'm searching a developer I can PM to when I have problems... is that you?? :) )

My problem right now is that i can't get MP to change skin from my plugin... Are there some where in the code an method to do this allready??

Right now I manual search the skin directory to see witch skins are installed... Again are there some where in the code an method to do this allready??
 

Bram

Portal Pro
December 12, 2005
851
3
's-Hertogenbosch
Home Country
Netherlands Netherlands
It's possible to change the skin from the configuration interface. So that's where you'll probebely find the code you need.
 

moiristo

Portal Pro
November 17, 2006
342
27
Enschede
Home Country
Netherlands Netherlands
Code:
      // Set the skin to the selected skin and reload GUI
      GUIGraphicsContext.Skin = btnSkin.SelectedLabel;
      SaveSettings();
      GUITextureManager.Clear();
      GUITextureManager.Init();
      GUIFontManager.LoadFonts(GUIGraphicsContext.Skin + @"\fonts.xml");
      GUIFontManager.InitializeDeviceObjects();
      GUIControlFactory.ClearReferences();
      GUIControlFactory.LoadReferences(GUIGraphicsContext.Skin + @"\references.xml");
      using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml")))
      {
        xmlreader.SetValue("general", "skinobsoletecount", 0);
        bool autosize = xmlreader.GetValueAsBool("general", "autosize", true);
        if (autosize && !GUIGraphicsContext.Fullscreen)
          Form.ActiveForm.Size = new System.Drawing.Size(GUIGraphicsContext.SkinSize.Width, GUIGraphicsContext.SkinSize.Height);
      }
      GUIWindowManager.OnResize();
      GUIWindowManager.ActivateWindow(GetID);
      GUIControl.FocusControl(GetID, btnSkin.GetID);

This is the code from the configuration screen...
 

GetWell

Portal Pro
October 4, 2006
205
32
Home Country
Denmark Denmark
I can change skin now (almost) :)

Thanks Moiristo!

The most of it works now :)

I can't get this line to work:
Code:
Form.ActiveForm.Size = new System.Drawing.Size(GUIGraphicsContext.SkinSize.Width, GUIGraphicsContext.SkinSize.Height);
I think its an reference missing? But I can't find out witch one.

I found another problem..
Is it posible to make just one skin xml file for my plugin??
When I switch from BlueTwo to X-mas fore example, its says that my pluginskin does not exists in the x-mas skin directory.
Code:
public override bool Init()
{
   return Load(GUIGraphicsContext.Skin+@"\AutoSkin.xml");
}

I tryed to change it to:
Code:
public override bool Init()
{
   return Load(Config.GetSubFolder(Config.Dir.Plugins, "windows") + @"\AutoSkin.xml");}

but it didn't work :(
 

moiristo

Portal Pro
November 17, 2006
342
27
Enschede
Home Country
Netherlands Netherlands
The reference is just 'System.Windows.Forms'.

Code:
public override bool Init() { return Load(Config.GetSubFolder(Config.Dir.Plugins, "windows") + @"\AutoSkin.xml");}

I think that this should work...maybe Config.GetSubFolder returns the path with a trailing slash so the line ends with ...\\AutoSkin.xml?
 

GetWell

Portal Pro
October 4, 2006
205
32
Home Country
Denmark Denmark
...

I have reference til 'System.Windows.Forms'...

I get this error:
Error 2 The type or namespace name 'Size' does not exist in the namespace 'System.Drawing' (are you missing an assembly reference?) \Class1.cs 146 63 AutoSkin


regarding to the AutoSkin.xml i can see in the code that its hardcoded in MP... Look at this code (from the GUIWindow.cs line 457):
Code:
 _windowXmlFileName = GUIGraphicsContext.Skin + _windowXmlFileName.Substring(_windowXmlFileName.LastIndexOf("\\"));
So it doesn't matter witch folder i select it vil go to the current skin...
But okay then its easyer to make a skin to 4:3 and 16:9
 

Users who are viewing this thread

Top Bottom