Example #1
0
        private void OnItemActivation(TTaskList ATaskList, XmlNode ATaskListNode, LinkLabel AItemClicked)
        {
            TTaskList       FoundTaskList;
            TPnlCollapsible CollPanel;

            if (FOnlyOneActiveTaskOnAllCollapsiblePanelsTaskLists)
            {
                // Remove the Active Task Item from any Collapsible Panel's TaskList that
                // isn't the sending instance (that is passed in in ATaskList) as we only
                // want *one* Active Task Item in one hosted Collapsible Panel!
                for (int Counter = 0; Counter < FCollPanelCount; Counter++)
                {
                    CollPanel     = GetCollapsiblePanelInstance(Counter);
                    FoundTaskList = CollPanel.TaskListInstance;

                    if (FoundTaskList != ATaskList)
                    {
                        FoundTaskList.ActiveTaskItem = null;
                    }
                }
            }

            FCollPanelWhereLastItemActivationHappened = GetCollapsiblePanelInstance(ATaskListNode.ParentNode);

            // Re-fire Event
            if (ItemActivation != null)
            {
                ItemActivation(ATaskList, ATaskListNode, AItemClicked, GetCollapsiblePanelInstance(0));
            }
        }
Example #2
0
 private void OnItemActivation(TTaskList ATaskList, XmlNode ATaskListNode, LinkLabel AItemClicked, object AOtherData)
 {
     if (ItemActivation != null)
     {
         ItemActivation(ATaskList, ATaskListNode, AItemClicked, AOtherData);
     }
 }
Example #3
0
        /// <summary>
        /// Selects the first control in the ledger list, if it exists.
        /// Once this control is focused the client can use the TAB key to select other items in the folder navigation panel.
        /// TODO: This functionality needs more thought when we get multi ledgers for real in production.   (AlanP)
        /// because we do not get a marquee when the control gets the focus.  We really need another way (colour) for showing the
        /// selected ledger.  I do not have time for this now.
        /// </summary>
        public void SelectLedgerList()
        {
            Control[] ledgerPanels = this.sptNavigation.Panel1.Controls.Find("SelectLedger", true);

            foreach (Control c1 in ledgerPanels)
            {
                Control[] tasks = c1.Controls.Find("TTaskList", true);

                foreach (Control c2 in tasks)
                {
                    TTaskList task = c2 as TTaskList;

                    if ((task != null) && (task.Controls.Count > 0))
                    {
                        Panel c3 = (Panel)task.Controls[0];
                        c3.Focus();

                        if (c3.Controls[0] as LinkLabel != null)
                        {
                            LinkLabel c4 = (LinkLabel)c3.Controls[0];
                            c4.Select();
                            c4.Focus();
                        }
                    }
                }
            }
        }
 private void OnItemActivation(TTaskList ATaskList, XmlNode ATaskListNode, LinkLabel AItemClicked, object AOtherData)
 {
     if (SubmoduleChanged != null)
     {
         if (ATaskListNode.Attributes["LedgerNumber"] == null)
         {
             SubmoduleChanged(ATaskList, ATaskListNode, AItemClicked, AOtherData);
         }
     }
 }
Example #5
0
        /// <summary>
        /// </summary>
        public void TestFullConstructor(object sender, EventArgs e)
        {
            System.Xml.XmlNode xmlnode = GetTestXMLNode();

            TaskList1 = new Ict.Common.Controls.TTaskList(xmlnode, FEnumStyle);

            TaskList1.Location = new System.Drawing.Point(10, 10);
            TaskList1.Size     = new System.Drawing.Size(300, 200);
            TaskList1.Name     = TASKLISTCONTROLNAME;

            AddControlToForm(TaskList1);
            HookupTaskListEvents(TaskList1);
        }
Example #6
0
    /// <summary>
    /// </summary>
    public void TestFullConstructor(object sender, EventArgs e)
    {
        System.Xml.XmlNode xmlnode = GetTestXMLNode();

        TaskList1 = new Ict.Common.Controls.TTaskList(xmlnode, FEnumStyle);

        TaskList1.Location = new System.Drawing.Point(10, 10);
        TaskList1.Size = new System.Drawing.Size(300, 200);
        TaskList1.Name = TASKLISTCONTROLNAME;

        AddControlToForm(TaskList1);
        HookupTaskListEvents(TaskList1);
    }
