Facebook
From Kazuan, 4 Years ago, written in C#.
Embed
Download Paste or View Raw
Hits: 220
  1. private void ThisProject_Startup(object sender, EventArgs e)        
  2. {            
  3.  try            
  4.   {              
  5.     obOnlineVar = this.OnlineVariables().CreateOnlineVariables("MyContainer");                
  6.     obOnlineVar.Add("OTWORZ");                
  7.     obOnlineVar.Define();                
  8.     obOnlineVar.VariableChange += new zenOn.VariableChangeEventHandler(obOnlineVar_VariableChange);            
  9.   }            
  10.  catch (Exception ex)            
  11.   {                
  12.     System.Diagnostics.Debug.Print("ERROR ThisProject_Startup : " + ex.Message + " " + ex.Source);            
  13.   }            
  14.  
  15.   this.Active += new zenOn.ActiveEventHandler(ThisProject_Active);            
  16.   this.Inactive += new zenOn.InactiveEventHandler(ThisProject_Inactive);        
  17. }
  18.  
  19. void obOnlineVar_VariableChange(zenOn.IVariable obVar)        
  20. {            
  21.   Macro_TEST();        
  22. }
  23.  
  24. void Macro_TEST()        
  25. {            
  26.  if (obOnlineVar.Item("OTWORZ").get_Value(0).Equals(true)) // <-- If i use .isOnline method insted .get_Value ect., the function "Switch_Info" starts, so I'm sure the variable is Online            
  27.   {                
  28.      this.RtFunctions().Item("Switch_Info").Start();            
  29.   }            
  30.  else            
  31.   {                
  32.      this.RtFunctions().Item("Close_Agreement").Start();    
  33.   }
  34. }
captcha