Mattersphere Developers Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Go down
avatar
Admin
Admin
Posts : 122
Join date : 2018-12-17
https://mattersphere-devs.forumotion.com

Trying To Execute Code in EnquiryLoaded Event In Taskflow Tab Empty Trying To Execute Code in EnquiryLoaded Event In Taskflow Tab

Tue 18 Dec 2018 - 11:17
Original post by Steven Rodney: srodney@kingsleynapley.co.uk


Hi All

In Mattersphere v 6.3, I have been using code that adds a new section to the information panel with clickable links. I have attached code to the EnquiryLoaded event of the first tab of a matter type and the code works fine.

Unfortunately, a department uses the taskflow tab has there first tab and it does not have an EnquiryLoaded event. I've tried the initialise event but it executes before the Mattersphere screen is even rendered so the panel does not appear. Is there anyway to execute the panel code in this screen without EnquiryLoaded?

Sample Code Thanks to Darren Baldwin

Code:
// Create iManage panel and it's Hyperlink controls.
private ucPanelNav iManagePanel = null;
private ucNavCommands iManageNavCommands = null;
private void InitialisePanel()
{
    try
    {
        if((iManagePanel == null) && (iManageNavCommands == null))
        {
            // Create the iManage panel
            iManagePanel = new ucPanelNav();
            iManagePanel.Text = "iManage Actions";
            iManagePanel.Name = "iManageActions";
            
            // Add panel to Current Display panel and set it's position
            this.CurrentDisplay.Panels.Controls.Add(iManagePanel);
            this.CurrentDisplay.Panels.Controls.SetChildIndex(iManagePanel, 1);

            //create the commands and wire up event handler
            iManageNavCommands = new ucNavCommands();
            iManageNavCommands.ImageList = FWBS.OMS.UI.Windows.Images.CoolButtons16();
            iManageNavCommands.Location = new System.Drawing.Point(0, 22);
            iManageNavCommands.Size = new System.Drawing.Size(123, 25);
            iManageNavCommands.Dock = System.Windows.Forms.DockStyle.Fill;
            iManageNavCommands.LinkClicked += new LinkEventHandler(LinkClicked);
            iManagePanel.Controls.Add(iManageNavCommands);

            //Add command strings
            AddActionCommand("Open Documents", 1);
            AddActionCommand("Search Documents", 4);

            //this event deals with only displaying the panel when this tab is selected
            this.CurrentDisplay.TabControl.SelectedIndexChanged += new EventHandler(OnTabChange);
        }
    }
    catch (System.Exception ex)
    {
        FWBS.OMS.UI.Windows.ErrorBox.Show(ex);
    }
}

private void AddActionCommand(string command, int imageIndex)
{
    try
    {
        FWBS.OMS.UI.Windows.ucNavCmdButtons btn = new FWBS.OMS.UI.Windows.ucNavCmdButtons();
        btn.ImageIndex = imageIndex;
        btn.Text = command;
        btn.Dock = DockStyle.Bottom;
        iManageNavCommands.Controls.Add(btn);
        iManageNavCommands.Refresh(true);
    }
    catch (System.Exception ex)
    {
        FWBS.OMS.UI.Windows.ErrorBox.Show(ex);
    }
}

private void OnTabChange(object sender, EventArgs e)
{
    try
    {
// if(this.CurrentDisplay.TabControl.SelectedTab.Tag != this.EnquiryForm)
// {
// iManagePanel.Visible = false;
// }
// else
// {
// iManagePanel.Visible = true;
// }
        
        iManagePanel.Visible = true;
    }
    catch (System.Exception ex)
    {
        FWBS.OMS.UI.Windows.ErrorBox.Show(ex);
    }
}

// The events executed when the hyperlinked is clicked
// Write iManage code here.
private void LinkClicked(ucNavCmdButtons linkButton)
{
    try
    {
        string buttonText = linkButton.Text.ToUpper();
        string cr = System.Environment.NewLine;
        string message = string.Empty;
        switch(buttonText)
        {
            case "OPEN DOCUMENTS":
            {
                message += "Switch 1" + cr;
                break;
            }
            case "SEARCH DOCUMENTS":
            {
                message += "Switch 2" + cr;
                break;
            }
            default:
            {
                message += "Default Switch" + cr;
                break;
            }
        }
        
        System.Windows.Forms.MessageBox.Show(message + linkButton.Text);
    }
    catch (System.Exception ex)
    {
        FWBS.OMS.UI.Windows.ErrorBox.Show(ex);
    }
}
Back to top
Permissions in this forum:
You cannot reply to topics in this forum