Loading
Uniconta
Search
Generic filters
Free trial signup
  • Visit a Country Site
    • Dansk
    • Uniconta GermanyDeutsch
    • Eesti
    • Uniconta GermanyÍslenska
    • Lietuvis
    • Uniconta NetherlandsNederlands
    • Norsk
    • English
  • Search
  • Uniconta
    • What is Uniconta ?
    • Modules
    • Ledger
    • Customer
    • Sales Order
    • Vendor
    • Purchase
    • Inventory
    • Logistics
    • Project
    • Light Manufacturing
    • CRM
    • Fixed assets
    • Dashboard
    • Company
    • Adaptability
    • Uniconta Assistant App
    • Uniconta Upload App
  • Download
    • Uniconta for Windows
    • Uniconta for Mac
    • Download for Developers
    • Free trial signup
  • Resellers
    • Find a reseller
    • Become a reseller
    • Uniconta Partner info Login
    • Uniconta Partner info Sign up
  • Developers
    • Become an integration partner
    • Documentation
    • Samples
    • Downloads
  • Accountants
    • Become a Univisor
  • News Overview
    • Blog
    • News
    • Uniconta Update
    • Customer cases
  • About us
    • About us
      • Management
      • Contact
      • IT Security ISAE 3402
      • System status
    • Terms & Conditions
      • License Agreement
      • Data Processing Agreement (DPA)
      • Privacy policy
      • Cookie policy
      • Sub-processors

Developers Unipedia

  • API
    • API
    • User defined fields
    • User defined tables
    • Saving a Session
    • Posting an Invoice
    • Post Invoice and get PDF
    • Localization
    • Attach physical voucher to entities
    • Server-Login User
    • How to find C# Property from Uniconta Label
    • Minimize network traffic and optimize speed
  • Plugins
    • Plugins
    • Debug Uniconta Plugins
    • Refreshing UI with plugins
    • How to use Uniconta Plugin
    • Develop a user plugin
    • Event Handling
    • Global Script
    • How to capture menu events
    • How to open a form in Uniconta from Plugin
    • Open new content in a IContentPluginBase plugin
    • Adding plugin in a menu
    • How to add user parameter in plugin menu
    • How to create plugin with Devexpress Library
    • Synchronize Entity Support in form page
    • Develop a PageEventBase Plugin
    • Logging Exceptions on local machine
    • Create Custom Uniconta Pages From Github Code
    • Web frame integration
  • OData
    • CRUD operations in OData
    • ODATA REST API – Testing with Postman

Refreshing UI with plugins

1,361 October 2nd, 2018 January 7th, 2021 < 1 minute
Print Friendly, PDF & Email

There are two different ways to refresh the UI from plugins, depending on the plugin type you are developing.

The way to refresh in IContentPluginBase is the same as IPluginBase.

Refreshing with IPluginBase

IPluginBase plugins have the following EventHandler:

public event EventHandler OnExecute;

The following code snippet can be called from the method Execute(...) to refresh the UI of the Grid Page.

PluginEventArgs arg = new PluginEventArgs();
arg.EventType = PluginEvent.RefreshGrid;
OnExecute(null, arg);

To exemplify this, here is an example plugin that can be used to double the amount of OrderLines on an Order.

/*
* Creates dummy data by doubling the amount of DebtorOrderLines
*/
public ErrorCodes Execute(UnicontaBaseEntity master, UnicontaBaseEntity currentRow, IEnumerable<UnicontaBaseEntity> source, string command, string args)
{
    // Cast source to its run time type.
    var allLines = (IEnumerable<DebtorOrderLineClient>) source;
    var newLines = new List<DebtorOrderLineClient>();
    // Loop over all lines and Insert an extra line.
    foreach (var line in allLines)
    {
        var newLine = new DebtorOrderLineClient
        {
            Item = line.Item,
            Price = line.Price,
            Text = line.Text,
            Date = DateTime.Now,
         };
         newLines.Add(newLine);
         newLine.SetMaster(master);
    }
            
    // Insert new order lines. 
    var result = Crud.Insert(newLines).Result;
    // Call refresh code to update UI automatically.
    PluginEventArgs arg = new PluginEventArgs();
    arg.EventType = PluginEvent.RefreshGrid;
    OnExecute(null, arg);
    return result;
}

Refreshing with PageEventsBase

You can take theRefreshGrid() method and paste into your own code base. Now you can just call RefreshGrid when you want to refresh the UI.

Note that this will call some events of the PageEventsBase. For instance, if this method is called from RecrodPropertyChanged, it results in an infinite loop.

private void RefreshGrid()
{
    var methodInfo = this.page.GetType().GetMethod("Filter", new Type[] { });
    if (methodInfo != null)
        methodInfo.Invoke(this.page, null);
}

 

Categories: API, Developers Unipedia, Plugins
Home » Plugins » Refreshing UI with plugins

Get in touch with us

Uniconta

  • Uniconta
  • Modules
  • Downloads
  • Free trial signup
  • Subscription Terms
  • System Status

PARTNER

  • Become a Reseller
  • Uniconta API key application
  • For Developers
  • For Accountants (Univisor)
  • Uniconta Partner info

INFO

  • News
  • Updates
  • Customer cases
  • Video
  • IT Security
  • About us
  • Management

Support

  • Unipedia
  • API information
  • Contacts
  • Visit a Country Site
    • Dansk
    • Uniconta GermanyDeutsch
    • Eesti
    • Uniconta GermanyÍslenska
    • Lietuvis
    • Uniconta NetherlandsNederlands
    • Norsk
    • English
Uniconta
© Copyright 2019 | All rights reserved | [email protected] | Terms & Conditions
Facebook LinkedIn Youtube