Back to OIM Explorer

Designer.Editors/Designer.JobChainEditor/JobChainEdit.cs

Decompiler Source FileDesigner.Editors.JobChainEditDecompiled Source

2 extracted method/event/call references in JobChainEdit.

Source: F:\Claude\.tmp\oim-decompiled-full\0330_One_Identity_Manager_Designer.Editors.dll\Designer.JobChainEditor\JobChainEdit.cs

Source size: 64.571 characters

Interpretation

  • Decompiled source file. Use method/event registrations and call-site extraction to connect back to DialogMethod, QBMEvent, and API layers.

Relations

  • Event handler: 32 at line 391
  • Event handler: 16 at line 407

Typed Edges

  • No typed edges extracted for this source.

References

  • No direct source references extracted.

Referenced By

  • No direct source references extracted.

C# source-derived context

Generated by pattern extraction from the decompiled C# source and decompile index. This is factual source evidence, not inferred behavior.

reads entity values writes entity values references DB/Dialog objects Job/process related markers

Summary: classes JobChainEdit; methods OnDisposeOrPrepareForCaching, InitializeComponent, _InitializeComponent, SetValidity, LoadChain, SaveChain; references ESet, JobChain, JobEventGen, JobRunParameter; markers reads entity values, writes entity values, references DB/Dialog objects, Job/process related markers

Complete Source