Example #7
0
        private void OnItemActivation(TTaskList ATaskList, XmlNode ATaskListNode, LinkLabel AItemClicked, object AOtherData)
        {
            if (ATaskListNode.Attributes["LedgerNumber"] == null)
            {
                if ((AOtherData != null) &&
                    (FSubSystemLinkStatus != null) &&
                    (AOtherData.GetType() == typeof(TPnlCollapsible)))
                {
                    FSubSystemLinkStatus(FCurrentLedger, (TPnlCollapsible)AOtherData);
                }

                LinkClicked(AItemClicked, null);
            }
            else
            {
                if (!FSuppressLedgerChangedEvent)
                {
                    int NewLedger = Convert.ToInt32(ATaskListNode.Attributes["LedgerNumber"].Value);

                    if (FCurrentLedger != NewLedger)
                    {
                        OnLedgerChanged(NewLedger, ATaskListNode.Attributes["LedgerName"].Value);

                        if ((AOtherData != null) &&
                            (FSubSystemLinkStatus != null) &&
                            (AOtherData.GetType() == typeof(TPnlCollapsible)))
                        {
                            FSubSystemLinkStatus(FCurrentLedger, (TPnlCollapsible)AOtherData);
                        }

                        // If ledger has been changed then possibly the functional menu item (panel above ledger panel) may be disabled.
                        // Therefore reselect first active menu item to make sure that menu is initialized properly.
                        if (FCollapsibleNavigation.CollapsiblePanelHosterInstance.GetTaskListInstance(0) != null)
                        {
                            FCollapsibleNavigation.CollapsiblePanelHosterInstance.GetTaskListInstance(0).SelectFirstTaskItem();
                        }
                    }
                }
            }

            // Re-fire Event
            if (ItemActivation != null)
            {
                ItemActivation(ATaskList, ATaskListNode, AItemClicked, AOtherData);
            }
        }
        private void OnItemActivation(TTaskList ATaskList, XmlNode ATaskListNode, LinkLabel AItemClicked)
        {
            TTaskList FoundTaskList;
            TPnlCollapsible CollPanel;

            if (FOnlyOneActiveTaskOnAllCollapsiblePanelsTaskLists)
            {
                // Remove the Active Task Item from any Collapsible Panel's TaskList that
                // isn't the sending instance (that is passed in in ATaskList) as we only
                // want *one* Active Task Item in one hosted Collapsible Panel!
                for (int Counter = 0; Counter < FCollPanelCount; Counter++)
                {
                    CollPanel = GetCollapsiblePanelInstance(Counter);
                    FoundTaskList = CollPanel.TaskListInstance;

                    if (FoundTaskList != ATaskList)
                    {
                        FoundTaskList.ActiveTaskItem = null;
                    }
                }
            }

            FCollPanelWhereLastItemActivationHappened = GetCollapsiblePanelInstance(ATaskListNode.ParentNode);

            // Re-fire Event
            if (ItemActivation != null)
            {
                ItemActivation(ATaskList, ATaskListNode, AItemClicked, GetCollapsiblePanelInstance(0));
            }
        }
Example #9
0
 private void OnItemActivation(TTaskList ATaskList, XmlNode ATaskListNode, LinkLabel AItemClicked, object AOtherData)
 {
     if (ItemActivation != null)
     {
         ItemActivation(ATaskList, ATaskListNode, AItemClicked, AOtherData);
     }
 }
 private void OnItemActivation(TTaskList ATaskList, XmlNode ATaskListNode, LinkLabel AItemClicked, object AOtherData)
 {
     if (SubmoduleChanged != null)
     {
         if (ATaskListNode.Attributes["LedgerNumber"] == null)
         {
             SubmoduleChanged(ATaskList, ATaskListNode, AItemClicked, AOtherData);
         }
     }
 }
