Minor changes
authorVictor Kirhenshtein <victor@netxms.org>
Thu, 26 Jul 2007 07:41:26 +0000 (07:41 +0000)
committerVictor Kirhenshtein <victor@netxms.org>
Thu, 26 Jul 2007 07:41:26 +0000 (07:41 +0000)
src/client/console/libnxmc/nxview.cpp
src/client/console/libnxmc/nxview.h
src/client/console/plugins/AlarmBrowser/view.cpp

index 3f076ba..75b7d4e 100644 (file)
 #include "libnxmc.h"
 
 
+//
+// Constants
+//
+
+#define RQ_TIMER_ID            1000
+
+
 //
 // Event table
 //
 
 BEGIN_EVENT_TABLE(nxView, wxWindow)
+       EVT_TIMER(RQ_TIMER_ID, nxView::OnTimer)
 END_EVENT_TABLE()
 
 
@@ -40,6 +48,7 @@ nxView::nxView(wxWindow *parent)
        : wxWindow(parent, wxID_ANY,  wxDefaultPosition, wxDefaultSize)
 {
        m_icon = wxNullBitmap;
+       m_timer = new wxTimer(this, RQ_TIMER_ID);
 }
 
 
@@ -49,6 +58,7 @@ nxView::nxView(wxWindow *parent)
 
 nxView::~nxView()
 {
+       delete m_timer;
 }
 
 
@@ -71,3 +81,90 @@ wxString nxView::GetLabel() const
        return m_label;
 }
 
+
+//
+// Request processing thread
+//
+
+static THREAD_RESULT THREAD_CALL RequestThread(void *arg)
+{
+   RqData *data = (RqData *)arg;
+   DWORD dwResult;
+
+       switch(data->dwNumParams)
+       {
+               case 0:
+                       dwResult = data->func();
+                       break;
+               case 1:
+                       dwResult = data->func(data->arg1);
+                       break;
+               case 2:
+                       dwResult = data->func(data->arg1, data->arg2);
+                       break;
+               case 3:
+                       dwResult = data->func(data->arg1, data->arg2, data->arg3);
+                       break;
+               case 4:
+                       dwResult = data->func(data->arg1, data->arg2, data->arg3, data->arg4);
+                       break;
+               case 5:
+                       dwResult = data->func(data->arg1, data->arg2, data->arg3, 
+                                                                                       data->arg4, data->arg5);
+                       break;
+               case 6:
+                       dwResult = data->func(data->arg1, data->arg2, data->arg3, 
+                                                                                       data->arg4, data->arg5, data->arg6);
+                       break;
+               case 7:
+                       dwResult = data->func(data->arg1, data->arg2, data->arg3, 
+                                                                                       data->arg4, data->arg5, data->arg6,
+                                                                                       data->arg7);
+               case 8:
+                       dwResult = data->func(data->arg1, data->arg2, data->arg3, 
+                                                                                       data->arg4, data->arg5, data->arg6,
+                                                                                       data->arg7, data->arg8);
+               case 9:
+                       dwResult = data->func(data->arg1, data->arg2, data->arg3, 
+                                                                                       data->arg4, data->arg5, data->arg6,
+                                                                                       data->arg7, data->arg8, data->arg9);
+                       break;
+       }
+       if (data->hWnd != NULL)
+               PostMessage(data->hWnd, NXCM_REQUEST_COMPLETED, data->wParam, dwResult);
+       if (data->bDynamic)
+               free(data);
+   return dwResult;
+}
+
+
+//
+// Execute async request
+//
+
+DWORD nxView::DoRequest(RqData *data)
+{
+       m_timer->Start(300, true);
+       ThreadCreate(RequestThread, 0, data);
+}
+
+DWORD nxView::DoRequestArg1(void *func, void *arg1)
+{
+   RqData rqData;
+
+   rqData.hWnd = NULL;
+       rqData.isDynamic = false;
+   rqData.numParams = 1;
+   rqData.arg1 = arg1;
+   rqData.func = (DWORD (*)(...))func;
+   return ExecuteRequest(&rqData, pszInfoText);
+}
+
+
+//
+// Timer event handler
+//
+
+void OnTimer(wxTimerEvent &event)
+{
+}
index 2a96ab9..0087d37 100644 (file)
@@ -29,6 +29,7 @@ class LIBNXMC_EXPORTABLE nxView : public wxWindow
 private:
        wxString m_label;
        wxBitmap m_icon;        // Icon associated with this view
+       wxTimer *m_timer;
 
 public:
        nxView(wxWindow *parent);
@@ -41,6 +42,8 @@ public:
 
        // Event handlers
 protected:
+       void OnTimer(wxTimerEvent &event);
+
        DECLARE_EVENT_TABLE()
 };
 
index 12b1d03..28741fb 100644 (file)
@@ -324,6 +324,6 @@ void nxAlarmView::OnAlarmChange(wxCommandEvent &event)
 
 void nxAlarmView::OnAlarmAck(wxCommandEvent &event)
 {
-wxLogDebug("ACK");
+//     NXCAcknowledgeAlarm(NXMCGetSession(), m_wndListCtrl->GetItemData(m_wndListCtrl->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED)));
 }