Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7753307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:01:43+00:00 2026-06-01T12:01:43+00:00

Found this question that explained a way to communicate between layers. However there is

  • 0

Found this question that explained a way to communicate between layers.
However there is one more aspect.

Assuming I am using interfaces to send messages from the BLL to the UI as seen in the folowing example:

public interface IUiCallbacks
{
  void SendMessage(string message);
  void SendException(string message, Exception ex);
}

public class WinFormsUiCallbacks : IUiCallbacks
{
  public void SendMessage(string message)
  {
    MessageBox.Show(message);
  }

  public void SendException(string message, Exception ex)
  {
    MessageBox.Show(string.Format("Unfortunately, the following errror has occurred:{0}{1}", Environment.NewLine, ex.Message));
  }
}

public class OrderService
{
  private IUiCallbacks _iUiCallbacks;
  ...
  public OrderService() { ... }
  public OrderService(IUiCallbacks iUiCallbacks)
  {
    _iUiCallbacks = iUiCallbacks;
  }
  ...
  public void AddOrder(Order order)
  {
    ...
    if(OrderAlreadyExists(order))
    {
      if(_iUiCallbacks != null)
        _iUiCallbacks.SendMessage("The order can not be added, because it is already accepted.");
      return;
    }
    ...
  }
  ...
}

Instead of the information message I want a confirmation box that would confirm the overwrite for the existing order.

How can I handle the result of the confirmation box in this case?

Thanks,
Alex

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T12:01:45+00:00Added an answer on June 1, 2026 at 12:01 pm

    Simply make your SendMessage return DialogResult, and add all necessary parameters:

      public DialogResult SendMessage(string message, string caption, MessageBoxButtons buttons)
      {
        return MessageBox.Show(message, caption, buttons);
      }
    

    And use it.

    If you don’t want to reference DialogResult type in your IUiCallbacks interface then create your own DialogResult types and provide code to map (for example cast) between WPF DialogResult and your DialogResult.

    You can have a look at IDialogService from In The Box MVVM Training – even though it’s for WPF+MVVM (BTW: MVVM is a great pattern, really worth learning), it already includes everything you need.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there anyway to know this? I found one post that asked a very
I found this question that is discussing what I would like to do, but
I found this question that was very useful in learning the basics of the
Searching here I found that this question was already asked , but I think
While trying to answer this question I found that the code int* p =
I had posted a question in regards to this code. I found that JTextArea
I know this very regular question But i didn't get that's way ask here
I have found answers to this question that explain how to convert an NSString
Sorry if this is a dup; I haven't found any questions that pose quite
Reading this question I found this as (note the quotation marks) code to solve

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.