Example #11
0
 private void HookupTaskListEvents(TTaskList ATaskList)
 {
     ATaskList.ItemActivation += new TTaskList.TaskLinkClicked(ATaskList_ItemActivation);
 }
        private void OnSubmoduleChanged(TTaskList ATaskList, XmlNode ATaskListNode, LinkLabel AItemClicked)
        {
            const string DetailTextPrefix = "ยป ";
            string ModuleText = String.Empty;
            string BreadcrumbDetailText = String.Empty;

            if ((ATaskListNode.ParentNode.Attributes["SkipThisLevel"] != null)
                && (ATaskListNode.ParentNode.Attributes["SkipThisLevel"].Value == "true"))
            {
                ModuleText = TLstFolderNavigation.GetLabel(ATaskListNode.ParentNode.ParentNode);
                BreadcrumbDetailText = DetailTextPrefix + AItemClicked.Text;
            }
            else
            {
                if ((ATaskListNode.ParentNode.Attributes["DontShowNestedTasksAsLinks"] == null)
                    || (ATaskListNode.ParentNode.Attributes["DontShowNestedTasksAsLinks"].Value == "false"))
                {
                    if ((ATaskListNode.ParentNode.ParentNode.Attributes["DependsOnLedger"] == null)
                        || (ATaskListNode.ParentNode.ParentNode.Attributes["DependsOnLedger"].Value == "false"))
                    {
                        ModuleText = TLstFolderNavigation.GetLabel(ATaskListNode.ParentNode.ParentNode);
                    }
                    else
                    {
                        ModuleText = Catalog.GetString("Ledger" + " " + FCurrentLedger.ToString());
                    }

                    BreadcrumbDetailText = DetailTextPrefix + TLstFolderNavigation.GetLabel(ATaskListNode.ParentNode) + " ";
                }

                BreadcrumbDetailText += DetailTextPrefix + AItemClicked.Text;
            }

            FBreadcrumbTrail.ModuleText = ModuleText;
            FBreadcrumbTrail.DetailText = BreadcrumbDetailText;

            // this is needed when there is just one ledger existing as item structure will be different
            UpdateSubsystemLinkStatus(FCurrentLedger, ATaskList, ATaskListNode);
        }
        private void UpdateSubsystemLinkStatus(int ALedgerNumber, TTaskList ATaskList, XmlNode ATaskListNode)
        {
            bool ServerCallSuccessful;
            ALedgerRow LedgerDR = null;

            if ((ATaskListNode != null) && (ATaskListNode.ParentNode != null)
                && (ATaskListNode.ParentNode.Name == "Finance"))
            {
                try
                {
                    LedgerDR =
                        ((ALedgerTable)TDataCache.TMFinance.GetCacheableFinanceTable(
                             TCacheableFinanceTablesEnum.LedgerDetails, ALedgerNumber))[0];
                }
                catch (ECachedDataTableLoadingRetryGotCancelledException Exc)
                {
                    TLogging.Log("Loading of Cacheable DataTable 'LedgerDetails' failed; the CLIENT NEEDS TO BE RESTARTED!  " +
                        "Details: " + Exc.ToString());

                    // RESTART CLIENT!
                    PetraClientShutdown.Shutdown.StopPetraClient(true, true, true, StrDataLoadingErrorMessage);
                }

                XmlNode TempNode = ATaskListNode.ParentNode.FirstChild;

                while (TempNode != null)
                {
                    ServerCallSuccessful = false;

                    Ict.Common.DB.TServerBusyHelper.CoordinatedAutoRetryCall("Finance Sub-system Activated inquiry", ref ServerCallSuccessful,
                        delegate
                        {
                            if (TempNode.Name == "GiftProcessing")
                            {
                                ATaskList.EnableDisableTaskItem(TempNode,
                                    TRemote.MFinance.Setup.WebConnectors.IsGiftProcessingSubsystemActivated(ALedgerNumber));
                            }
                            else if (TempNode.Name == "AccountsPayable")
                            {
                                ATaskList.EnableDisableTaskItem(TempNode,
                                    TRemote.MFinance.Setup.WebConnectors.IsAccountsPayableSubsystemActivated(ALedgerNumber));
                            }

                            ServerCallSuccessful = true;
                        });

                    if (!ServerCallSuccessful)
                    {
                        TLogging.Log("Inquiring of Finance Subsystems' Activated States failed; the CLIENT NEEDS TO BE RESTARTED!");
                        TServerBusyHelperGui.ShowLoadingOfDataGotCancelledDialog();

                        // RESTART CLIENT!
                        PetraClientShutdown.Shutdown.StopPetraClient(true, true, true, StrDataLoadingErrorMessage);

                        // ALL-IMPORTANT EXIT statement: without this, a number of OpenPetra Clients might get
                        // started from within this while loop!!!
                        Environment.Exit(0);
                    }

                    TempNode = TempNode.NextSibling;
                } // while

                EnableDisableChildOption(ATaskList, "SuspenseAccounts", LedgerDR.SuspenseAccountFlag, ATaskListNode.ParentNode);
            } // if
        }
        /// <summary>
        /// Show or Hide this option in the given menu
        /// </summary>
        private void EnableDisableChildOption(TTaskList ATaskList, String AOptionName, Boolean AIsAllowed, XmlNode ANode)
        {
            while (ANode != null)
            {
                EnableDisableChildOption(ATaskList, AOptionName, AIsAllowed, ANode.FirstChild);

                if (ANode.Name == AOptionName)
                {
                    ATaskList.EnableDisableTaskItem(ANode, AIsAllowed);
                }

                ANode = ANode.NextSibling;
            }
        }
Example #15
0
        public void TestSetter_TaskListInstance()
        {
            FPnl = new TPnlCollapsible(THostedControlKind.hckTaskList, TTestTaskList.GetTestXmlNode());
            FPnl.RealiseTaskListNow();

            TTaskList TLst1 = FPnl.TaskListInstance;
            int ExpandedSize = FPnl.ExpandedSize;

            TTaskList TLst2 = new TTaskList(TTestTaskList.GetTestXmlNode2());

            FPnl.TaskListInstance = TLst2;

            Assert.AreNotEqual(TLst1, FPnl.TaskListInstance, "FPnl.TaskListInstance");

            Assert.AreNotEqual(ExpandedSize, FPnl.ExpandedSize, "ExpandedSize");

            assertIsStable2(FPnl);
        }
