'How set a variable the Properties.Settings.Default?

I have two Properties files that store colors.

  1. Properties.Green.Theme
  2. Properties.PurpleTheme

The names of the parameters in the files are completely the same. I want to implement a theme change by switching between these two files. The simplest thing, in theory, is to assign a variable a value with a visibility level for the entire class. For example, var theme = Properties.GreenTheme.Default. And then use this variable in the methods. because the names are the same everywhere. Sample code in what form I want to do it:

public partial class FrmMain : Form{

TypeVar theme = null;

public FrmMain()
{
        InitializeComponent();

        if (i = 1)
        {
            theme = Properties.GreenTheme.Default;
        }

        if (i = 3)
        {
            theme = Properties.PurpleTheme.Default;
        }

        SetBottonColor();   
        SetPanelColor();

}

private void SetBottonColor()
{
    btn.BackColor = theme.button_color;
    btn2.BackColor = theme.button_color;
    btn3.BackColor = theme.button_color;
}

private void SetPanelColor()
{
   panel.BackColor = theme.panel_color;
   panel2.BackColor = theme.panel_color;
}

}

that is, in order not to prescribe if in each method, I want to create a variable at the class level and change it when loading the form. And since the names of the parameters in the files are the same, the colors would be taken from the desired file. Locally I can easily declare a variable

var theme = Properties.PurpleTheme.Default;

But I need it at the class level because there are a lot of such methods. object as var unfortunately does not work...

p.s. Sorry for my English



Solution 1:[1]

There is no way to access the content of an iframe if the document in the iframe is from a different domain. This is by design.

Read about Cross-origin script API access on MDN: https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy#cross-origin_script_api_access

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 paladin324