Пример #1
0
        /// <summary>
        /// Select the first task in the group before the current group and focus the control
        /// </summary>
        public void SelectPreviousGroupWithFocus()
        {
            if (FCurrentTaskList != null)
            {
                bool foundThisGroup = false;

                for (int i = 0; i < FCurrentTaskList.Controls.Count; i++)
                {
                    TUcoTaskGroup group = (TUcoTaskGroup)FCurrentTaskList.Controls[i];

                    if (group.Name == FCurrentTaskList.CurrentGroupName)
                    {
                        foundThisGroup = true;
                    }
                    else if (foundThisGroup)
                    {
                        for (int k = 0; k < group.Controls[0].Controls.Count; k++)
                        {
                            TUcoSingleTask task = (TUcoSingleTask)group.Controls[0].Controls[k];

                            if (task.Enabled)
                            {
                                task.FocusTask();
                                return;
                            }
                        }
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Select the last task in the specified task list and set focus to the control
        /// </summary>
        private void SelectLastTaskWithFocus(TLstTasks ATaskList)
        {
            for (int i = 0; i < ATaskList.Controls.Count; i++)
            {
                TUcoTaskGroup group = (TUcoTaskGroup)ATaskList.Controls[i];

                for (int k = group.Controls[0].Controls.Count - 1; k >= 0; k--)
                {
                    TUcoSingleTask task = (TUcoSingleTask)group.Controls[0].Controls[k];

                    if (task.Enabled)
                    {
                        task.FocusTask();
                        return;
                    }
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Select the first task in the specified task list and set focus to the control
        /// </summary>
        private void SelectFirstTaskWithFocus(TLstTasks ATaskList)
        {
            if (ATaskList == null)
            {
                return;
            }

            for (int i = ATaskList.Controls.Count - 1; i >= 0; i--)
            {
                TUcoTaskGroup group = (TUcoTaskGroup)ATaskList.Controls[i];

                for (int k = 0; k < group.Controls[0].Controls.Count; k++)
                {
                    TUcoSingleTask task = (TUcoSingleTask)group.Controls[0].Controls[k];

                    if (task.Enabled)
                    {
                        task.FocusTask();
                        return;
                    }
                }
            }
        }
Пример #4
0
        /// <summary>
        /// Constructor. Generates several Groups of Tasks from an xml document.
        /// </summary>
        /// <param name="ATaskGroups"></param>
        /// <param name="ATaskAppearance" >Initial appearance of the Tasks.</param>
        public TLstTasks(XmlNode ATaskGroups, TaskAppearance ATaskAppearance)
        {
            this.SuspendLayout();

            this.Name       = "lstTasks" + ATaskGroups.Name;
            this.AutoScroll = true;
            //            this.HorizontalScroll.Enabled = true;
            this.Resize += new EventHandler(ListResize);

            XmlNode TaskGroupNode = ATaskGroups.FirstChild;

            while (TaskGroupNode != null)
            {
                if (TaskGroupNode.Name == "SearchBoxes")
                {
                    // TODO Search boxes
                }
                else
                {
                    TUcoTaskGroup TaskGroup = new TUcoTaskGroup();
                    TaskGroup.GroupTitle = TLstFolderNavigation.GetLabel(TaskGroupNode);
                    TaskGroup.Name       = TaskGroupNode.Name;
                    TIconCache.TIconSize IconSize = ATaskAppearance ==
                                                    TaskAppearance.staLargeTile ? TIconCache.TIconSize.is32by32 : TIconCache.TIconSize.is16by16;

                    Groups.Add(TaskGroup.Name, TaskGroup);

                    if (TaskGroupNode.FirstChild == null)
                    {
                        // duplicate group node into task; otherwise you would not notice the error in the yml file?
                        TUcoSingleTask SingleTask = new TUcoSingleTask();
                        SingleTask.TaskTitle       = TLstFolderNavigation.GetLabel(TaskGroupNode);
                        SingleTask.TaskDescription = TYml2Xml.HasAttribute(TaskGroupNode,
                                                                           "Description") ? Catalog.GetString(TYml2Xml.GetAttribute(TaskGroupNode, "Description")) : "";
                        SingleTask.Name           = TaskGroupNode.Name;
                        SingleTask.TaskGroup      = TaskGroup;
                        SingleTask.Tag            = TaskGroupNode;
                        SingleTask.TaskAppearance = ATaskAppearance;
                        SingleTask.TaskImagePath  = DetermineIconForTask(TaskGroupNode);
                        SingleTask.TaskImage      = TIconCache.IconCache.AddOrGetExistingIcon(
                            SingleTask.TaskImagePath, IconSize);
                        SingleTask.RequestForDifferentIconSize += new TRequestForDifferentIconSize(SingleTask_RequestForDifferentIconSize);

                        if (!FHasAccessPermission(TaskGroupNode, FUserId, false))
                        {
                            SingleTask.Enabled = false;
                        }

                        TaskGroup.Add(SingleTask.Name, SingleTask);
                    }
                    else
                    {
                        XmlNode TaskNode = TaskGroupNode.FirstChild;

                        while (TaskNode != null)
                        {
                            try
                            {
                                // this item should only be displayed if Tax Deductible Percentage is enable
                                if (TaskNode.Name == "RecipientTaxDeductiblePercentages")
                                {
                                    if (!FTaxDeductiblePercentageEnabled)
                                    {
                                        continue;
                                    }
                                }

                                TUcoSingleTask SingleTask = new TUcoSingleTask();
                                SingleTask.TaskTitle       = TLstFolderNavigation.GetLabel(TaskNode);
                                SingleTask.TaskDescription = TYml2Xml.HasAttribute(TaskNode,
                                                                                   "Description") ? Catalog.GetString(TYml2Xml.GetAttribute(TaskNode, "Description")) : "";
                                SingleTask.Name           = TaskNode.Name;
                                SingleTask.TaskGroup      = TaskGroup;
                                SingleTask.Tag            = TaskNode;
                                SingleTask.TaskAppearance = ATaskAppearance;
                                SingleTask.TaskImagePath  = DetermineIconForTask(TaskNode);
                                SingleTask.TaskImage      = TIconCache.IconCache.AddOrGetExistingIcon(
                                    SingleTask.TaskImagePath, IconSize);
                                SingleTask.RequestForDifferentIconSize += new TRequestForDifferentIconSize(SingleTask_RequestForDifferentIconSize);

                                if (TTaskList.IsDisabled(TaskNode) || !FHasAccessPermission(TaskNode, FUserId, false))
                                {
                                    SingleTask.Enabled = false;
                                }

                                TaskGroup.Add(SingleTask.Name, SingleTask);
                            }
                            finally
                            {
                                TaskNode = TaskNode.NextSibling;
                            }
                        }
                    }

                    // Add TaskGroup to this UserControls' Controls
                    TaskGroup.Dock         = DockStyle.Top;
                    TaskGroup.Margin       = new Padding(3);
                    TaskGroup.AutoSize     = true;
                    TaskGroup.AutoSizeMode = AutoSizeMode.GrowAndShrink;

                    TaskGroup.TaskClicked  += new EventHandler(SingleTask_ExecuteTask);
                    TaskGroup.TaskSelected += new EventHandler(SingleTask_TaskSelected);

                    this.Controls.Add(TaskGroup);

                    // Make sure Task Groups are shown in correct order and not in reverse order.
                    // (This is needed because we 'stack them up' with 'TaskGroup.Dock = DockStyle.Top')
                    TaskGroup.BringToFront();
                }

                TaskGroupNode = TaskGroupNode.NextSibling;
            }

            this.ResumeLayout();
        }
Пример #5
0
        /// <summary>
        /// Constructor. Generates several Groups of Tasks from an xml document.
        /// </summary>
        /// <param name="ATaskGroups"></param>
        /// <param name="ATaskAppearance" >Initial appearance of the Tasks.</param>
        public TLstTasks(XmlNode ATaskGroups, TaskAppearance ATaskAppearance)
        {
            this.SuspendLayout();

            this.Name = "lstTasks" + ATaskGroups.Name;
            this.AutoScroll = true;
            //            this.HorizontalScroll.Enabled = true;
            this.Resize += new EventHandler(ListResize);

            XmlNode TaskGroupNode = ATaskGroups.FirstChild;

            while (TaskGroupNode != null)
            {
                if (TaskGroupNode.Name == "SearchBoxes")
                {
                    // TODO Search boxes
                }
                else
                {
                    TUcoTaskGroup TaskGroup = new TUcoTaskGroup();
                    TaskGroup.GroupTitle = TLstFolderNavigation.GetLabel(TaskGroupNode);
                    TaskGroup.Name = TaskGroupNode.Name;
                    TIconCache.TIconSize IconSize = ATaskAppearance ==
                                                    TaskAppearance.staLargeTile ? TIconCache.TIconSize.is32by32 : TIconCache.TIconSize.is16by16;

                    Groups.Add(TaskGroup.Name, TaskGroup);

                    if (TaskGroupNode.FirstChild == null)
                    {
                        // duplicate group node into task; otherwise you would not notice the error in the yml file?
                        TUcoSingleTask SingleTask = new TUcoSingleTask();
                        SingleTask.TaskTitle = TLstFolderNavigation.GetLabel(TaskGroupNode);
                        SingleTask.TaskDescription = TYml2Xml.HasAttribute(TaskGroupNode,
                            "Description") ? Catalog.GetString(TYml2Xml.GetAttribute(TaskGroupNode, "Description")) : "";
                        SingleTask.Name = TaskGroupNode.Name;
                        SingleTask.TaskGroup = TaskGroup;
                        SingleTask.Tag = TaskGroupNode;
                        SingleTask.TaskAppearance = ATaskAppearance;
                        SingleTask.TaskImagePath = DetermineIconForTask(TaskGroupNode);
                        SingleTask.TaskImage = TIconCache.IconCache.AddOrGetExistingIcon(
                            SingleTask.TaskImagePath, IconSize);
                        SingleTask.RequestForDifferentIconSize += new TRequestForDifferentIconSize(SingleTask_RequestForDifferentIconSize);

                        if (!FHasAccessPermission(TaskGroupNode, FUserId, false))
                        {
                            SingleTask.Enabled = false;
                        }

                        TaskGroup.Add(SingleTask.Name, SingleTask);
                    }
                    else
                    {
                        XmlNode TaskNode = TaskGroupNode.FirstChild;

                        while (TaskNode != null)
                        {
                            try
                            {
                                // this item should only be displayed if Tax Deductible Percentage is enable
                                if (TaskNode.Name == "RecipientTaxDeductiblePercentages")
                                {
                                    if (!FTaxDeductiblePercentageEnabled)
                                    {
                                        continue;
                                    }
                                }

                                TUcoSingleTask SingleTask = new TUcoSingleTask();
                                SingleTask.TaskTitle = TLstFolderNavigation.GetLabel(TaskNode);
                                SingleTask.TaskDescription = TYml2Xml.HasAttribute(TaskNode,
                                    "Description") ? Catalog.GetString(TYml2Xml.GetAttribute(TaskNode, "Description")) : "";
                                SingleTask.Name = TaskNode.Name;
                                SingleTask.TaskGroup = TaskGroup;
                                SingleTask.Tag = TaskNode;
                                SingleTask.TaskAppearance = ATaskAppearance;
                                SingleTask.TaskImagePath = DetermineIconForTask(TaskNode);
                                SingleTask.TaskImage = TIconCache.IconCache.AddOrGetExistingIcon(
                                    SingleTask.TaskImagePath, IconSize);
                                SingleTask.RequestForDifferentIconSize += new TRequestForDifferentIconSize(SingleTask_RequestForDifferentIconSize);

                                if (TTaskList.IsDisabled(TaskNode) || !FHasAccessPermission(TaskNode, FUserId, false))
                                {
                                    SingleTask.Enabled = false;
                                }

                                TaskGroup.Add(SingleTask.Name, SingleTask);
                            }
                            finally
                            {
                                TaskNode = TaskNode.NextSibling;
                            }
                        }
                    }

                    // Add TaskGroup to this UserControls' Controls
                    TaskGroup.Dock = DockStyle.Top;
                    TaskGroup.Margin = new Padding(3);
                    TaskGroup.AutoSize = true;
                    TaskGroup.AutoSizeMode = AutoSizeMode.GrowAndShrink;

                    TaskGroup.TaskClicked += new EventHandler(SingleTask_ExecuteTask);
                    TaskGroup.TaskSelected += new EventHandler(SingleTask_TaskSelected);

                    this.Controls.Add(TaskGroup);

                    // Make sure Task Groups are shown in correct order and not in reverse order.
                    // (This is needed because we 'stack them up' with 'TaskGroup.Dock = DockStyle.Top')
                    TaskGroup.BringToFront();

                    // Select (highlight) first Task in the first Group
                    if (Groups.Count == 1)
                    {
                        TaskGroup.SelectFirstTask();
                    }
                }

                TaskGroupNode = TaskGroupNode.NextSibling;
            }

            this.ResumeLayout();
        }