Example #16
0
        /// <summary></summary>
        private TTaskList InstantiateTaskList()
        {
            if (FTaskListNode == null)
            {
                if ((this.Site == null)
                    || (!this.Site.DesignMode))
                {
                    throw new ENoTaskListNodeSpecifiedException();
                }
                else
                {
                    // Show some hard-coded Tasks in WinForm Designer
                    FTaskListNode = GetHardCodedXmlNodes_ForDesignerOnly();
                }
            }

            FTaskListInstance = new Ict.Common.Controls.TTaskList(FTaskListNode, FVisualStyleEnum);

            UpdateTaskList();

            FTaskListInstance.ItemActivation += delegate(TTaskList ATaskList, XmlNode ATaskListNode, LinkLabel AItemClicked, object AOtherData)
            {
                OnItemActivation(ATaskList, ATaskListNode, AItemClicked, AOtherData);
            };

            return FTaskListInstance;
        }
Example #17
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();
        }
        private void OnItemActivation(TTaskList ATaskList, XmlNode ATaskListNode, LinkLabel AItemClicked, object AOtherData)
        {
            if (ATaskListNode.Attributes["LedgerNumber"] == null)
            {
                if ((AOtherData != null)
                    && (FSubSystemLinkStatus != null)
                    && (AOtherData.GetType() == typeof(TPnlCollapsible)))
                {
                    FSubSystemLinkStatus(FCurrentLedger, (TPnlCollapsible)AOtherData);
                }

                LinkClicked(AItemClicked, null);
            }
            else
            {
                if (!FSuppressLedgerChangedEvent)
                {
                    int NewLedger = Convert.ToInt32(ATaskListNode.Attributes["LedgerNumber"].Value);

                    if (FCurrentLedger != NewLedger)
                    {
                        OnLedgerChanged(NewLedger, ATaskListNode.Attributes["LedgerName"].Value);

                        if ((AOtherData != null)
                            && (FSubSystemLinkStatus != null)
                            && (AOtherData.GetType() == typeof(TPnlCollapsible)))
                        {
                            FSubSystemLinkStatus(FCurrentLedger, (TPnlCollapsible)AOtherData);
                        }

                        // If ledger has been changed then possibly the functional menu item (panel above ledger panel) may be disabled.
                        // Therefore reselect first active menu item to make sure that menu is initialized properly.
                        if (FCollapsibleNavigation.CollapsiblePanelHosterInstance.GetTaskListInstance(0) != null)
                        {
                            FCollapsibleNavigation.CollapsiblePanelHosterInstance.GetTaskListInstance(0).SelectFirstTaskItem();
                        }
                    }
                }
            }

            // Re-fire Event
            if (ItemActivation != null)
            {
                ItemActivation(ATaskList, ATaskListNode, AItemClicked, AOtherData);
            }
        }
 void CollPanelHoster_ItemActivation(TTaskList ATaskList, XmlNode ATaskListNode, LinkLabel AItemClicked, object AOtherData)
 {
     MessageBox.Show(String.Format("Task '{0}' with Label '{1}' got clicked.", ATaskListNode.Name, AItemClicked.Text));
 }
        private void UpdateSubsystemLinkStatus(int ALedgerNumber, TTaskList ATaskList, XmlNode ATaskListNode)
        {
            if ((ATaskListNode != null) && (ATaskListNode.ParentNode != null)
                && (ATaskListNode.ParentNode.Name == "Finance"))
            {
                ALedgerRow ledger =
                    ((ALedgerTable)TDataCache.TMFinance.GetCacheableFinanceTable(
                         TCacheableFinanceTablesEnum.LedgerDetails, ALedgerNumber))[0];
                XmlNode TempNode = ATaskListNode.ParentNode.FirstChild;

                while (TempNode != null)
                {
                    if (TempNode.Name == "GiftProcessing")
                    {
                        ATaskList.EnableDisableTaskItem(TempNode,
                            TRemote.MFinance.Setup.WebConnectors.IsGiftProcessingSubsystemActivated(ALedgerNumber));
                    }
                    else if (TempNode.Name == "AccountsPayable")
                    {
                        ATaskList.EnableDisableTaskItem(TempNode,
                            TRemote.MFinance.Setup.WebConnectors.IsAccountsPayableSubsystemActivated(ALedgerNumber));
                    }

                    TempNode = TempNode.NextSibling;
                } // while

                EnableDisableChildOption(ATaskList, "SuspenseAccounts", ledger.SuspenseAccountFlag, ATaskListNode.ParentNode);
            } // if

        }