Displaying Information/Error/Warning Message

<< Click to Display Table of Contents >>

Navigation:  Developers' Guide > Customizing User Interface > FAQs > Samples >

Displaying Information/Error/Warning Message

Navigation: Developers' Guide > Customizing User Interface > FAQs > Samples >

hm_btn_navigate_prevhm_btn_navigate_tophm_btn_navigate_next

Displaying Information/Error/Warning Message

 

Show/Hide Hidden Text

This topic contains sample code for displaying information/error/warning messages in Management Console (MC) and Point of Sale (POS).

Below are the separate code sample for Management Console and Point of Sale. Click the respective link to view sample.

Click here to collapse/expand the view.

Displaying Information/Error/Warning Message in MC

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Drawing;

using System.Data;

using System.Text;

using System.Linq;

using System.Threading.Tasks;

using System.Windows.Forms;

using DevExpress.XtraEditors;

 

using CXS.Retail.UIComponents;

using CXS.Retail.ManagementUIComponents;

using CXS.Platform.Data;

using CXS.Retail.Extensibility;

using CXS.Retail.BusinessLogic;

using CXS.SubSystem.Customer;

using CXS.Platform.UIComponents;

using CXS.Platform.Core;

 

namespace CustomScreenSampleForMC

{

    public partial class SampleAddEditView : BaseConsoleCustomView

    {

        private void CustomLookupClickHandler(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)

        {

            try

            {

                if (e.Button.Index == 0)

                {

                    SampleSearchView view = new SampleSearchView();

                    view.ViewOpenedFromOtherScreen = true;

                    view.OnEvent += new SampleSearchView.EventHandler(CustomSearchViewEventHandler);

                    ConsoleViewManager.Instance.Push(view);

                }

                else

                {

                    m_VerticalGridAddEditScreen.SetCellValue(m_VerticalGridAddEditScreen.Rows.GetRowByFieldName("U_CustomLookup"), m_VerticalGridAddEditScreen.FocusedRecord, "");

                    m_VerticalGridAddEditScreen.Refresh();

                    m_VerticalGridAddEditScreen.CloseEditor();

                }

            }

            catch (Exception ex)

            {

                ShowError(Common.GetString("SampleAddEditView""ErrorEncountered")); 

                //ShowInformation(Common.GetString("SampleAddEditView""InformationMessage"));

                //ShowWarning(Common.GetString("SampleAddEditView""WarningMessage"));

            }

            finally

            {

                CloseWaitForm();

                Cursor = UIHelper.Instance.DefaultCursor;

            }

        }

 

        void CustomSearchViewEventHandler(object sender, SampleSearchView.EventArgs args)

        {

            SampleSearchView view = sender as SampleSearchView;

 

            if (args.EventType == SampleSearchView.EventType.Ok)

            {

                m_VerticalGridAddEditScreen.SetCellValue(m_VerticalGridAddEditScreen.Rows.GetRowByFieldName("U_CustomLookup"), m_VerticalGridAddEditScreen.FocusedRecord, args.SelectedString.ToString());

                m_VerticalGridAddEditScreen.Refresh();

            }

 

            view.OnEvent -= new SampleSearchView.EventHandler(CustomSearchViewEventHandler);

            ConsoleViewManager.Instance.Pop();

        }

 

    }

}

 

 

Click to collapse/expand the view.

Displaying Information/Error/Warning Message in POS.

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using CXS.Retail.Extensibility.Modules.Transaction;

using CXS.Retail.Extensibility;

using CXS.Retail.ManagementUIComponents;

using CXS.Platform.UIComponents;

using DevExpress.XtraEditors;

using System.Windows.Forms;

using CXS.Framework.Core;

using CXS.Retail.UIComponents;

using CXS.Retail.ViewModel.Message;

using CXSRetailPOS;

 

namespace POSEventsSampleAddon

{

class Transaction : TransactionEntryModuleBase

{

    TransactionEntryView t;

   public override void OnBeforeCustomerSearch(object sender, EventArgs<CXS.SubSystem.Transaction.Transaction> args)

    {

        MessageBox.Show("On before customer search - TransactionEntry");

        //Testing Exception handling using args

        args.Message = "Validation error";

        args.Cancel = true;

       //Values can be MessageType.Information, MessageType.Warning and MessageType.None

        args.MessageType = MessageType.Error;

    }

}

}