slight
Topic Author
Posts: 3
Joined: 30 Sep 2020, 22:54

C++ TCP server Integration correct use of NotifyEvent Subscription

01 Oct 2020, 00:22

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
m_pNotifyProc((LPVOID)pCMainFrame, pData, Code);

That is executing/Notifying MainFrame of MFC ui.
void  CALLBACK CMainFrame::NotifyProc(LPVOID lpParam, Context *pData, UINT Code)
{

}
and inside this function i'm accessing global variables - View's
g_View1 = (View1*)((CApp *)AfxGetApp())->m_View1;
and depending on the Code value
switch (Code)
{
case CONNECT:
g_View1 ->PostMessage(WM_ADDTOLIST, 0, (LPARAM)pData);
}
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
  Noesis::INotifyCollectionChanged* notify = Noesis::DynamicCast<Noesis::INotifyCollectionChanged*>(itemsSource);
notify->CollectionChanged() += MakeDelegate(this, &FilterPredicate::OnItemsChanged);
i guess ?
Last edited by slight on 01 Oct 2020, 00:50, edited 1 time in total.

Tags:
 
User avatar
jsantos
Site Admin
Posts: 3014
Joined: 20 Jan 2012, 17:18
Contact:

Re: C++ TCP server Integration correct use of NotifyEvent Subscription

01 Oct 2020, 00:38

I assume you read the DataBinding tutorial, did you?
 
slight
Topic Author
Posts: 3
Joined: 30 Sep 2020, 22:54

Re: C++ TCP server Integration correct use of NotifyEvent Subscription

01 Oct 2020, 01:01

I assume you read the DataBinding tutorial, did you?
Yes i did and i read https://www.noesisengine.com/docs/Gui.C ... Guide.html
with this example
Slider* slider = view->GetContent()->FindName<Slider>("Luminance");
slider->ValueChanged() += &LuminanceChanged;
I didnt quite understand how can do so , as there are no example of integration of TCP/Socket(Packets handling etc) inside noesisgui with all that is needed.

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,
 
User avatar
jsantos
Site Admin
Posts: 3014
Joined: 20 Jan 2012, 17:18
Contact:

Re: C++ TCP server Integration correct use of NotifyEvent Subscription

01 Oct 2020, 02:40

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,
 
slight
Topic Author
Posts: 3
Joined: 30 Sep 2020, 22:54

Re: C++ TCP server Integration correct use of NotifyEvent Subscription

01 Oct 2020, 06:45

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,
databinding and mvvm can be used for IntegrationGLUT ?
 
User avatar
jsantos
Site Admin
Posts: 3014
Joined: 20 Jan 2012, 17:18
Contact:

Re: C++ TCP server Integration correct use of NotifyEvent Subscription

01 Oct 2020, 12:24

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 2 guests