Exemple #1
0
LRESULT basic_window::WndProc(HWND hWnd, INT uMsg, WPARAM wParam, LPARAM lParam)
{ 
  switch (uMsg)
  {
    case WM_CREATE:      onCreate(uMsg, wParam, lParam); break;
    case WM_COMMAND:    onCommand(uMsg, wParam, lParam); break;
    case WM_NOTIFY:      onNotify(uMsg, wParam, lParam); break;
    case WM_PAINT:        onPaint(uMsg, wParam, lParam); break;
    case WM_LBUTTONDOWN:  onClick(uMsg, wParam, lParam); break;
    case WM_RBUTTONDOWN: onRClick(uMsg, wParam, lParam); break;
    case WM_MOUSEMOVE:    onMouse(uMsg, wParam, lParam); break;    
    case WM_DESTROY:    onDestroy(uMsg, wParam, lParam); break;
    
    case WM_CLOSE:					   
    {
      PostQuitMessage(0);			// send quit message
      return 0;					      // jump back
    }
    default:           
      onOther(uMsg, wParam, lParam); 
      break;
  } 
  
  return DefProc(hWnd, uMsg, wParam, lParam);
}
void IvrPython::process(AmEvent* event){
  DBG("IvrPython processing event...\n");
  IvrScriptEvent* evt = dynamic_cast<IvrScriptEvent* >(event);
  if (evt) { // this one is for us
    DBG("IvrDialog processing event...\n");
    
    switch (evt->event_id) {
	case IvrScriptEvent::IVR_Bye: {
	  onBye(evt->req);
	}; break;
	case IvrScriptEvent::IVR_Notify: {
	    onNotify(evt->event);
	}; break;
	case IvrScriptEvent::IVR_DTMF: {
	    onDTMFEvent(evt->DTMFKey);
	}; break;
	case IvrScriptEvent::IVR_MediaQueueEmpty: {
	    onMediaQueueEmpty();
	}; break;
    }
  } else {
    ERROR("IvrPython: invalid event (non-script) received.\n");
  }
  event->processed = true;
}
void ClientWS::processMessage(JSON::Value v) {
	try {
		JSON::Value result = v["result"];
		JSON::Value error = v["error"];
		JSON::Value context = v["context"];
		JSON::Value method = v["method"];
		JSON::Value id = v["id"];
		JSON::Value params = v["params"];
		if (result != null || error != null) {
			if (id != null && !id->isNull()) {

				natural reqid = id->getUInt();
				const Promise<Result> *p = waitingResults.find(reqid);
				if (p == 0)
					onDispatchError(v);
				else {
					Promise<Result> q = *p;
					waitingResults.erase(reqid);
					if (p) {
						if (error == null || error->isNull()) {
							q.resolve(Result(result,context));
						} else {
							q.reject(RpcError(THISLOCATION,error));
						}
					}
				}
			}//id=null - invalid frame
			else {
				onDispatchError(v);
			}
		} else if (method != null && params != null) {
			if (id == null || id->isNull()) {
				onNotify(method->getStringUtf8(), params, context);
			} else {
				try {
					onIncomeRPC(method->getStringUtf8(), params,context,id);
				} catch (const RpcError &e) {
					sendResponse(id, jsonFactory->newValue(null), e.getError());
				} catch (const jsonsrv::RpcCallError &c) {
					RpcError e(THISLOCATION,jsonFactory,c.getStatus(),c.getStatusMessage());
					sendResponse(id, jsonFactory->newValue(null), e.getError());
				} catch (const std::exception &s) {
					RpcError e(THISLOCATION,jsonFactory,500,s.what());
					sendResponse(id, jsonFactory->newValue(null), e.getError());
				} catch (...) {
					RpcError e(THISLOCATION,jsonFactory,500,"fatal");
					sendResponse(id, jsonFactory->newValue(null), e.getError());
				}

			}
		}

	} catch (...) {
		onDispatchError(v);
	}

}
void PipeSubscriber<Message>::NotifyNextMessage() {
    if (targetToNotify) {
        targetToNotify->PostTask(onNotify);
        targetToNotify = nullptr;
    } else {
        onNotify();
    }
    onNotify = nullptr;
    notifyOnMessage = false;
}
void PipeSubscriber<Message>::EndBatch() {
    if (batching) {

        batching = false;

        if (notifyOnMessage) {
            if (targetToNotify) {
                targetToNotify->PostTask(onNotify);
                targetToNotify = nullptr;
            } else {
                onNotify();
            }
            onNotify = nullptr;
            notifyOnMessage = false;
        }

        onNotifyMutex.unlock();
    }
}
Exemple #6
0
void Checkout::onDoCheckout()
{
    if (!checkInputs())
        return;
    switchToPageMessages();
    saveInputValues();

    groupBoxRepository->setEnabled(false);
    buttonBox->button(QDialogButtonBox::Abort)->setVisible(true);
    buttonBox->button(QDialogButtonBox::Cancel)->setVisible(false);
    buttonBox->button(QDialogButtonBox::Ok)->setVisible(false);

    action = new QSvnClientCheckoutAction(m_selectedURL, m_selectedPath);
    connect(action, SIGNAL(notify(QString, QString)), this, SLOT(onNotify(QString, QString)));
    connect(action, SIGNAL(finished()), this, SLOT(onCheckoutFinished()));
    connect(action, SIGNAL(finished(QString)), this, SIGNAL(finished(QString)));
    connect(action, SIGNAL(doGetLogin(QString,QString,QString,bool)), this, SLOT(onGetLogin(QString,QString,QString,bool)));
    connect(action, SIGNAL(doGetSslServerTrustPrompt()), this, SLOT(onGetSslServerTrustPrompt()));
    connect(buttonBox->button(QDialogButtonBox::Abort), SIGNAL(clicked()), action, SLOT(cancelAction()));
    action->start();
}
Exemple #7
0
// when a method is sent, check what it wants to do and call the appropriate function.
void
handle_method_call(GDBusConnection *connection,
                   const gchar *sender,
                   const gchar *object_path,
                   const gchar *interface_name,
                   const gchar *method_name,
                   GVariant *parameters,
                   GDBusMethodInvocation *invocation, gpointer user_data)
{
    if (g_strcmp0(method_name, "GetCapabilities") == 0) {
        onGetCapabilities(connection, sender, parameters, invocation);
    } else if (g_strcmp0(method_name, "Notify") == 0) {
        onNotify(connection, sender, parameters, invocation);
    } else if (g_strcmp0(method_name, "CloseNotification") == 0) {
        onCloseNotification(connection, sender, parameters, invocation);
    } else if (g_strcmp0(method_name, "GetServerInformation") == 0) {
        onGetServerInformation(connection, sender, parameters, invocation);
    } else {
        printf("WARNING: sender: %s; unknown method_name: %s\n", sender, method_name);
    }
}
Exemple #8
0
bool IEToolbar::processSiteWindowMessage(const UINT message,
                                         const WPARAM wParam,
                                         const LPARAM lParam,
                                         LRESULT& lResult) {
  switch (message) {
  case WM_COMMAND:
    return onCommand(wParam);
  case WM_NOTIFY:
    return onNotify(wParam, *(LPNMHDR)lParam, lResult);
  case TBM_DATA_CHANGED:
    dataUpdated(wParam);
    return true;
  case TBM_COOKIES: {
    UNREFERENCED_PARAMETER(lParam);
    String cookie = String((Char*)wParam);
    UserDataObserver::getInstance().setSession(cookie);
    return true;
  }
  default:
    return false;
  }
}
Exemple #9
0
bool BaseWindow::wndProc(UINT message, WPARAM wParam, LPARAM lParam)
{
  switch (message) {
    case WM_COMMAND:
      return onCommand(wParam, lParam);
    case WM_NOTIFY:
      return onNotify((int)wParam, (LPNMHDR)lParam);
    case WM_SYSCOMMAND:
      return onSysCommand(wParam, lParam);
    case WM_LBUTTONDOWN:
    case WM_LBUTTONUP:
    case WM_MBUTTONDOWN:
    case WM_MBUTTONUP:
    case WM_RBUTTONDOWN:
    case WM_RBUTTONUP:
    case WM_MOUSEWHEEL:
    case WM_MOUSEMOVE:
    {
      unsigned char mouseButtons = 0;

      mouseButtons |= LOWORD(wParam) & MK_RBUTTON ? MOUSE_RDOWN : 0;
      mouseButtons |= LOWORD(wParam) & MK_MBUTTON ? MOUSE_MDOWN : 0;
      mouseButtons |= LOWORD(wParam) & MK_LBUTTON ? MOUSE_LDOWN : 0;

      // Translate position from LPARAM to POINT.
      POINTS points = MAKEPOINTS(lParam);
      POINT point;
      point.x = points.x;
      point.y = points.y;

      unsigned short wheelSpeed = 0; 
      if (message == WM_MOUSEWHEEL) {
        // Get speed wheel and set mouse button.
        signed short wheelSignedSpeed = static_cast<signed short>(HIWORD(wParam));
        if (wheelSignedSpeed < 0) {
          mouseButtons |= MOUSE_WDOWN;
          wheelSpeed = - wheelSignedSpeed / WHEEL_DELTA;
        } else {
          mouseButtons |= MOUSE_WUP;
          wheelSpeed = wheelSignedSpeed / WHEEL_DELTA;
        }

        // In some cases wheelSignedSpeed can be smaller than the WHEEL_DELTA,
        // then wheelSpeed set to 1, but not 0.
        if (wheelSpeed == 0) {
          wheelSpeed = 1;
        }

        // If windows-message is WHEEL, then need to translate screen coordinate to client.
        if (!ScreenToClient(getHWnd(), &point)) {
          point.x = -1;
          point.y = -1;
        }
      }

      // Notify window about mouse-event.
      return onMouse(mouseButtons, static_cast<unsigned short>(wheelSpeed), point);
    }
  }
  return onMessage(message, wParam, lParam);
}
Exemple #10
0
void TimerThread::onResume() {
	onNotify();
}
void ClientWS::onConnect() {
	if (dispatcher!=null && !connectMethod.empty()) {
		onNotify(connectMethod,jsonFactory->array(),null);
	}
	Super::onConnect();
}