コード例 #1
0
ファイル: CommandBlock.cs プロジェクト: NALSS/epiinfo-82474
        /// <summary>
        /// Builds the command tree dynamically
        /// </summary>
        private void BuildCommandTree()
        {
            TreeValueNode node = new TreeValueNode();
            SuspendLayout();
            node.Name = "commandNode";
            node.Text = "Analysis Commands";
            resources.ApplyResources(node, "commandNode");

            int commandGroupId = 0;
            TreeValueNode commandGroupNode = new TreeValueNode();
            commandGroupNode.Name = "commandGroupNode";
            commandResources.ApplyResources(commandGroupNode, "commandGroupNode");

            node.Value = 0;
            node.ImageIndex = 72;
            node.SelectedImageIndex = 72;
            tvCommands.Nodes.Add(node);

            DataTable commandGroups = AppData.Instance.CommandGroupsDataTable;//appDataManager.GetCommandGroups() ;
            DataTable commands = AppData.Instance.CommandsDataTable;//appDataManager.GetCommands();

            foreach (DataRow commandGroup in commandGroups.Rows)
            {
                commandGroupId = System.Convert.ToInt16((commandGroup[ColumnNames.ID]));
                commandGroupNode = AddCommandGroupsToTreeView(commandGroup[ColumnNames.NAME].ToString(), commandGroupId);
                DataRow[] commandDataRows = commands.Select("CommandGroups_Id = " + commandGroupId.ToString(), "CommandGroups_id");
                foreach (DataRow command in commandDataRows)
                {
                    AddCommandsToTreeView(command[ColumnNames.NAME].ToString(), System.Convert.ToInt16(command[ColumnNames.ID]), commandGroupNode);
                }
            }
            ResumeLayout();
            tvCommands.ExpandAll();
        }
コード例 #2
0
ファイル: CommandBlock.cs プロジェクト: NALSS/epiinfo-82474
        /// <summary>
        /// Adds command groups to the treeview
        /// </summary>
        /// <param name="commandGroupName">Name of the command group</param>
        /// <param name="commandGroupId">Id of the command group</param>
        /// <returns>TreeValueNode</returns>
        private TreeValueNode AddCommandGroupsToTreeView(string commandGroupName, int commandGroupId)
        {
            TreeValueNode node = new TreeValueNode();

            commandResources.ApplyResources(node, commandGroupName);

            node.Value = commandGroupId;
               // if (((commandGroupId == (int)CommandGroups.AdvancedStatistics)) || ((commandGroupId == (int)CommandGroups.UserDefined)))
               // {
               //     node.ImageIndex = 73;
               //     node.SelectedImageIndex = 73;
               // }
               // else
               // {
                node.ImageIndex = 72;
                node.SelectedImageIndex = 72;
               // }
            tvCommands.Nodes[0].Nodes.Add(node);
            return node;
        }
コード例 #3
0
ファイル: CommandBlock.cs プロジェクト: NALSS/epiinfo-82474
        /// <summary>
        /// Adds commands to the treeview
        /// </summary>
        /// <param name="commandName">Name of the command</param>
        /// <param name="commandId">Id of the command</param>
        /// <param name="commandGroupNode">TreeNode of the group the comamnd belongs to</param>
        /// <returns>TreeValueNode</returns>
        private TreeValueNode AddCommandsToTreeView(string commandName, int commandId, System.Windows.Forms.TreeNode commandGroupNode)
        {
            TreeValueNode node = new TreeValueNode();

            resources.ApplyResources(node, commandName);

            node.Name = commandName;
            node.Value = commandId;

            ////*********************************************************
            ////******* Only put in for the partner demo... remove after!
            ////*********************************************************
            //if (commandName.Equals("Read (Import)") || commandName.Equals("List") || commandName.Equals("Frequencies") || commandName.Equals("Display") || commandName.Equals("Define") || commandName.Equals("Undefine"))
            //{
            node.ImageIndex = 71;
            node.SelectedImageIndex = 71;
            //}
            //else
            //{
            //node.ImageIndex = 42;
            //node.SelectedImageIndex = 42;
            //}
            commandGroupNode.Nodes.Add(node);
            return node;
        }
コード例 #4
0
        /// <summary>
        /// Adds linked mode fields to the explorer
        /// </summary>
        private void AddPhinVocabulary()
        {
            try
            {
                PHINVSProvider dataManager = PHINVSProvider.Instance;
                LinkedRootNode linkedNode = new LinkedRootNode();
                linkedNode.Text = SharedStrings.VOCABULARY_FIELDS; //"Vocabulary Fields";
                linkedNode.ImageIndex = 3;
                linkedNode.SelectedImageIndex = 3;
                linkedNode.Tag = "Vocabulary Fields";
                projectTree.Nodes.Add(linkedNode);

                DataTable domains = dataManager.GetDomains();
                foreach (DataRow row in domains.Rows)
                {
                    TreeValueNode domainNode = new TreeValueNode();
                    domainNode.Text = row["Name"].ToString();
                    domainNode.Value = row["Code"].ToString();
                    domainNode.ImageIndex = 4;
                    domainNode.SelectedImageIndex = 4;
                    linkedNode.Nodes.Add(domainNode);
                    DataTable valueSets = dataManager.GetValueSets(row["Code"].ToString());
                    foreach (DataRow valueSetRow in valueSets.Rows)
                    {
                        LinkedFieldNode valueSetNode = new LinkedFieldNode();
                        valueSetNode.Text = valueSetRow["Name"].ToString();
                        valueSetNode.Value = valueSetRow["Code"].ToString();
                        valueSetNode.ImageIndex = 5;
                        valueSetNode.SelectedImageIndex = 5;
                        domainNode.Nodes.Add(valueSetNode);
                    }
                }
            }
            //catch (Exception)
            //{
            //    // Ignore it for now. If PHIN VS database is not available, Linked mode will be ignored.
            //}
            finally { }
        }