0

I tried to understand how it works but i am very slow with this(( so i decided ti ask here. In my prohramm i have static public class with different variables arrays, tabControls, Sizes, Pens an so on. But i need to set and get values of the variables from different threads how could i do it?

i have a class

  public static class GLOBAL_STATIC_DATA
{
   //.....
    private  static Size _get_Active_Project_ViewPort_Size()
    {       
      //.....
    }


    public  static Size Active_Project_ViewPort_Size
    {
        get 
        {               
            return _get_Active_Project_ViewPort_Size(); 
        }               
    }


    public static int Get_Panorama_Original_Image_Width()
    {

    }

   public static TabControl MainTab  =  new TabContol();

   public static int someInt =  100;
}

I need to write and to read all of that from different threads, could somebody help how shoud i change this static class to be able do that.

Alexey Gapon
  • 73
  • 2
  • 11

1 Answers1

0

You just precede the public static entries with the class name...for example:

Size sz = GLOBAL_STATIC_DATA.Active_Project_ViewPort_Size;
Idle_Mind
  • 38,363
  • 3
  • 29
  • 40
  • this results in an error. The compiler tells me I'm trying to use a value that is not the thread in which it was created. – Alexey Gapon Jun 08 '13 at 17:47
  • Yes..my answer was really how to access the static values in a class. For issues relating to threads and controls, see "[How to: Make Thread-Safe Calls to Windows Forms Controls](http://msdn.microsoft.com/en-us/library/ms171728(v=vs.80).aspx)". – Idle_Mind Jun 08 '13 at 18:16