C++ TCP server Integration correct use of NotifyEvent Subscription
I'm trying to integrate old MFC styled TCP IOCPServer with noesisgui IntegrationGLUT example .
There are no examples of doing so and i'm very confused how to correctly work/use Noesis::INotify , INotifyPropertyChanged for it.
As i need somehow tell to gui - ListBox that data has to be inserted .
In old fashioned way After Socket Read Data, i'm calling a CALLBACK* NOTIFYPROC function with data and packeID on stack like so
That is executing/Notifying MainFrame of MFC ui.
and inside this function i'm accessing global variables - View's
and depending on the Code value
I'm sending Data to the ListCtrl of g_view1.
How can i do this in NoesisGui - Access xaml item's/Views(Like TabItem, ListBox) of static Noesis::IView* _view ?
Create a Notify/Subscription , something like this where itemsSource = pData And FilterPredicate is TabItem1::OnAddToList i guess ?
There are no examples of doing so and i'm very confused how to correctly work/use Noesis::INotify , INotifyPropertyChanged for it.
As i need somehow tell to gui - ListBox that data has to be inserted .
In old fashioned way After Socket Read Data, i'm calling a CALLBACK* NOTIFYPROC function with data and packeID on stack like so
Code: Select all
m_pNotifyProc((LPVOID)pCMainFrame, pData, Code);
That is executing/Notifying MainFrame of MFC ui.
Code: Select all
void CALLBACK CMainFrame::NotifyProc(LPVOID lpParam, Context *pData, UINT Code)
{
}
Code: Select all
g_View1 = (View1*)((CApp *)AfxGetApp())->m_View1;
Code: Select all
switch (Code)
{
case CONNECT:
g_View1 ->PostMessage(WM_ADDTOLIST, 0, (LPARAM)pData);
}
How can i do this in NoesisGui - Access xaml item's/Views(Like TabItem, ListBox) of static Noesis::IView* _view ?
Create a Notify/Subscription , something like this where itemsSource = pData And FilterPredicate is TabItem1::OnAddToList
Code: Select all
Noesis::INotifyCollectionChanged* notify = Noesis::DynamicCast<Noesis::INotifyCollectionChanged*>(itemsSource);
notify->CollectionChanged() += MakeDelegate(this, &FilterPredicate::OnItemsChanged);
Last edited by slight on 01 Oct 2020, 00:50, edited 1 time in total.
Re: C++ TCP server Integration correct use of NotifyEvent Subscription
I assume you read the DataBinding tutorial, did you?
Re: C++ TCP server Integration correct use of NotifyEvent Subscription
Yes i did and i read https://www.noesisengine.com/docs/Gui.C ... Guide.htmlI assume you read the DataBinding tutorial, did you?
with this example
Code: Select all
Slider* slider = view->GetContent()->FindName<Slider>("Luminance");
slider->ValueChanged() += &LuminanceChanged;
I'm using IntegrationGLUT example, and need a correct way to access XAML items(TabItem, ListBox,ComboBox,etc ) -> members , so i can transmit data that was received on tcp/socket,
Re: C++ TCP server Integration correct use of NotifyEvent Subscription
You have two options:
- The recommended one is using databinding and MVVM. Almost all our examples follow this approach.
- Give names to required controls in XAML, get access to them by code using FindName and update corresponding properties,
Re: C++ TCP server Integration correct use of NotifyEvent Subscription
databinding and mvvm can be used for IntegrationGLUT ?You have two options:
- The recommended one is using databinding and MVVM. Almost all our examples follow this approach.
- Give names to required controls in XAML, get access to them by code using FindName and update corresponding properties,
Re: C++ TCP server Integration correct use of NotifyEvent Subscription
Yes, IntegrationGLUT is a minimal example using NoesisGUI. DataBinding is part of the core architecture of NoesisGUI.
Who is online
Users browsing this forum: No registered users and 1 guest