Log in

Using WECPOF in runtime

From MDrivenWiki
Revision as of 15:45, 7 November 2018 by Alexandra (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

❗🕜 Warning: this article may contain outdated information. Consider before using any descriptions/solutions, otherwise it still can be helpful. Help : Synonyms and name changes

You can use WECPOF in design time ECO projects and in files.

This article explains how to use it in runtime to deliver finished applications.

It starts out as an ordinary ECO project (create one from the wizard, Create new project Eco project).

You then create your model, update the code, configure your Persistence mapper of choice, set up any remote persistence mapper and synchronization if you want to just as the PDF-tutorials explain, Create or evolve your database, or derive the model from an existing database with the Reverse derive options.

Then add a WPF-Window or a WPF-Page (for browser applications).

Make sure your project references WECPOFLogic, then add a reference to the xaml :


And add a MainMenu and a WECPOFWindowEnvironment (this is where the WECPOF windows will be hosted)

Code Snippet

<Window x:Class="WpfApplication1.Window1"
  Title="Window1" Height="314" Width="354">
  <LinearGradientBrush x:Key="WECPOFWinBackgroundBrush" EndPoint="0,1" StartPoint="0,0">
    <GradientStop Color="#CCC" Offset="0.0" />
    <GradientStop Color="#EEE" Offset="1.0" />
... cut for clarity...

   <RowDefinition Height="22"></RowDefinition>
  <Menu Grid.Row="0"  Name="MainMenu">
  <wecpof:WECPOFWindowEnvironment x:Name="WecpofWinEnv">

In code behind we need to create our ecospace and hook everything up; this is boiler plate code:

Code Snippet

public partial class Window1 : Window
  EcoSpace _ecospace;
  MenuHandling _MenuHandling;
  public Window1()

    // Create ecospace or use one that you have
    _ecospace = new EcoProject1.EcoProject1EcoSpace();
    _ecospace.Active = true;
    // Start up the Eco UI dequeuer ; if not set nothing will show
    WPFDequeuer.Active = true;
    // Load viewmodel definitions from embedded resources

    // Create a WECPOF menu handling component
    _MenuHandling = new MenuHandling();

    // Define where WECPOF should look for styles
    WecpofWinEnv.PathToStyles = Directory.GetCurrentDirectory() + "\\Styles";
    // And to where WECPOF should apply a choosen style
    // Tell the MenuHandling component where to put the MenuItems. Hand over the list of Actions from ECO, hand over the EcoSpace.
    // Send in the WindowEnvironment defined in xaml, and say in what context should the speed keys be evaluated
    _MenuHandling.InitMainMenu(MainMenu, ViewModelDefinitionsInApplication.GetActionsRuntime(), _ecospace, WecpofWinEnv, this);
    // Let the WECPOF Window environment know about the MenuHandling component
    // Implement the event to implement Quit...
    MenuHandling.OnExit += new EventHandler<EventArgs>(MenuHandling_OnExit);

  void MenuHandling_OnExit(object sender, EventArgs e)

And you are done:

WECPOF -1.png