Project

General

Profile

Support #3617 ยป quit.cpp

Koen Deforche, 10/16/2014 07:06 PM

 
#include <Wt/WApplication>
#include <Wt/WLabel>
#include <Wt/WPushButton>
#include <Wt/WContainerWidget>
#include <Wt/WIOService>
#include <Wt/WServer>
#include <Wt/WText>
#include <Wt/WTemplate>
#include <iostream>

using namespace Wt;

class Test : public WApplication
{
public:
Test(const WEnvironment& env)
: WApplication(env)
{
new WPushButton("test", root());
Wt::WServer::instance()->ioService()
.schedule(1000, boost::bind(&Test::doit, this));

enableUpdates();
}

void doit() {
Wt::WServer::instance()->post(sessionId(),
[=]()
{
redirect("http://www.emweb.be/");
quit();
triggerUpdate();
});
}

void foo() {
std::cerr << "Got click" << std::endl;
}
};

WApplication *createApplication(const WEnvironment& env){
return new Test(env);
}

int main(int argc, char *argv[]){
return WRun(argc, argv, createApplication);
}

    (1-1/1)