private static void AddNodeFromDataRow(TreeNode parentNode, DataRow parentRow, ServerEnv env) { try { string dataRelationName = Database.FindForeignKeyRelationName(parentRow.Table); if (String.IsNullOrEmpty(dataRelationName)) { return; } // �f�[�^�x�[�X����q�m�[�h����o�� DataRow[] rows = parentRow.GetChildRows(dataRelationName); if (rows == null || rows.Length == 0) { return; } // "sortOrder"�ɏ��Ԃ������Ă���̂ŁA�z���\�[�g���� Array.Sort(rows, new DataRowComparer()); foreach (DataRow childRow in rows) { if ((Int32)childRow[Database.NODE_COLUMN_NODE_ID] == 0) { // ���[�g�m�[�h�́A�e�������ɂȂ��Ă��܂��̂ŁA�p�X�B continue; } TreeNode node = GetTreeNodeFromDataRow(childRow, env); if (node == null) { continue; } parentNode.Nodes.Add(node); // �ċA�Ăяo���B AddNodeFromDataRow(node, childRow, env); } } catch (Exception) { throw; } }
private void LoadTree(TreeView tv, ServerEnv env) { if (this.InvokeRequired) { this.Invoke(new LoadTreeDelegate(LoadTree), new object[] { tv, env }); return; } lock (_guiLock) { try { tv.BeginUpdate(); ShowWaitCursor(true); // �v���p�e�B��\������Ă���Ȃ�A���������B HideNodeProperty(); // root�m�[�h�̃G���g�����Ȃ��Ə����ł��Ȃ� if (env.DataSet.Tables[Database.NODE_TABLE].Rows.Count < 1) { return; } // �ŏ��Ɋ��ɍ\�z����Ă���c���[��폜����B // TreeView��S����������̂ł͂Ȃ��A���̃T�[�o�ɊY�����郋�[�g�m�[�h������폜���� TreeNode root = FindRootByServerEnvOrNull(tv, env); if (root != null) { root.Remove(); // ������f�[�^�x�[�X��͏����Ȃ� } // ���[�g�m�[�h�ɑΉ�����f�[�^�x�[�X�̃G���g����擾�B��Ƀe�[�u����0�s�ځB DataRow rootRow = env.DataSet.Tables[Database.NODE_TABLE].Rows[0]; // ���[�g�m�[�h�ɑΉ�����c���[�m�[�h��V���ɍ쐬 root = GetTreeNodeFromDataRow(rootRow, env); if (root == null) { return; } // ���[�g�m�[�h�̃e�L�X�g��T�[�o�̃A�h���X�ɕύX����B�f�[�^�x�[�X��͕ς��Ȃ��B root.Text = env.Address; // ���[�g�m�[�h��c���[�r���[�ɒlj� tv.Nodes.Add(root); if (env.DataSet.Tables[Database.NODE_TABLE].Rows.Count > 1) { // ���[�g�m�[�h�ȊO�Ƀm�[�h�����݂���Ȃ�A�q�m�[�h�B��lj��B // ��������ċN�����B AddNodeFromDataRow(root, rootRow, env); } root.Expand(); } finally { tv.EndUpdate(); ShowWaitCursor(false); } } }
public void LoadTree(ServerEnv env) { LoadTree(_treeView_Node, env); }
/// <summary> /// �c���[�r���[�̊e�m�[�h�̓^�O��ServerEnv�I�u�W�F�N�g����L���Ă��܂��B /// �c���[�r���[�̃��[�g�m�[�h�Q����A�w�肵��ServerEnv��^�O�Ɏ���̂�Ԃ��܂��B /// </summary> /// <param name="tv">�ΏۂƂȂ�c���[�r���[</param> /// <param name="env">ServerEnv�I�u�W�F�N�g�ł���Ɠ�������^�O�Ɏ��m�[�h��Ԃ��܂��B</param> /// <returns></returns> private static TreeNode FindRootByServerEnvOrNull(TreeView tv, ServerEnv env) { foreach (TreeNode node in tv.Nodes) { NodeData data = (NodeData)node.Tag; if (data.ServerEnv == null) { continue; } if (data.ServerEnv == env) { return node; } } return null; }
private static TreeNode GetTreeNodeFromDataRow(DataRow row, ServerEnv env) { // �O���[�v�̏ꍇ�̂ݍ쐬���Ă݂�B if ((bool)row[Database.NODE_COLUMN_ISGROUP] == false) { return null; } TreeNode node = new TreeNode(); node.Tag = new NodeData(row, env, node); node.Text = ((String)row[Database.NODE_COLUMN_HOSTNAME]).Trim(); if (row.Table.Columns.Contains(Database.NODE_COLUMN_IMAGEINDEX)) { node.ImageIndex = (Int32)row[Database.NODE_COLUMN_IMAGEINDEX]; } if (row.Table.Columns.Contains(Database.NODE_COLUMN_SELECTED_IMAGEINDEX)) { node.SelectedImageIndex = (Int32)row[Database.NODE_COLUMN_SELECTED_IMAGEINDEX]; } return node; }
public OfflineEventArgs(ServerEnv env) { _env = env; }
public NodeData(DataRow row, ServerEnv env, Object owner) { _env = env; _row = row; _owner = owner; }
public NotificationEventArgs(ServerEnv env, ArrayList list) : base() { _env = env; _notificationList = list; }
private void OnDatabaseReplaced(ServerEnv env, DataSet ds) { if (ds == null) { return; } // �ύX�����̂������Ȃ���Ȃ� if (_guid.Equals(Database.GetGUID(ds))) { return; } // ���̐l���u���������̂Ȃ�A�����̃f�[�^�Z�b�g��u��������B env.DataSet = ds; // �f�[�^�Z�b�g���ς���Ă��܂����̂ŁA�c���[�r���[��\�z�������B LoadTree(_treeView_Node, env); }
private void OnDatabaseMerged(ServerEnv env, DataSet diff) { if (diff == null) { return; } // �������ύX�����̂Ȃ�A������Ȃ��Ă����B if (_guid.Equals(Database.GetGUID(diff))) { return; } // �����������Ă���f�[�^�Z�b�g�Ƀ}�[�W����B env.DataSet.Merge(diff); env.DataSet.AcceptChanges(); // TODO: // ������悤�ɁA�\������ }
private void OfflineDetected(ServerEnv env) { if (this.InvokeRequired) { this.Invoke(new OfflineDetectedDelegate(OfflineDetected), new object[] { env }); return; } env.IRmainte = null; this.Text = "�I�t���C�����"; // TODO: // �c���[�r���[�����Ƃ��������B }
/// <summary> /// �����[�e�B���O�W����������܂��B /// </summary> private ServerEnv InitializeRemoting() { /* if (AppSettings.Instance.Server.Equals("localhost")) { try { // IPC�`���l����N������ RemotingServer.Instance.Register(true, false, false); } catch (RemotingException) { } } */ // �T�[�o����ۑ����邽�߂̃N���X�I�u�W�F�N�g�� ServerEnv env = new ServerEnv(); // ��������ServerEnv�I�u�W�F�N�g��List�ɕۑ����Ă����B _serverEnvList.Add(env); // IP�A�h���X��ڑ����@�ȂǁA�T�[�o�֘A�̃v���p�e�B��ۑ�����B env.Address = AppSettings.Instance.Server; // HTTP�`���l����TCP�`���l�����B if (AppSettings.Instance.ConnectType.ToUpper().Equals("HTTP")) { env.ConnectType = ServerEnv.ServerConnectType.HTTP; env.HttpPort = AppSettings.Instance.HttpPort; } else if (AppSettings.Instance.ConnectType.ToUpper().Equals("TCP")) { env.ConnectType = ServerEnv.ServerConnectType.TCP; env.TcpPort = AppSettings.Instance.TcpPort; } // URI env.ObjectUri = AppSettings.Instance.ObjectUri; // IRmainte����������I�u�W�F�N�g��擾���� env.GetIRmainteImplOrNull(); if (env.IRmainte == null) { // �ʐM�G���[�H // �T�[�o���N�����Ă��Ȃ��H OfflineDetected(env); } else { // �܂��T�[�o�̏�����ɍs���ĕۑ��B env.GetVersion(); // �f�[�^�x�[�X�̃f�[�^�Z�b�g��擾���ĕۑ��B env.GetDataSet(); } return env; }