Setting tag if user is logged in.

A forum devoted to the discussion of all topics having to do with scripting and other advanced programming using iX Developer.
jydepower
Posts: 26
Joined: Thu Aug 16, 2012 9:33 am

Re: Setting tag if user is logged in.

Post by jydepower »

Now it just works fine with the ValueChanged as i original tried. I must have made some mistake before, and and confused me into a lot of other approaches.
Thanks.

void SystemTagCurrentUser_ValueChange(System.Object sender, Neo.ApplicationFramework.Interfaces.Events.ValueChangedEventArgs e)
{
if(Globals.Tags.SystemTagCurrentUser.Value == "")
// MessageBox.Show("0");
Globals.Tags.TestBit.Value = 0;
if(Globals.Tags.SystemTagCurrentUser.Value != "")
// MessageBox.Show("1");
Globals.Tags.TestBit.Value = 1;
}

Sarah
Posts: 12
Joined: Tue Dec 11, 2012 12:43 am

Re: Setting tag if user is logged in.

Post by Sarah »

Hi,

I would like a script that changes to 'screen 2' after a user is logged in.

My (failed) scripting attempts are as follows:

void SystemTagCurrentUser_ValueChange(System.Object sender, Neo.ApplicationFramework.Interfaces.Events.ValueChangedEventArgs e)
{
if(Globals.Tags.SystemTagCurrentUser.Value == "")

Globals.screen1.Show();

if(Globals.Tags.SystemTagCurrentUser.Value != "")

Globals.screen2.Show();
}

Any suggestions/corrections?

Thanks

User avatar
Edmund
Posts: 92
Joined: Thu Nov 29, 2012 2:27 pm

Re: Setting tag if user is logged in.

Post by Edmund »

Hi Sarah,

Your code works great, are you sure that you have spelled the name of the two screens right? Should the S in screen1/2 be capitalized?

Code: Select all

void SystemTagCurrentUser_ValueChange(System.Object sender, Neo.ApplicationFramework.Interfaces.Events.ValueChangedEventArgs e)
		{
			if(Globals.Tags.SystemTagCurrentUser.Value == "")
				Globals.Screen1.Show();

			if(Globals.Tags.SystemTagCurrentUser.Value != "")
				Globals.Screen2.Show();
		}
Best Regards
Edmund Andersson

AITECH AB

Part of Beijer Integrator Group

obara
Posts: 2
Joined: Mon Nov 04, 2013 8:06 am

Re: Setting tag if user is logged in.

Post by obara »

Hi,

I'm trying to make use of this script.
I've created a tag called: UserLoggedIn

I've pasted the code like this:

Code: Select all

//--------------------------------------------------------------
// Press F1 to get help about using script.
// To access an object that is not located in the current class, start the call with Globals.
// When using events and timers be cautious not to generate memoryleaks,
// please see the help for more information.
//---------------------------------------------------------------

namespace Neo.ApplicationFramework.Generated
{
	using System.Windows.Forms;
	using System;
	using System.Drawing;
	using Neo.ApplicationFramework.Tools;
	using Neo.ApplicationFramework.Common.Graphics.Logic;
	using Neo.ApplicationFramework.Controls;
	using Neo.ApplicationFramework.Interfaces;
    
    
	public partial class Hem
	{
		void SystemTagCurrentUser_ValueChange(System.Object sender, Neo.ApplicationFramework.Interfaces.Events.ValueChangedEventArgs e)
		{
			if(Globals.Tags.SystemTagCurrentUser.Value == "")
				Globals.Tags.UserLoggedIn.Value = 0;
			if(Globals.Tags.SystemTagCurrentUser.Value != "")
				Globals.Tags.UserLoggedIn.Value = 1; 
		}
	}
}
Unfortunately code doesn't work.

I can see the value change of the tag SystemTagCurrentUser in an AnalogNumeric field but nothing happens with the other tag.

How to make it work.

Thanks in advance!

obara
Posts: 2
Joined: Mon Nov 04, 2013 8:06 am

Re: Setting tag if user is logged in.

Post by obara »

Hi

It took only 1,5 months to get my post approved here. :)

My problem is solved.
It seems that sometimes when the code is pasted one has to "switch on" the code for the tag action even I the tree structure.
I even get random yellow marks beside code sometimes.
Seems that there is a bit of work for program developers here.

Post Reply