C#1.990 lines
1using System;2using System.Collections;3using System.Collections.Generic;4using System.Collections.Specialized;5using System.ComponentModel;6using System.Drawing;7using System.Drawing.Imaging;8using System.Linq;9using System.Reflection;10using System.Runtime.CompilerServices;11using System.Text;12using System.Threading;13using System.Windows.Forms;14using System.Xml;15using Designer.Base;16using VI.Base;17using VI.Base.JobProcessing;18using VI.CommonDialogs;19using VI.ConsistencyChecks.Common;20using VI.Controls.ElementEdit;21using VI.DB;22using VI.DB.Entities;23using VI.FormBase;24using VI.ImageLibrary;25using VI.UI.Base.Images;2627namespace Designer.JobChainEditor;2829[ToolboxBitmap(typeof(JobChainEdit), "Designer.JobChainEditor.JobChainEdit.Pictures.JobChainEdit.bmp")]30public class JobChainEdit : ExpandElementEdit, IDbObjectEditor31{32	public enum ImageId33	{34		Event,35		Success,36		Error,37		Success2,38		Error2,39		GenCondition,40		Server,41		Notification,42		ProcessTracking,43		FreezeOnError,44		Retry,45		NoGenerate,46		Customized,47		RootJob,48		Empty49	}5051	protected IConnection _connection;5253	protected JobChainElement m_eJobChain;5455	protected SimulationResult m_SimulationResult;5657	private ContextMenuStrip popupMenu;5859	private ToolStripMenuItem menu_DeleteJob;6061	private ToolStripMenuItem menu_NewJob;6263	private ToolStripMenuItem menu_CopyJob;6465	private ToolStripMenuItem menu_PasteJob;6667	private ToolStripMenuItem menu_Properties;6869	private ToolStripMenuItem menu_ArrangeJobs;7071	private ImageList m_Images32;7273	private ImageList m_Images16;7475	private ValidityResult m_Validity;7677	private ManualResetEvent m_ValidityLock = new ManualResetEvent(true);7879	private System.IDisposable m_JobChainEditorObserverRegistration;8081	[CompilerGenerated]82	private EventHandler m_Saved;8384	[CompilerGenerated]85	private EventHandler m_Loaded;8687	[CompilerGenerated]88	private EventHandler m_ValidityChanged;8990	public bool ShowSimulation => m_SimulationResult != null;9192	public JobChainElement JobChainElement => m_eJobChain;9394	[DesignerSerializationVisibility(/*Could not decode attribute arguments.*/)]95	public SimulationResult SimulationResult96	{97		get98		{99			return m_SimulationResult;100		}101		set102		{103			_ClearSimulation();104			m_SimulationResult = value;105			if (value != null)106			{107				if (value.JobChain != null && !string.Equals(value.JobChain.TemplateID, m_eJobChain.Key, (StringComparison)5))108				{109					throw new ViException(1211011, ExceptionRelevance.EndUser);110				}111				_AssignSimulationData(value.JobChain);112			}113			FocusElement(null, deselect: true);114			((Control)this).Invalidate();115		}116	}117118	[DesignerSerializationVisibility(/*Could not decode attribute arguments.*/)]119	public ValidityResult Validity120	{121		get122		{123			return m_Validity;124		}125		private set126		{127			m_Validity = value;128			OnValidityChanged();129		}130	}131132	internal ImageList Images32 => m_Images32;133134	internal ImageList Images16 => m_Images16;135136	public string ModuleOwner137	{138		get139		{140			if (JobChainElement == null)141			{142				return "CCC";143			}144			return Uid.GetModuleOwner(JobChainElement.JobChainData.DBJobChain.GetValue("UID_JobChain"));145		}146	}147148	protected IConnection Connection => _connection;149150	[Category("Action")]151	[Description("Fired after the controls has saved data")]152	public event EventHandler Saved153	{154		[CompilerGenerated]155		add156		{157			//IL_0010: Unknown result type (might be due to invalid IL or missing references)158			//IL_0016: Expected O, but got Unknown159			EventHandler val = this.m_Saved;160			EventHandler val2;161			do162			{163				val2 = val;164				EventHandler val3 = (EventHandler)System.Delegate.Combine((System.Delegate)(object)val2, (System.Delegate)(object)value);165				val = Interlocked.CompareExchange<EventHandler>(ref this.m_Saved, val3, val2);166			}167			while (val != val2);168		}169		[CompilerGenerated]170		remove171		{172			//IL_0010: Unknown result type (might be due to invalid IL or missing references)173			//IL_0016: Expected O, but got Unknown174			EventHandler val = this.m_Saved;175			EventHandler val2;176			do177			{178				val2 = val;179				EventHandler val3 = (EventHandler)System.Delegate.Remove((System.Delegate)(object)val2, (System.Delegate)(object)value);180				val = Interlocked.CompareExchange<EventHandler>(ref this.m_Saved, val3, val2);181			}182			while (val != val2);183		}184	}185186	[Category("Action")]187	[Description("Fired after the controls has saved data")]188	public event EventHandler Loaded189	{190		[CompilerGenerated]191		add192		{193			//IL_0010: Unknown result type (might be due to invalid IL or missing references)194			//IL_0016: Expected O, but got Unknown195			EventHandler val = this.m_Loaded;196			EventHandler val2;197			do198			{199				val2 = val;200				EventHandler val3 = (EventHandler)System.Delegate.Combine((System.Delegate)(object)val2, (System.Delegate)(object)value);201				val = Interlocked.CompareExchange<EventHandler>(ref this.m_Loaded, val3, val2);202			}203			while (val != val2);204		}205		[CompilerGenerated]206		remove207		{208			//IL_0010: Unknown result type (might be due to invalid IL or missing references)209			//IL_0016: Expected O, but got Unknown210			EventHandler val = this.m_Loaded;211			EventHandler val2;212			do213			{214				val2 = val;215				EventHandler val3 = (EventHandler)System.Delegate.Remove((System.Delegate)(object)val2, (System.Delegate)(object)value);216				val = Interlocked.CompareExchange<EventHandler>(ref this.m_Loaded, val3, val2);217			}218			while (val != val2);219		}220	}221222	[Category("Action")]223	[Description("Fired after the Validity property has changed")]224	public event EventHandler ValidityChanged225	{226		[CompilerGenerated]227		add228		{229			//IL_0010: Unknown result type (might be due to invalid IL or missing references)230			//IL_0016: Expected O, but got Unknown231			EventHandler val = this.m_ValidityChanged;232			EventHandler val2;233			do234			{235				val2 = val;236				EventHandler val3 = (EventHandler)System.Delegate.Combine((System.Delegate)(object)val2, (System.Delegate)(object)value);237				val = Interlocked.CompareExchange<EventHandler>(ref this.m_ValidityChanged, val3, val2);238			}239			while (val != val2);240		}241		[CompilerGenerated]242		remove243		{244			//IL_0010: Unknown result type (might be due to invalid IL or missing references)245			//IL_0016: Expected O, but got Unknown246			EventHandler val = this.m_ValidityChanged;247			EventHandler val2;248			do249			{250				val2 = val;251				EventHandler val3 = (EventHandler)System.Delegate.Remove((System.Delegate)(object)val2, (System.Delegate)(object)value);252				val = Interlocked.CompareExchange<EventHandler>(ref this.m_ValidityChanged, val3, val2);253			}254			while (val != val2);255		}256	}257258	public JobChainEdit()259	{260		//IL_0002: Unknown result type (might be due to invalid IL or missing references)261		//IL_000c: Expected O, but got Unknown262		InitializeComponent();263		_InitializeComponent();264		base.ElementToolTip = new JobChainToolTipForm();265		base.Glowing = true;266	}267268	protected override void OnDisposeOrPrepareForCaching(bool dispose)269	{270		if (dispose)271		{272			if (m_JobChainEditorObserverRegistration != null)273			{274				m_JobChainEditorObserverRegistration.Dispose();275				m_JobChainEditorObserverRegistration = null;276			}277			if (m_ValidityLock != null)278			{279				((WaitHandle)m_ValidityLock).WaitOne();280				((WaitHandle)m_ValidityLock).Close();281				m_ValidityLock = null;282			}283			SetConnection(null);284			if (base.ElementToolTip != null)285			{286				((Component)base.ElementToolTip).Dispose();287				base.ElementToolTip = null;288			}289			if (m_Images32 != null)290			{291				((Component)m_Images32).Dispose();292				m_Images32 = null;293			}294			if (m_Images16 != null)295			{296				((Component)m_Images16).Dispose();297				m_Images16 = null;298			}299		}300		base.OnDisposeOrPrepareForCaching(dispose);301	}302303	private void InitializeComponent()304	{305		//IL_0001: Unknown result type (might be due to invalid IL or missing references)306		//IL_000b: Expected O, but got Unknown307		//IL_001e: Unknown result type (might be due to invalid IL or missing references)308		//IL_0028: Expected O, but got Unknown309		//IL_003f: Unknown result type (might be due to invalid IL or missing references)310		//IL_0054: Unknown result type (might be due to invalid IL or missing references)311		this.popupMenu = new ContextMenuStrip();312		((Control)this).SuspendLayout();313		((ToolStripDropDown)this.popupMenu).Opening += new CancelEventHandler(popupMenu_Popup);314		((Control)this).ContextMenuStrip = this.popupMenu;315		((Control)this).Size = new Size(496, 400);316		base.VirtualSize = new Size(496, 400);317		((Control)this).ResumeLayout(false);318	}319320	private void _InitializeComponent()321	{322		//IL_0012: Unknown result type (might be due to invalid IL or missing references)323		//IL_001c: Expected O, but got Unknown324		//IL_003e: Unknown result type (might be due to invalid IL or missing references)325		//IL_0048: Expected O, but got Unknown326		//IL_006b: Unknown result type (might be due to invalid IL or missing references)327		//IL_0075: Expected O, but got Unknown328		//IL_0094: Unknown result type (might be due to invalid IL or missing references)329		//IL_009e: Expected O, but got Unknown330		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)331		//IL_00cf: Expected O, but got Unknown332		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)333		//IL_00e6: Expected O, but got Unknown334		//IL_0105: Unknown result type (might be due to invalid IL or missing references)335		//IL_010f: Expected O, but got Unknown336		//IL_0132: Unknown result type (might be due to invalid IL or missing references)337		//IL_013c: Expected O, but got Unknown338		//IL_015e: Unknown result type (might be due to invalid IL or missing references)339		//IL_0168: Expected O, but got Unknown340		//IL_018a: Unknown result type (might be due to invalid IL or missing references)341		//IL_0194: Expected O, but got Unknown342		//IL_01a1: Unknown result type (might be due to invalid IL or missing references)343		//IL_01ab: Expected O, but got Unknown344		//IL_01cd: Unknown result type (might be due to invalid IL or missing references)345		//IL_01d7: Expected O, but got Unknown346		//IL_01f9: Unknown result type (might be due to invalid IL or missing references)347		//IL_0203: Expected O, but got Unknown348		//IL_0210: Unknown result type (might be due to invalid IL or missing references)349		//IL_021a: Expected O, but got Unknown350		//IL_023c: Unknown result type (might be due to invalid IL or missing references)351		//IL_0246: Expected O, but got Unknown352		//IL_026a: Unknown result type (might be due to invalid IL or missing references)353		//IL_0274: Expected O, but got Unknown354		//IL_028b: Unknown result type (might be due to invalid IL or missing references)355		//IL_0382: Unknown result type (might be due to invalid IL or missing references)356		//IL_038c: Expected O, but got Unknown357		//IL_03a3: Unknown result type (might be due to invalid IL or missing references)358		LanguageManager instance = LanguageManager.Instance;359		menu_NewJob = new ToolStripMenuItem(instance["JobChainEdit_menu_NewJob"]);360		((ToolStripItem)menu_NewJob).Image = ImageHandler.GetImage(StockImage.NewDocument);361		((ToolStripItem)menu_NewJob).Click += new EventHandler(menu_NewJob_Click);362		((ToolStrip)popupMenu).Items.Add((ToolStripItem)(object)menu_NewJob);363		menu_DeleteJob = new ToolStripMenuItem(instance["JobChainEdit_menu_DeleteJob"]);364		((ToolStripItem)menu_DeleteJob).Image = ImageHandler.GetImage(StockImage.DeleteDocument);365		((ToolStripItem)menu_DeleteJob).Click += new EventHandler(menu_DeleteJob_Click);366		((ToolStrip)popupMenu).Items.Add((ToolStripItem)(object)menu_DeleteJob);367		((ToolStrip)popupMenu).Items.Add((ToolStripItem)new ToolStripMenuItem("-"));368		menu_CopyJob = new ToolStripMenuItem(instance["JobChainEdit_menu_CopyJob"]);369		((ToolStripItem)menu_CopyJob).Image = ImageHandler.GetImage(StockImage.Copy);370		((ToolStripItem)menu_CopyJob).Click += new EventHandler(menu_CopyJob_Click);371		((ToolStrip)popupMenu).Items.Add((ToolStripItem)(object)menu_CopyJob);372		menu_PasteJob = new ToolStripMenuItem(instance["JobChainEdit_menu_PasteJob"]);373		((ToolStripItem)menu_PasteJob).Image = ImageHandler.GetImage(StockImage.Paste);374		((ToolStripItem)menu_PasteJob).Click += new EventHandler(menu_PasteJob_Click);375		((ToolStrip)popupMenu).Items.Add((ToolStripItem)(object)menu_PasteJob);376		((ToolStrip)popupMenu).Items.Add((ToolStripItem)new ToolStripSeparator());377		menu_ArrangeJobs = new ToolStripMenuItem(instance["JobChainEdit_menu_ArrangeJobs"]);378		((ToolStripItem)menu_ArrangeJobs).Image = ImageHandler.GetImage(StockImage.Workflow);379		((ToolStripItem)menu_ArrangeJobs).Click += new EventHandler(menu_ArrangeJobs_Click);380		((ToolStrip)popupMenu).Items.Add((ToolStripItem)(object)menu_ArrangeJobs);381		((ToolStrip)popupMenu).Items.Add((ToolStripItem)new ToolStripSeparator());382		menu_Properties = new ToolStripMenuItem(instance["JobChainEdit_menu_Properties"]);383		((ToolStripItem)menu_Properties).Image = ImageHandler.GetImage(StockImage.Properties);384		((ToolStripItem)menu_Properties).Click += new EventHandler(menu_Properties_Click);385		((ToolStrip)popupMenu).Items.Add((ToolStripItem)(object)menu_Properties);386		((Control)this).ContextMenuStrip = popupMenu;387		m_Images32 = new ImageList();388		m_Images32.ColorDepth = (ColorDepth)32;389		m_Images32.ImageSize = new Size(32, 32);390		Assembly assembly = typeof(JobChainEdit).Assembly;391		ImageListTools.AddEmbeddedResource(assembly, "Designer.Editors.JobChainEditor.Resources.Event_32.png", m_Images32);392		ImageListTools.AddEmbeddedResource(assembly, "Designer.Editors.JobChainEditor.Resources.Success_32.png", m_Images32);393		ImageListTools.AddEmbeddedResource(assembly, "Designer.Editors.JobChainEditor.Resources.Error_32.png", m_Images32);394		ImageListTools.AddEmbeddedResource(assembly, "Designer.Editors.JobChainEditor.Resources.Success_2_32.png", m_Images32);395		ImageListTools.AddEmbeddedResource(assembly, "Designer.Editors.JobChainEditor.Resources.Error_2_32.png", m_Images32);396		ImageListTools.AddEmbeddedResource(assembly, "Designer.Editors.JobChainEditor.Resources.GenCondition_32.png", m_Images32);397		ImageListTools.AddEmbeddedResource(assembly, "Designer.Editors.JobChainEditor.Resources.Server_32.png", m_Images32);398		ImageListTools.AddEmbeddedResource(assembly, "Designer.Editors.JobChainEditor.Resources.Notification_32.png", m_Images32);399		ImageListTools.AddEmbeddedResource(assembly, "Designer.Editors.JobChainEditor.Resources.ProgressView_32.png", m_Images32);400		ImageListTools.AddEmbeddedResource(assembly, "Designer.Editors.JobChainEditor.Resources.StopOnError_32.png", m_Images32);401		ImageListTools.AddEmbeddedResource(assembly, "Designer.Editors.JobChainEditor.Resources.Retry_32.png", m_Images32);402		ImageListTools.AddEmbeddedResource(assembly, "Designer.Editors.JobChainEditor.Resources.NoGenerate_32.png", m_Images32);403		ImageListTools.AddEmbeddedResource(assembly, "Designer.Editors.JobChainEditor.Resources.Customized_32.png", m_Images32);404		m_Images16 = new ImageList();405		m_Images16.ColorDepth = (ColorDepth)32;406		m_Images16.ImageSize = new Size(16, 16);407		ImageListTools.AddEmbeddedResource(assembly, "Designer.Editors.JobChainEditor.Resources.Event_16.png", m_Images16);408		ImageListTools.AddEmbeddedResource(assembly, "Designer.Editors.JobChainEditor.Resources.Success_16.png", m_Images16);409		ImageListTools.AddEmbeddedResource(assembly, "Designer.Editors.JobChainEditor.Resources.Error_16.png", m_Images16);410		ImageListTools.AddEmbeddedResource(assembly, "Designer.Editors.JobChainEditor.Resources.Success_2_16.png", m_Images16);411		ImageListTools.AddEmbeddedResource(assembly, "Designer.Editors.JobChainEditor.Resources.Error_2_16.png", m_Images16);412		ImageListTools.AddEmbeddedResource(assembly, "Designer.Editors.JobChainEditor.Resources.GenCondition_16.png", m_Images16);413		ImageListTools.AddEmbeddedResource(assembly, "Designer.Editors.JobChainEditor.Resources.Server_16.png", m_Images16);414		ImageListTools.AddEmbeddedResource(assembly, "Designer.Editors.JobChainEditor.Resources.Notification_16.png", m_Images16);415		ImageListTools.AddEmbeddedResource(assembly, "Designer.Editors.JobChainEditor.Resources.ProgressView_16.png", m_Images16);416		ImageListTools.AddEmbeddedResource(assembly, "Designer.Editors.JobChainEditor.Resources.StopOnError_16.png", m_Images16);417		ImageListTools.AddEmbeddedResource(assembly, "Designer.Editors.JobChainEditor.Resources.Retry_16.png", m_Images16);418		ImageListTools.AddEmbeddedResource(assembly, "Designer.Editors.JobChainEditor.Resources.NoGenerate_16.png", m_Images16);419		ImageListTools.AddEmbeddedResource(assembly, "Designer.Editors.JobChainEditor.Resources.Customized_16.png", m_Images16);420	}421422	private void SetValidity(ValidityResult vResult)423	{424		Validity = vResult;425	}426427	public void LoadChain(IConnection dbConnection, string uidJobChain, bool bLoadByName)428	{429		ISingleDbObject singleDbObject = dbConnection.CreateSingle("JobChain");430		singleDbObject.PutValue("UID_JobChain", uidJobChain);431		singleDbObject.Load();432		LoadChain(singleDbObject, bLoadByName);433	}434435	public void LoadChain(ISingleDbObject dbJobChain, bool bLoadByName)436	{437		try438		{439			Cursor.Current = Cursors.WaitCursor;440			SetValidity(null);441			SetConnection(dbJobChain.Connection);442			dbJobChain.ProcessContext = new ProcessContext(_connection);443			Clear();444			if (bLoadByName)445			{446				_LoadChainList(dbJobChain);447			}448			else449			{450				_LoadChainTree(dbJobChain);451			}452			ArrangeElements(bNew: false);453			_CalculateRealSize();454			CheckJobChainConsistency();455			OnLoaded();456		}457		finally458		{459			Cursor.Current = Cursors.Default;460			base.IsChanged = false;461		}462	}463464	public void SaveChain()465	{466		if (m_eJobChain == null)467		{468			return;469		}470		try471		{472			Cursor.Current = Cursors.WaitCursor;473			_connection.BeginTransaction();474			_SaveConnectors(m_eJobChain);475			_CheckAndUpdateElements(m_eJobChain);476			_SaveJobChainElementsToDB(m_eJobChain);477			_SaveJobDeletedToDB();478			base.IsChanged = false;479			_connection.CommitTransaction();480			OnSaved();481		}482		catch (System.Exception innerException)483		{484			_connection.RollbackTransaction();485			throw new ViException(1211010, innerException);486		}487		finally488		{489			Cursor.Current = Cursors.Default;490		}491	}492493	public void NewJobChain(IConnection dbConnection)494	{495		try496		{497			Cursor.Current = Cursors.WaitCursor;498			lock (this)499			{500				SetConnection(dbConnection);501				Clear();502				ISingleDbObject singleDbObject = dbConnection.CreateSingle("JobChain");503				singleDbObject["Name"].NewValue = GetUniqueJobChainName(LanguageManager.Instance.GetString("JobChainEditControl_NewJobChain"));504				JobChainElement jobChainElement = new JobChainElement(new JobChainData(singleDbObject), this);505				jobChainElement.Name = singleDbObject.Display;506				jobChainElement.Key = singleDbObject["UID_JobChain"].New.String;507				Elements.Add(jobChainElement);508				m_eJobChain = jobChainElement;509				ArrangeElements(bNew: false);510				_CalculateRealSize();511				FocusElement(jobChainElement, deselect: true);512			}513		}514		finally515		{516			Cursor.Current = Cursors.Default;517		}518	}519520	public void ArrangeElements(bool bNew)521	{522		if (m_eJobChain != null)523		{524			string strPositions = m_eJobChain.JobChainData.DBJobChain["LayoutPositions"].New.String.ToLowerInvariant();525			if (bNew || !_ArrangeByPositionString(strPositions))526			{527				_ArrangeNew();528			}529			_CalculateRealSize();530		}531	}532533	public virtual void InsertNewJob()534	{535		//IL_008f: Unknown result type (might be due to invalid IL or missing references)536		//IL_0094: Unknown result type (might be due to invalid IL or missing references)537		//IL_0099: Unknown result type (might be due to invalid IL or missing references)538		ISingleDbObject singleDbObject = _connection.CreateSingle("Job");539		singleDbObject["Name"].NewValue = GetUniqueJobName(LanguageManager.Instance.GetString("JobChainEditControl_NewJobName"));540		singleDbObject["UID_JobChain"].NewValue = JobChainElement.JobChainData.DBJobChain["UID_JobChain"].NewValue;541		JobElement jobElement = new JobElement(new JobData(singleDbObject), this);542		jobElement.Key = singleDbObject["UID_Job"].New.String;543		Point val = FullRealToVirtual(base.MouseClickPos);544		jobElement.Move(((Point)(ref val)).X, ((Point)(ref val)).Y);545		Elements.Add(jobElement);546		FocusElement(jobElement, deselect: true);547		singleDbObject["Name"].NewValue = singleDbObject["Name"].New.String;548	}549550	public virtual void InsertJob(string strUID_Job)551	{552		//IL_001c: Unknown result type (might be due to invalid IL or missing references)553		//IL_0021: Unknown result type (might be due to invalid IL or missing references)554		//IL_0026: Unknown result type (might be due to invalid IL or missing references)555		_LoadJob(strUID_Job, recursiv: false);556		JobElement jobElement = (JobElement)Elements[strUID_Job];557		Point val = FullRealToVirtual(base.MouseClickPos);558		jobElement.Move(((Point)(ref val)).X, ((Point)(ref val)).Y);559		FocusElement(jobElement, deselect: true);560	}561562	public string GetUniqueJobName(string strBase)563	{564		string text = strBase;565		JobElement jobElement = _GetJobElementByName(text, ignoreCase: true, null);566		int num = 1;567		while (jobElement != null)568		{569			text = $"{strBase}_{num.ToString()}";570			jobElement = _GetJobElementByName(text, ignoreCase: true, null);571			num++;572		}573		return text;574	}575576	public string GetUniqueJobChainName(string strBaseName)577	{578		string text = strBaseName;579		int num = 1;580		ISqlFormatter sqlFormatter = Connection.SqlFormatter;581		bool flag = Connection.Exists("JobChain", sqlFormatter.Comparison("Name", text, ValType.String));582		while (flag)583		{584			text = $"{strBaseName}_{num.ToString()}";585			flag = Connection.Exists("JobChain", sqlFormatter.Comparison("Name", text, ValType.String));586			num++;587		}588		return text;589	}590591	public void EditObject(DbObjectKey dbObjectKey)592	{593		if (dbObjectKey == null || m_eJobChain == null)594		{595			return;596		}597		string text = dbObjectKey.Tablename.ToUpperInvariant();598		if (!(text == "JOBCHAIN") && !(text == "JOBEVENTGEN"))599		{600			if (!(text == "JOB"))601			{602				if (text == "JOBRUNPARAMETER")603				{604					ISingleDbObject singleDbObject = dbObjectKey.GetObject(JobChainElement.JobChainData.DBJobChain.Connection);605					EditObject(new DbObjectKey(singleDbObject.GetFK("UID_Job")));606				}607				return;608			}609			JobElement jobElement = _GetJobElementByObjectKey(dbObjectKey);610			if (jobElement != null)611			{612				EnsureVisible(jobElement);613				FocusElement(jobElement, deselect: true);614			}615		}616		else if (m_eJobChain != null)617		{618			EnsureVisible(m_eJobChain);619			FocusElement(m_eJobChain, deselect: true);620		}621	}622623	private JobElement _GetJobElementByObjectKey(DbObjectKey dbObjectKey)624	{625		System.Collections.Generic.IEnumerator<Element> enumerator = Elements.GetEnumerator();626		try627		{628			while (((System.Collections.IEnumerator)enumerator).MoveNext())629			{630				if (enumerator.Current is JobElement jobElement && dbObjectKey.CompareTo(new DbObjectKey(jobElement.JobData.DBJob)) == 0)631				{632					return jobElement;633				}634			}635		}636		finally637		{638			((System.IDisposable)enumerator)?.Dispose();639		}640		return null;641	}642643	private JobElement _GetJobElementByName(string strName, bool ignoreCase, JobElement eJobIgnore)644	{645		System.Collections.Generic.IEnumerator<Element> enumerator = Elements.GetEnumerator();646		try647		{648			while (((System.Collections.IEnumerator)enumerator).MoveNext())649			{650				if (enumerator.Current is JobElement jobElement && string.Compare(jobElement.Name, strName, ignoreCase) == 0)651				{652					if (eJobIgnore == null)653					{654						return jobElement;655					}656					if (eJobIgnore != jobElement)657					{658						return jobElement;659					}660				}661			}662		}663		finally664		{665			((System.IDisposable)enumerator)?.Dispose();666		}667		return null;668	}669670	public static Image RenderJobChain(IConnection dbConnection, string uidJobChain, ImageFormat imgFormat)671	{672		//IL_0008: Unknown result type (might be due to invalid IL or missing references)673		//IL_0016: Unknown result type (might be due to invalid IL or missing references)674		//IL_0029: Unknown result type (might be due to invalid IL or missing references)675		if (dbConnection == null)676		{677			throw new ArgumentNullException("dbConnection");678		}679		if (imgFormat == null)680		{681			throw new ArgumentNullException("imgFormat");682		}683		if (string.IsNullOrWhiteSpace(uidJobChain))684		{685			throw new ArgumentNullException("uidJobChain");686		}687		JobChainEdit jobChainEdit = new JobChainEdit();688		try689		{690			jobChainEdit.LoadChain(dbConnection, uidJobChain, bLoadByName: true);691			return jobChainEdit.RenderToImage(imgFormat);692		}693		finally694		{695			((Component)jobChainEdit).Dispose();696		}697	}698699	[Obsolete("Do not use any more")]700	public static ISingleDbObject Clone_Object(ISingleDbObject dbObject)701	{702		//IL_0008: Unknown result type (might be due to invalid IL or missing references)703		if (dbObject == null)704		{705			throw new ArgumentNullException("dbObject");706		}707		ISingleDbObject singleDbObject = dbObject.Connection.CreateSingle(dbObject.Tablename);708		System.Collections.Generic.IEnumerator<IDbColumn> enumerator = ((System.Collections.Generic.IEnumerable<IDbColumn>)dbObject.Columns).GetEnumerator();709		try710		{711			while (((System.Collections.IEnumerator)enumerator).MoveNext())712			{713				IDbColumn current = enumerator.Current;714				if (!current.ColDef.IsSpecial)715				{716					singleDbObject[current.Columnname].NewValue = dbObject[current.Columnname].New.Value;717				}718				singleDbObject[current.Columnname].CanEdit = dbObject[current.Columnname].CanEdit;719			}720			return singleDbObject;721		}722		finally723		{724			((System.IDisposable)enumerator)?.Dispose();725		}726	}727728	[Obsolete("Do not use any more")]729	public static void Assign_ToObject(ISingleDbObject dbSource, ISingleDbObject dbDestination)730	{731		//IL_0008: Unknown result type (might be due to invalid IL or missing references)732		//IL_0016: Unknown result type (might be due to invalid IL or missing references)733		if (dbSource == null)734		{735			throw new ArgumentNullException("dbSource");736		}737		if (dbDestination == null)738		{739			throw new ArgumentNullException("dbDestination");740		}741		System.Collections.Generic.IEnumerator<IDbColumn> enumerator = ((System.Collections.Generic.IEnumerable<IDbColumn>)dbSource.Columns).GetEnumerator();742		try743		{744			while (((System.Collections.IEnumerator)enumerator).MoveNext())745			{746				IDbColumn current = enumerator.Current;747				if (!current.ColDef.IsPK && !current.ColDef.IsSpecial && dbDestination[current.Columnname].New.String != dbSource[current.Columnname].New.String)748				{749					dbDestination[current.Columnname].NewValue = dbSource[current.Columnname].NewValue;750				}751			}752		}753		finally754		{755			((System.IDisposable)enumerator)?.Dispose();756		}757	}758759	private static void _SimElement(Element elem)760	{761		_ = elem is JobChainElement;762		if (elem is JobElement jobElement)763		{764			_ = jobElement.JobData.SimJob;765		}766	}767768	private void _SelectElement_Sub(Element elem, TabAlignment direction)769	{770		//IL_000e: Unknown result type (might be due to invalid IL or missing references)771		//IL_0010: Invalid comparison between Unknown and I4772		//IL_0079: Unknown result type (might be due to invalid IL or missing references)773		//IL_0012: Unknown result type (might be due to invalid IL or missing references)774		//IL_0014: Invalid comparison between Unknown and I4775		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)776		//IL_00cf: Invalid comparison between Unknown and I4777		//IL_0016: Unknown result type (might be due to invalid IL or missing references)778		//IL_0018: Invalid comparison between Unknown and I4779		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)780		//IL_00d3: Invalid comparison between Unknown and I4781		//IL_012a: Unknown result type (might be due to invalid IL or missing references)782		//IL_012c: Invalid comparison between Unknown and I4783		if (elem == null)784		{785			return;786		}787		if (elem is JobChainElement jobChainElement && ((int)direction == 1 || (int)direction == 2 || (int)direction == 3) && Connectors.ContainsKey(jobChainElement.Key + "-ROOTJOB"))788		{789			Connector connector = Connectors[jobChainElement.Key + "-ROOTJOB"];790			FocusElement(connector.ElementEnd, deselect: true);791			EnsureVisible(connector.ElementEnd);792		}793		if (!(elem is JobElement jobElement))794		{795			return;796		}797		if ((int)direction == 0)798		{799			System.Collections.Generic.IEnumerator<Connector> enumerator = Connectors.GetEnumerator();800			try801			{802				while (((System.Collections.IEnumerator)enumerator).MoveNext())803				{804					Connector current = enumerator.Current;805					if (current.ElementEnd == jobElement)806					{807						FocusElement(current.ElementStart, deselect: true);808						EnsureVisible(current.ElementStart);809						break;810					}811				}812			}813			finally814			{815				((System.IDisposable)enumerator)?.Dispose();816			}817		}818		if (((int)direction == 2 || (int)direction == 1) && Connectors.ContainsKey(jobElement.Key + "-SUCCESS"))819		{820			Connector connector2 = Connectors[jobElement.Key + "-SUCCESS"];821			FocusElement(connector2.ElementEnd, deselect: true);822			EnsureVisible(connector2.ElementEnd);823		}824		if ((int)direction == 3 && Connectors.ContainsKey(jobElement.Key + "-ERROR"))825		{826			Connector connector3 = Connectors[jobElement.Key + "-ERROR"];827			FocusElement(connector3.ElementEnd, deselect: true);828			EnsureVisible(connector3.ElementEnd);829		}830	}831832	private void _ShowJobProperties()833	{834		Element selected = base.Selected;835		if (selected != null)836		{837			if (selected is JobChainElement jobChainElement)838			{839				ObjectPropertiesDialog.Show(((Control)this).FindForm(), jobChainElement.JobChainData.DBJobChain);840			}841			if (selected is JobElement jobElement)842			{843				ObjectPropertiesDialog.Show(((Control)this).FindForm(), jobElement.JobData.DBJob);844			}845		}846	}847848	protected void OnLoaded()849	{850		//IL_000f: Unknown result type (might be due to invalid IL or missing references)851		//IL_0019: Expected O, but got Unknown852		if (this.Loaded != null)853		{854			this.Loaded.Invoke((object)this, new EventArgs());855		}856	}857858	protected void OnSaved()859	{860		//IL_000f: Unknown result type (might be due to invalid IL or missing references)861		//IL_0019: Expected O, but got Unknown862		if (this.Saved != null)863		{864			this.Saved.Invoke((object)this, new EventArgs());865		}866	}867868	protected override void OnCopyFromClipBoard()869	{870		if (base.IsChanged)871		{872			SaveChain();873		}874		base.OnCopyFromClipBoard();875	}876877	private void _ArrangeNew()878	{879		//IL_0058: Unknown result type (might be due to invalid IL or missing references)880		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)881		m_eJobChain.Move(20, 20);882		if (!Connectors.ContainsKey(m_eJobChain.Key + "-ROOTJOB"))883		{884			return;885		}886		ResetProcessFlag();887		System.Collections.Generic.IEnumerator<Element> enumerator = Elements.GetEnumerator();888		try889		{890			while (((System.Collections.IEnumerator)enumerator).MoveNext())891			{892				if (enumerator.Current is JobElement jobElement)893				{894					jobElement.Level = Point.Empty;895				}896			}897		}898		finally899		{900			((System.IDisposable)enumerator)?.Dispose();901		}902		_InitializeJobLevel(new ElementCollection(), Connectors[m_eJobChain.Key + "-ROOTJOB"].ElementEnd as JobElement, new Point(0, 0));903		m_eJobChain.Processed = true;904		_ArrangeTreeJobs();905		_ArrangeEmptyJobs();906		_ArrangeConnectors();907	}908909	private void _ArrangeTreeJobs()910	{911		//IL_001f: Unknown result type (might be due to invalid IL or missing references)912		//IL_0024: Unknown result type (might be due to invalid IL or missing references)913		//IL_002d: Unknown result type (might be due to invalid IL or missing references)914		//IL_0032: Unknown result type (might be due to invalid IL or missing references)915		//IL_0042: Unknown result type (might be due to invalid IL or missing references)916		//IL_0047: Unknown result type (might be due to invalid IL or missing references)917		//IL_0050: Unknown result type (might be due to invalid IL or missing references)918		//IL_0055: Unknown result type (might be due to invalid IL or missing references)919		System.Collections.Generic.IEnumerator<Element> enumerator = Elements.GetEnumerator();920		try921		{922			while (((System.Collections.IEnumerator)enumerator).MoveNext())923			{924				if (enumerator.Current is JobElement jobElement)925				{926					Point level = jobElement.Level;927					int x = ((Point)(ref level)).X;928					Rectangle rectangle = jobElement.Rectangle;929					int x2 = x * (((Rectangle)(ref rectangle)).Width + 20) + 20;930					level = jobElement.Level;931					int y = ((Point)(ref level)).Y;932					rectangle = jobElement.Rectangle;933					jobElement.Move(x2, y * (((Rectangle)(ref rectangle)).Height + 20) + 120);934				}935			}936		}937		finally938		{939			((System.IDisposable)enumerator)?.Dispose();940		}941	}942943	private void _ArrangeEmptyJobs()944	{945		int num = 160;946		System.Collections.Generic.IEnumerator<Element> enumerator = Elements.GetEnumerator();947		try948		{949			while (((System.Collections.IEnumerator)enumerator).MoveNext())950			{951				Element current = enumerator.Current;952				if (!current.Processed)953				{954					current.Move(num, 20);955					num += 160;956				}957			}958		}959		finally960		{961			((System.IDisposable)enumerator)?.Dispose();962		}963	}964965	private void _ArrangeConnectors()966	{967		System.Collections.Generic.IEnumerator<Connector> enumerator = Connectors.GetEnumerator();968		try969		{970			while (((System.Collections.IEnumerator)enumerator).MoveNext())971			{972				Connector current = enumerator.Current;973				int num = current.ElementEnd.Y - current.ElementStart.Y;974				if (num > 0)975				{976					if (current.Key.EndsWith("ERROR"))977					{978						current.Disarrange = Math.Min(20000 / num, 1000);979					}980					else981					{982						current.Disarrange = 600;983					}984				}985			}986		}987		finally988		{989			((System.IDisposable)enumerator)?.Dispose();990		}991	}992993	private void _InitializeJobLevel(ElementCollection ecParents, JobElement eJob, Point pLevel)994	{995		//IL_0013: Unknown result type (might be due to invalid IL or missing references)996		//IL_0018: Unknown result type (might be due to invalid IL or missing references)997		//IL_002b: Unknown result type (might be due to invalid IL or missing references)998		//IL_0030: Unknown result type (might be due to invalid IL or missing references)999		//IL_0038: Unknown result type (might be due to invalid IL or missing references)1000		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)1001		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)1002		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)1003		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)1004		//IL_00df: Unknown result type (might be due to invalid IL or missing references)1005		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)1006		//IL_0162: Unknown result type (might be due to invalid IL or missing references)1007		//IL_014d: Unknown result type (might be due to invalid IL or missing references)1008		//IL_0171: Unknown result type (might be due to invalid IL or missing references)1009		//IL_0176: Unknown result type (might be due to invalid IL or missing references)1010		//IL_0181: Unknown result type (might be due to invalid IL or missing references)1011		//IL_0186: Unknown result type (might be due to invalid IL or missing references)1012		//IL_018e: Unknown result type (might be due to invalid IL or missing references)1013		//IL_019b: Unknown result type (might be due to invalid IL or missing references)1014		if (eJob == null)1015		{1016			return;1017		}1018		ecParents.Add(eJob);1019		int x = ((Point)(ref pLevel)).X;1020		Point level = eJob.Level;1021		if (x >= ((Point)(ref level)).X)1022		{1023			int x2 = ((Point)(ref pLevel)).X;1024			level = eJob.Level;1025			eJob.Level = new Point(x2, ((Point)(ref level)).Y);1026		}1027		if (Connectors.ContainsKey(eJob.Key + "-ERROR"))1028		{1029			JobElement jobElement = Connectors[eJob.Key + "-ERROR"].ElementEnd as JobElement;1030			if (!ecParents.ContainsKey(jobElement.Key))1031			{1032				_InitializeJobLevel(ecParents, jobElement, new Point(((Point)(ref pLevel)).X + 1, ((Point)(ref pLevel)).Y + 1));1033			}1034		}1035		int y = ((Point)(ref pLevel)).Y;1036		level = eJob.Level;1037		if (y >= ((Point)(ref level)).Y)1038		{1039			level = eJob.Level;1040			eJob.Level = new Point(((Point)(ref level)).X, ((Point)(ref pLevel)).Y);1041		}1042		if (Connectors.ContainsKey(eJob.Key + "-SUCCESS"))1043		{1044			JobElement jobElement2 = Connectors[eJob.Key + "-SUCCESS"].ElementEnd as JobElement;1045			if (!ecParents.ContainsKey(jobElement2.Key))1046			{1047				_InitializeJobLevel(ecParents, jobElement2, new Point(((Point)(ref pLevel)).X, ((Point)(ref pLevel)).Y + 1));1048			}1049		}1050		ecParents.Remove(eJob);1051		for (JobElement jobElement3 = _ExistsLevel(eJob, eJob.Level); jobElement3 != null; jobElement3 = _ExistsLevel(jobElement3, jobElement3.Level))1052		{1053			JobElement jobElement4 = jobElement3;1054			level = jobElement3.Level;1055			int num = ((Point)(ref level)).X + 1;1056			level = jobElement3.Level;1057			jobElement4.Level = new Point(num, ((Point)(ref level)).Y);1058		}1059		eJob.Processed = true;1060	}10611062	private JobElement _ExistsLevel(JobElement jeSelf, Point pLevel)1063	{1064		//IL_0022: Unknown result type (might be due to invalid IL or missing references)1065		//IL_0027: Unknown result type (might be due to invalid IL or missing references)1066		//IL_002a: Unknown result type (might be due to invalid IL or missing references)1067		System.Collections.Generic.IEnumerator<Element> enumerator = Elements.GetEnumerator();1068		try1069		{1070			while (((System.Collections.IEnumerator)enumerator).MoveNext())1071			{1072				if (enumerator.Current is JobElement jobElement && jobElement != jeSelf)1073				{1074					Point level = jobElement.Level;1075					if (((Point)(ref level)).Equals(pLevel))1076					{1077						return jobElement;1078					}1079				}1080			}1081		}1082		finally1083		{1084			((System.IDisposable)enumerator)?.Dispose();1085		}1086		return null;1087	}10881089	private string _GetPositionString()1090	{1091		//IL_000b: Unknown result type (might be due to invalid IL or missing references)1092		//IL_0011: Expected O, but got Unknown1093		ElementCollection elementCollection = new ElementCollection();1094		StringBuilder val = new StringBuilder(2048);1095		bool flag = true;1096		char c = '\a';1097		char c2 = '\b';1098		val.Append("V1.1");1099		val.Append(c);1100		System.Collections.Generic.IEnumerator<Element> enumerator = Elements.GetEnumerator();1101		try1102		{1103			while (((System.Collections.IEnumerator)enumerator).MoveNext())1104			{1105				Element current = enumerator.Current;1106				elementCollection.Add(current);1107			}1108		}1109		finally1110		{1111			((System.IDisposable)enumerator)?.Dispose();1112		}1113		elementCollection.Sort(new ElementNameComparer());1114		enumerator = elementCollection.GetEnumerator();1115		try1116		{1117			while (((System.Collections.IEnumerator)enumerator).MoveNext())1118			{1119				Element current2 = enumerator.Current;1120				if (flag)1121				{1122					flag = false;1123				}1124				else1125				{1126					val.Append(c);1127				}1128				if (current2 is JobChainElement)1129				{1130					val.Append("JobChain_" + current2.Name);1131				}1132				else1133				{1134					val.Append(current2.Name);1135				}1136				val.Append(c2);1137				val.Append(current2.X.ToString());1138				val.Append(c2);1139				val.Append(current2.Y.ToString());1140				if (Connectors.ContainsKey(current2.Key + "-ROOTJOB"))1141				{1142					JobConnector jobConnector = Connectors[current2.Key + "-ROOTJOB"] as JobConnector;1143					val.Append(c2);1144					val.Append("R" + jobConnector.Disarrange);1145				}1146				if (Connectors.ContainsKey(current2.Key + "-SUCCESS"))1147				{1148					JobConnector jobConnector2 = Connectors[current2.Key + "-SUCCESS"] as JobConnector;1149					val.Append(c2);1150					val.Append("S" + jobConnector2.Disarrange);1151				}1152				if (Connectors.ContainsKey(current2.Key + "-ERROR"))1153				{1154					JobConnector jobConnector3 = Connectors[current2.Key + "-ERROR"] as JobConnector;1155					val.Append(c2);1156					val.Append("E" + jobConnector3.Disarrange);1157				}1158			}1159		}1160		finally1161		{1162			((System.IDisposable)enumerator)?.Dispose();1163		}1164		return ((object)val).ToString();1165	}11661167	private bool _ArrangeByPositionString(string strPositions)1168	{1169		char c = '\a';1170		char c2 = '\b';1171		float num = 1f;1172		float num2 = 1f;1173		bool flag = false;1174		if (strPositions.StartsWith("v1.0"))1175		{1176			num = 1.5f;1177			num2 = 1.2f;1178		}1179		else1180		{1181			if (!strPositions.StartsWith("v1.1"))1182			{1183				return false;1184			}1185			flag = true;1186		}1187		string[] array = strPositions.Split(c, (StringSplitOptions)0);1188		if (((System.Array)array).GetLength(0) > 1)1189		{1190			ResetProcessFlag();1191			for (int i = 1; i < ((System.Array)array).GetLength(0); i++)1192			{1193				string[] vElement = array[i].Split(c2, (StringSplitOptions)0);1194				Element element = ((!flag) ? Enumerable.FirstOrDefault<Element>((System.Collections.Generic.IEnumerable<Element>)Elements, (Func<Element, bool>)((Element e) => string.Equals(e.Name, vElement[0], (StringComparison)5))) : (vElement[0].StartsWith("JobChain_", (StringComparison)5) ? JobChainElement : Enumerable.FirstOrDefault<Element>((System.Collections.Generic.IEnumerable<Element>)Elements, (Func<Element, bool>)((Element e) => string.Equals(e.Name, vElement[0], (StringComparison)5) && e is JobElement))));1195				if (element == null)1196				{1197					continue;1198				}1199				Element element2 = element;1200				element2.Move((int)((float)Convert.ToInt32(vElement[1]) * num), (int)((float)Convert.ToInt32(vElement[2]) * num2));1201				element2.Processed = true;1202				if (((System.Array)vElement).GetLength(0) <= 3)1203				{1204					continue;1205				}1206				for (int num3 = 3; num3 < ((System.Array)vElement).GetLength(0); num3++)1207				{1208					string obj = vElement[num3];1209					char c3 = obj[0];1210					int disarrange = Convert.ToInt32(obj.Substring(1));1211					JobConnector jobConnector = null;1212					switch (c3)1213					{1214					case 'r':1215						if (Connectors.ContainsKey(element2.Key + "-ROOTJOB"))1216						{1217							jobConnector = Connectors[element2.Key + "-ROOTJOB"] as JobConnector;1218						}1219						break;1220					case 's':1221						if (Connectors.ContainsKey(element2.Key + "-SUCCESS"))1222						{1223							jobConnector = Connectors[element2.Key + "-SUCCESS"] as JobConnector;1224						}1225						break;1226					case 'e':1227						if (Connectors.ContainsKey(element2.Key + "-ERROR"))1228						{1229							jobConnector = Connectors[element2.Key + "-ERROR"] as JobConnector;1230						}1231						break;1232					}1233					if (jobConnector != null)1234					{1235						jobConnector.Disarrange = disarrange;1236					}1237				}1238			}1239		}1240		return true;1241	}12421243	private void _LoadChainTree(ISingleDbObject dbJobChain)1244	{1245		Clear();1246		try1247		{1248			if (dbJobChain == null || !dbJobChain.IsLoaded)1249			{1250				return;1251			}1252			JobChainElement jobChainElement = new JobChainElement(new JobChainData(dbJobChain), this);1253			jobChainElement.Name = dbJobChain.Display;1254			jobChainElement.Key = dbJobChain["UID_JobChain"].New.String;1255			Elements.Add(jobChainElement);1256			lock (this)1257			{1258				m_eJobChain = jobChainElement;1259			}1260			_LoadJob(dbJobChain.GetValue("UID_Job").String, recursiv: true);1261			System.Collections.Generic.IEnumerator<Element> enumerator = Elements.GetEnumerator();1262			try1263			{1264				while (((System.Collections.IEnumerator)enumerator).MoveNext())1265				{1266					Element current = enumerator.Current;1267					if (current is JobChainElement)1268					{1269						_LoadChainConnectors(current as JobChainElement);1270					}1271					if (current is JobElement)1272					{1273						_LoadJobConnectors(current as JobElement);1274					}1275				}1276			}1277			finally1278			{1279				((System.IDisposable)enumerator)?.Dispose();1280			}1281		}1282		catch (System.Exception innerException)1283		{1284			throw new ViException(1211012, innerException);1285		}1286	}12871288	private void _LoadChainList(ISingleDbObject dbJobChain)1289	{1290		try1291		{1292			if (dbJobChain == null || !dbJobChain.IsLoaded)1293			{1294				return;1295			}1296			JobChainElement jobChainElement = new JobChainElement(new JobChainData(dbJobChain), this);1297			jobChainElement.Key = dbJobChain["UID_JobChain"].New.String;1298			Elements.Add(jobChainElement);1299			lock (this)1300			{1301				m_eJobChain = jobChainElement;1302			}1303			System.Collections.Generic.IEnumerator<IColElem> enumerator = ((System.Collections.Generic.IEnumerable<IColElem>)dbJobChain.GetCR("Job", "UID_JobChain").Children).GetEnumerator();1304			try1305			{1306				while (((System.Collections.IEnumerator)enumerator).MoveNext())1307				{1308					IColElem current = enumerator.Current;1309					_LoadJob(current.GetValue("UID_Job").String, recursiv: false);1310				}1311			}1312			finally1313			{1314				((System.IDisposable)enumerator)?.Dispose();1315			}1316			System.Collections.Generic.IEnumerator<Element> enumerator2 = Elements.GetEnumerator();1317			try1318			{1319				while (((System.Collections.IEnumerator)enumerator2).MoveNext())1320				{1321					Element current2 = enumerator2.Current;1322					if (current2 is JobChainElement)1323					{1324						_LoadChainConnectors(current2 as JobChainElement);1325					}1326					if (current2 is JobElement)1327					{1328						_LoadJobConnectors(current2 as JobElement);1329					}1330				}1331			}1332			finally1333			{1334				((System.IDisposable)enumerator2)?.Dispose();1335			}1336		}1337		catch (System.Exception innerException)1338		{1339			throw new ViException(1211012, innerException);1340		}1341	}13421343	private void _LoadJob(string strUID_Job, bool recursiv)1344	{1345		if (strUID_Job.Length != 0 && !Elements.ContainsKey(strUID_Job))1346		{1347			ISingleDbObject singleDbObject = m_eJobChain.JobChainData.DBJobChain.Connection.CreateSingle("Job");1348			singleDbObject.ProcessContext = m_eJobChain.JobChainData.DBJobChain.ProcessContext;1349			singleDbObject["UID_Job"].NewValue = strUID_Job;1350			singleDbObject.Load();1351			JobElement jobElement = new JobElement(new JobData(singleDbObject), this);1352			jobElement.Key = singleDbObject.GetValue("UID_Job");1353			Elements.Add(jobElement);1354			if (recursiv)1355			{1356				_LoadJob(singleDbObject.GetValue("UID_SuccessJob").String, recursiv);1357				_LoadJob(singleDbObject.GetValue("UID_ErrorJob").String, recursiv);1358			}1359		}1360	}13611362	private void _LoadChainConnectors(JobChainElement eJobChain)1363	{1364		string text = eJobChain.JobChainData.DBJobChain["UID_Job"].New.String;1365		if (text.Length > 0)1366		{1367			if (!(Elements[text] is JobElement end))1368			{1369				throw new ViException(1211013, ExceptionRelevance.EndUser, eJobChain.Name);1370			}1371			JobConnector element = new JobConnector(this, eJobChain.Key + "-ROOTJOB", eJobChain, end, JobConnector.ConnectorType.RootJob);1372			Connectors.Add(element);1373		}1374	}13751376	private void _LoadJobConnectors(JobElement eJob)1377	{1378		if (eJob != null)1379		{1380			string text = eJob.JobData.DBJob["UID_SuccessJob"].New.String;1381			if (text.Length > 0 && !Connectors.ContainsKey(eJob.Key + "-SUCCESS"))1382			{1383				JobElement end = Elements[text] as JobElement;1384				JobConnector jobConnector = new JobConnector(eJob.ParentControl, eJob.Key + "-SUCCESS", eJob, end, JobConnector.ConnectorType.SuccessJob);1385				jobConnector.Disarrange = 900;1386				Connectors.Add(jobConnector);1387			}1388			string text2 = eJob.JobData.DBJob["UID_ErrorJob"].New.String;1389			if (text2.Length > 0 && !Connectors.ContainsKey(eJob.Key + "-ERROR"))1390			{1391				JobElement end2 = Elements[text2] as JobElement;1392				JobConnector jobConnector2 = new JobConnector(eJob.ParentControl, eJob.Key + "-ERROR", eJob, end2, JobConnector.ConnectorType.ErrorJob);1393				jobConnector2.Disarrange = 11;1394				Connectors.Add(jobConnector2);1395			}1396		}1397	}13981399	private void _SaveConnectors(JobChainElement eJobChain)1400	{1401		if (Connectors.ContainsKey(eJobChain.Key + "-ROOTJOB"))1402		{1403			JobElement jobElement = Connectors[eJobChain.Key + "-ROOTJOB"].ElementEnd as JobElement;1404			if (eJobChain.JobChainData.DBJobChain["UID_Job"].New.String != jobElement.Key)1405			{1406				eJobChain.JobChainData.DBJobChain["UID_Job"].NewValue = jobElement.Key;1407			}1408		}1409		else1410		{1411			eJobChain.JobChainData.DBJobChain["UID_Job"].ClearValue();1412		}1413		System.Collections.Generic.IEnumerator<Element> enumerator = Elements.GetEnumerator();1414		try1415		{1416			while (((System.Collections.IEnumerator)enumerator).MoveNext())1417			{1418				if (!(enumerator.Current is JobElement jobElement2))1419				{1420					continue;1421				}1422				if (Connectors.ContainsKey(jobElement2.Key + "-SUCCESS"))1423				{1424					JobElement jobElement3 = Connectors[jobElement2.Key + "-SUCCESS"].ElementEnd as JobElement;1425					if (jobElement2.JobData.DBJob["UID_SuccessJob"].New.String != jobElement3.Key)1426					{1427						jobElement2.JobData.DBJob["UID_SuccessJob"].NewValue = jobElement3.Key;1428					}1429				}1430				else1431				{1432					jobElement2.JobData.DBJob["UID_SuccessJob"].ClearValue();1433				}1434				if (Connectors.ContainsKey(jobElement2.Key + "-ERROR"))1435				{1436					JobElement jobElement4 = Connectors[jobElement2.Key + "-ERROR"].ElementEnd as JobElement;1437					if (jobElement2.JobData.DBJob["UID_ErrorJob"].New.String != jobElement4.Key)1438					{1439						jobElement2.JobData.DBJob["UID_ErrorJob"].NewValue = jobElement4.Key;1440					}1441				}1442				else1443				{1444					jobElement2.JobData.DBJob["UID_ErrorJob"].ClearValue();1445				}1446			}1447		}1448		finally1449		{1450			((System.IDisposable)enumerator)?.Dispose();1451		}1452	}14531454	private void _CheckAndUpdateElements(JobChainElement eJobChain)1455	{1456		if (!eJobChain.JobChainData.DBJobChain["Name"].CanEdit)1457		{1458			return;1459		}1460		System.Collections.Generic.IEnumerator<Element> enumerator = Elements.GetEnumerator();1461		try1462		{1463			while (((System.Collections.IEnumerator)enumerator).MoveNext())1464			{1465				if (enumerator.Current is JobElement jobElement && jobElement.JobData.DBJob["UID_JobChain"].New.String != eJobChain.Key)1466				{1467					jobElement.JobData.DBJob["UID_JobChain"].NewValue = eJobChain.Key;1468				}1469			}1470		}1471		finally1472		{1473			((System.IDisposable)enumerator)?.Dispose();1474		}1475	}14761477	private void _SaveJobChainElementsToDB(JobChainElement eJobChain)1478	{1479		string text = string.Empty;1480		ResetProcessFlag();1481		if (eJobChain.JobChainData.DBJobChain["LayoutPositions"].CanEdit)1482		{1483			string text2 = _GetPositionString();1484			if (!string.Equals(eJobChain.JobChainData.DBJobChain.GetValue("LayoutPositions").String, text2))1485			{1486				eJobChain.JobChainData.DBJobChain["LayoutPositions"].NewValue = text2;1487			}1488		}1489		if (eJobChain.JobChainData.DBJobChain["UID_JOb"].IsChanged)1490		{1491			text = eJobChain.JobChainData.DBJobChain["UID_JOb"].New.String;1492			eJobChain.JobChainData.DBJobChain["UID_JOb"].NewValue = "";1493		}1494		eJobChain.JobChainData.Save();1495		_SaveJobElementToDB((JobElement)Elements[eJobChain.JobChainData.DBJobChain["UID_Job"].New.String]);1496		System.Collections.Generic.IEnumerator<Element> enumerator = Elements.GetEnumerator();1497		try1498		{1499			while (((System.Collections.IEnumerator)enumerator).MoveNext())1500			{1501				Element current = enumerator.Current;1502				if (!current.Processed && current is JobElement eJob)1503				{1504					_SaveJobElementToDB(eJob);1505				}1506			}1507		}1508		finally1509		{1510			((System.IDisposable)enumerator)?.Dispose();1511		}1512		if (!string.IsNullOrEmpty(text) && eJobChain.JobChainData.DBJobChain["UID_Job"].New.String != text)1513		{1514			eJobChain.JobChainData.DBJobChain["UID_Job"].NewValue = text;1515			eJobChain.JobChainData.Save();1516		}1517	}15181519	private void _SaveJobElementToDB(JobElement eJob)1520	{1521		if (eJob != null)1522		{1523			string key = eJob.JobData.DBJob["UID_SuccessJob"].New.String;1524			if (Elements.ContainsKey(key))1525			{1526				_SaveJobElementToDB((JobElement)Elements[key]);1527			}1528			string key2 = eJob.JobData.DBJob["UID_ErrorJob"].New.String;1529			if (Elements.ContainsKey(key2))1530			{1531				_SaveJobElementToDB((JobElement)Elements[key2]);1532			}1533			if (eJob.JobData.IsChanged)1534			{1535				eJob.JobData.Save();1536			}1537			eJob.Processed = true;1538		}1539	}15401541	private void _SaveJobDeletedToDB()1542	{1543		IColDbObject colDbObject = _connection.CreateCol("Job");1544		ISqlFormatter sqlFormatter = _connection.SqlFormatter;1545		colDbObject.Prototype.WhereClause = sqlFormatter.Comparison("UID_JobChain", m_eJobChain.JobChainData.DBJobChain.GetValue("UID_JobChain").String, ValType.String, CompareOperator.Equal, FormatterOptions.None);1546		colDbObject.Load();1547		System.Collections.Generic.IEnumerator<IColElem> enumerator = ((System.Collections.Generic.IEnumerable<IColElem>)colDbObject).GetEnumerator();1548		try1549		{1550			while (((System.Collections.IEnumerator)enumerator).MoveNext())1551			{1552				IColElem current = enumerator.Current;1553				if (!Elements.ContainsKey(current.GetValue("UID_Job").String))1554				{1555					ISingleDbObject singleDbObject = current.Create();1556					singleDbObject.Delete();1557					singleDbObject.Save();1558				}1559			}1560		}1561		finally1562		{1563			((System.IDisposable)enumerator)?.Dispose();1564		}1565	}15661567	public override void Clear()1568	{1569		m_eJobChain = null;1570		base.Clear();1571	}15721573	protected override void _SelectElement(AccessibleNavigation direction)1574	{1575		//IL_0000: Unknown result type (might be due to invalid IL or missing references)1576		//IL_0002: Unknown result type (might be due to invalid IL or missing references)1577		//IL_0024: Expected I4, but got Unknown1578		//IL_006d: Unknown result type (might be due to invalid IL or missing references)1579		switch (direction - 1)1580		{1581		case 6:1582			FocusElement(m_eJobChain, deselect: true);1583			break;1584		case 3:1585			_SelectElement_Sub(base.Selected, (TabAlignment)3);1586			break;1587		case 2:1588			_SelectElement_Sub(base.Selected, (TabAlignment)2);1589			break;1590		case 0:1591			_SelectElement_Sub(base.Selected, (TabAlignment)0);1592			break;1593		case 1:1594			_SelectElement_Sub(base.Selected, (TabAlignment)1);1595			break;1596		default:1597			base._SelectElement(direction);1598			break;1599		}1600	}16011602	protected override void OnElementRemoving(ElementEditEventArgs e)1603	{1604		base.OnElementRemoving(e);1605		if (e.Element is JobChainElement)1606		{1607			e.Cancel = true;1608		}1609	}16101611	protected override void OnConnectorRemoved(ConnectorEditEventArgs e)1612	{1613		try1614		{1615			JobConnector jobConnector = e.Connector as JobConnector;1616			switch (jobConnector.Type)1617			{1618			case JobConnector.ConnectorType.SuccessJob:1619			{1620				JobElement obj3 = jobConnector.ElementStart as JobElement;1621				obj3.JobData.DBJob["UID_SuccessJob"].ClearValue();1622				obj3.JobData.Save();1623				break;1624			}1625			case JobConnector.ConnectorType.ErrorJob:1626			{1627				JobElement obj2 = jobConnector.ElementStart as JobElement;1628				obj2.JobData.DBJob["UID_ErrorJob"].ClearValue();1629				obj2.JobData.Save();1630				break;1631			}1632			case JobConnector.ConnectorType.RootJob:1633			{1634				JobChainElement obj = jobConnector.ElementStart as JobChainElement;1635				obj.JobChainData.DBJobChain["UID_Job"].ClearValue();1636				obj.JobChainData.Save();1637				break;1638			}1639			}1640			base.OnConnectorRemoved(e);1641		}1642		catch (System.Exception exception)1643		{1644			ExceptionMgr.Instance.HandleException(exception, this);1645		}1646	}16471648	protected override void OnElementRemoved(ElementEditEventArgs e)1649	{1650		base.OnElementRemoved(e);1651		if (e.Element is JobElement)1652		{1653			try1654			{1655				((JobElement)e.Element).JobData.Delete();1656			}1657			catch (System.Exception exception)1658			{1659				ExceptionMgr.Instance.HandleException(exception, this);1660				e.Cancel = true;1661			}1662		}1663	}16641665	protected override void CreateElement(string type, XmlNode xmlData, out Element element)1666	{1667		if (type == ((object)typeof(JobElement)).ToString())1668		{1669			element = new JobElement(new JobData(_connection), this);1670		}1671		else if (type == "VI.Controls.JobChainElement")1672		{1673			element = null;1674		}1675		else1676		{1677			base.CreateElement(type, xmlData, out element);1678		}1679	}16801681	protected override void CreateConnector(StringDictionary KeyMapping, string type, XmlNode xmlConnector, ref Connector connector)1682	{1683		if (type == ((object)typeof(JobConnector)).ToString())1684		{1685			connector = new JobConnector(this);1686		}1687	}16881689	private void _ClearSimulation()1690	{1691		System.Collections.Generic.IEnumerator<Element> enumerator = Elements.GetEnumerator();1692		try1693		{1694			while (((System.Collections.IEnumerator)enumerator).MoveNext())1695			{1696				Element current = enumerator.Current;1697				if (current is JobElement jobElement)1698				{1699					jobElement.JobData.SimJob = null;1700				}1701				if (current is JobChainElement jobChainElement)1702				{1703					jobChainElement.JobChainData.SimJobChain = null;1704				}1705			}1706		}1707		finally1708		{1709			((System.IDisposable)enumerator)?.Dispose();1710		}1711	}17121713	private void _AssignSimulationData(JobChain jobChain)1714	{1715		m_eJobChain.JobChainData.SimJobChain = jobChain;1716		Job simJob = jobChain?.Root;1717		_AssignJobSimData(simJob);1718	}17191720	private void _AssignJobSimData(Job simJob)1721	{1722		if (simJob != null)1723		{1724			if (!Elements.ContainsKey(simJob.TemplateID))1725			{1726				throw new System.Exception("Simulatiodata contains unknown job: " + simJob.Name);1727			}1728			if (Elements[simJob.TemplateID] is JobElement jobElement)1729			{1730				jobElement.JobData.SimJob = simJob;1731			}1732			_AssignJobSimData(simJob.Successor);1733			_AssignJobSimData(simJob.ErrorSuccessor);1734		}1735	}17361737	private void SetConnection(IConnection connection)1738	{1739		if (_connection != null && m_JobChainEditorObserverRegistration != null)1740		{1741			m_JobChainEditorObserverRegistration.Dispose();1742			m_JobChainEditorObserverRegistration = null;1743		}1744		_connection = connection;1745		if (_connection != null)1746		{1747			JobChainEditorObserver jobChainEditorObserver = new JobChainEditorObserver();1748			jobChainEditorObserver.OnTableChanged += OnTableChanged;1749			if (DataManager.Database != null)1750			{1751				m_JobChainEditorObserverRegistration = DataManager.Database.StateLog.Subscribe(jobChainEditorObserver);1752			}1753		}1754		else1755		{1756			Clear();1757		}1758	}17591760	private void OnTableChanged(object sender, EntryEventArgs<string> e)1761	{1762		//IL_0095: Unknown result type (might be due to invalid IL or missing references)1763		//IL_009f: Expected O, but got Unknown1764		if (e.Entry == null)1765		{1766			return;1767		}1768		lock (this)1769		{1770			if (JobChainElement == null)1771			{1772				return;1773			}1774			_ = JobChainElement.Key;1775		}1776		lock (this)1777		{1778			bool flag = false;1779			string text = e.Entry.ToUpperInvariant();1780			if (text == "JOBCHAIN" || text == "JOB" || text == "JOBEVENTGEN" || text == "JOBRUNPARAMETER")1781			{1782				flag = true;1783			}1784			if (flag)1785			{1786				((Control)this).BeginInvoke((System.Delegate)new MethodInvoker(CheckJobChainConsistency));1787			}1788		}1789	}17901791	private void CheckJobChainConsistency()1792	{1793		//IL_006a: Unknown result type (might be due to invalid IL or missing references)1794		//IL_007a: Expected O, but got Unknown1795		//IL_0029: Unknown result type (might be due to invalid IL or missing references)1796		//IL_002e: Unknown result type (might be due to invalid IL or missing references)1797		if (m_Validity != null)1798		{1799			TimeSpan val = new TimeSpan(System.DateTime.Now.Ticks - m_Validity.ValidityTime.Ticks);1800			if (!(((TimeSpan)(ref val)).TotalSeconds > 1.0))1801			{1802				return;1803			}1804		}1805		((WaitHandle)m_ValidityLock).WaitOne();1806		m_Validity = new ValidityResult1807		{1808			ValidityTime = System.DateTime.MaxValue1809		};1810		ThreadPool.QueueUserWorkItem(new WaitCallback(ThreadProc_CheckJobChainConsistency), (object)m_Validity);1811	}18121813	private void ThreadProc_CheckJobChainConsistency(object oData)1814	{1815		try1816		{1817			((EventWaitHandle)m_ValidityLock).Reset();1818			ValidityResult validityResult = new ValidityCheck().Run(JobChainElement.JobChainData.DBJobChain);1819			if (!((Control)this).IsDisposed && ((Control)this).Parent != null && ((Control)this).IsHandleCreated)1820			{1821				((Control)this).BeginInvoke((System.Delegate)(object)new Action<ValidityResult>(SetValidity), new object[1] { validityResult });1822			}1823		}1824		catch1825		{1826		}1827		finally1828		{1829			((EventWaitHandle)m_ValidityLock).Set();1830		}1831	}18321833	protected virtual void OnValidityChanged()1834	{1835		//IL_004d: Unknown result type (might be due to invalid IL or missing references)1836		//IL_0052: Unknown result type (might be due to invalid IL or missing references)1837		System.Collections.Generic.IEnumerator<Element> enumerator = Elements.GetEnumerator();1838		try1839		{1840			while (((System.Collections.IEnumerator)enumerator).MoveNext())1841			{1842				((List<ValidityItem>)(object)((JobBaseElement)enumerator.Current).Validity).Clear();1843			}1844		}1845		finally1846		{1847			((System.IDisposable)enumerator)?.Dispose();1848		}1849		if (Validity != null)1850		{1851			Enumerator<ValidityItem> enumerator2 = ((List<ValidityItem>)(object)Validity.Items).GetEnumerator();1852			try1853			{1854				while (enumerator2.MoveNext())1855				{1856					ValidityItem current = enumerator2.Current;1857					DbObjectKey dboKey = current.DbObjectKey;1858					if (!(dboKey != null))1859					{1860						continue;1861					}1862					System.Collections.Generic.IEnumerator<JobBaseElement> enumerator3 = Enumerable.Where<JobBaseElement>(Enumerable.Cast<JobBaseElement>((System.Collections.IEnumerable)Elements), (Func<JobBaseElement, bool>)((JobBaseElement e) => e.Key == dboKey.Keys[0])).GetEnumerator();1863					try1864					{1865						while (((System.Collections.IEnumerator)enumerator3).MoveNext())1866						{1867							((List<ValidityItem>)(object)enumerator3.Current.Validity).Add(current);1868						}1869					}1870					finally1871					{1872						((System.IDisposable)enumerator3)?.Dispose();1873					}1874				}1875			}1876			finally1877			{1878				((System.IDisposable)enumerator2/*cast due to .constrained prefix*/).Dispose();1879			}1880		}1881		((Control)this).Invalidate();1882		if (this.ValidityChanged != null)1883		{1884			this.ValidityChanged.Invoke((object)this, EventArgs.Empty);1885		}1886	}18871888	private void _InitializePopupMenu()1889	{1890		//IL_003f: Unknown result type (might be due to invalid IL or missing references)1891		//IL_0044: Unknown result type (might be due to invalid IL or missing references)1892		//IL_0049: Unknown result type (might be due to invalid IL or missing references)1893		//IL_004b: Unknown result type (might be due to invalid IL or missing references)1894		bool flag = Connection.Database.ModuleOwner == ModuleOwner;1895		bool flag2 = _connection != null && m_eJobChain.JobChainData.DBJobChain.IsLoaded;1896		Point vPos = FullRealToVirtual(base.MouseClickPos);1897		Element element = HitTestElement(vPos);1898		((ToolStripItem)menu_NewJob).Enabled = flag && flag2;1899		((ToolStripItem)menu_DeleteJob).Enabled = flag && element is JobElement;1900		((ToolStripItem)menu_CopyJob).Enabled = element is JobElement;1901		((ToolStripItem)menu_PasteJob).Enabled = element == null && _IsClipBoard();1902		((ToolStripItem)menu_Properties).Enabled = element != null;1903		((ToolStripItem)menu_ArrangeJobs).Enabled = flag && JobChainElement != null;1904	}19051906	private void menu_NewJob_Click(object sender, EventArgs e)1907	{1908		try1909		{1910			InsertNewJob();1911		}1912		catch (System.Exception exception)1913		{1914			ExceptionMgr.Instance.HandleException(exception, this);1915		}1916	}19171918	private void popupMenu_Popup(object sender, EventArgs e)1919	{1920		try1921		{1922			_InitializePopupMenu();1923		}1924		catch (System.Exception exception)1925		{1926			ExceptionMgr.Instance.HandleException(exception, this);1927		}1928	}19291930	private void menu_CopyJob_Click(object sender, EventArgs e)1931	{1932		try1933		{1934			CopyToClipBoard();1935		}1936		catch (System.Exception exception)1937		{1938			ExceptionMgr.Instance.HandleException(exception, this);1939		}1940	}19411942	private void menu_PasteJob_Click(object sender, EventArgs e)1943	{1944		try1945		{1946			CopyFromClipBoard();1947		}1948		catch (System.Exception exception)1949		{1950			ExceptionMgr.Instance.HandleException(exception, this);1951		}1952	}19531954	private void menu_ArrangeJobs_Click(object sender, EventArgs e)1955	{1956		try1957		{1958			ArrangeElements(bNew: true);1959		}1960		catch (System.Exception exception)1961		{1962			ExceptionMgr.Instance.HandleException(exception, this);1963		}1964	}19651966	private void menu_DeleteJob_Click(object sender, EventArgs e)1967	{1968		try1969		{1970			_RemoveSelectedElements();1971		}1972		catch (System.Exception exception)1973		{1974			ExceptionMgr.Instance.HandleException(exception, this);1975		}1976	}19771978	private void menu_Properties_Click(object sender, EventArgs e)1979	{1980		try1981		{1982			_ShowJobProperties();1983		}1984		catch (System.Exception exception)1985		{1986			ExceptionMgr.Instance.HandleException(exception, this);1987		}1988	}1989}1990