INT_PTR DecryptDatabaseDialog7::callback(HWND dialog, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message)
	{
		case WM_INITDIALOG:
		{
			SetDlgItemText(dialog, IDC_DECRYPT_CRYPT7_DATABASE, strtowstr(openDatabaseStruct.filename).c_str());
			SetDlgItemText(dialog, IDC_DECRYPT_CRYPT7_KEYFILE, strtowstr(openDatabaseStruct.keyFilename).c_str());
		} break;
		case WM_COMMAND:
		{
			switch (HIWORD(wParam))
			{
				case BN_CLICKED:
				{
					switch (LOWORD(wParam))
					{
						case IDC_DECRYPT_CRYPT7_SELECT_DATABASE:
						{
							selectDatabaseFile();
						} break;
						case IDC_DECRYPT_CRYPT7_SELECT_KEY:
						{
							selectKeyFile();
						} break;
						case IDOK:
						{
							clickOk(wParam);
							return TRUE;
						} break;
						case IDCANCEL:
						{
							close(LOWORD(wParam));
							return TRUE;
						} break;
					}
				} break;
			}
		} break;
	}

	return 0;
}
Example #2
0
int main(void)
{
    struct _tm timeCheck;

    WatchDogDisable();

    NutDelay(100);

    SysInitIO();

	SPIinit();

	LedInit();

	LcdLowLevelInit();

    Uart0DriverInit();
    Uart0DriverStart();
	LogInit();

    X12Init();

    VsPlayerInit();

    NtpInit();

    NutThreadCreate("BackgroundThread", StartupInit, NULL, 1024);
    NutThreadCreate("BackgroundThread", AlarmSync, NULL, 2500);
    NutThreadCreate("BackgroundThread", AlarmCheck, NULL, 256);

	KbInit();

    SysControlMainBeat(ON);             // enable 4.4 msecs heartbeat interrupt

    /*
     * Increase our priority so we can feed the watchdog.
     */
    NutThreadSetPriority(1);

	/* Enable global interrupts */
	sei();
	
	LcdBackLight(LCD_BACKLIGHT_ON);
    setCurrentDisplay(DISPLAY_DateTime, 5);

    X12RtcGetClock(&timeCheck);
    int hours;
    int mins;
    int secs;
    if(!NutNvMemLoad(100, &hours, sizeof(hours)))
    {
        printf("uren: %d", hours);
    }
    if(!NutNvMemLoad(105, &mins, sizeof(mins)))
    {
        printf(" minuten: %d", mins);
    }
    if(!NutNvMemLoad(110, &secs, sizeof(secs)))
    {
        printf(" seconden %d", secs);
    }
    printf("Welcome to Saltyradio.\nI'm using mac address:  %s\n\n\n", getMacAdress());

    for (;;)
    {
        //Key detecten
        if(KbGetKey() == KEY_01){
            setCurrentDisplay(DISPLAY_DateTime, 5);
        }
        else if(KbGetKey() == KEY_OK)
        {
            if(getCurrentDisplay() == DISPLAY_MainMenu)
            {
                clickOk();
            }
            else if(getCurrentDisplay() == DISPLAY_SettingsMenu)
            {
                clickOkSettings();
            }
            else if(getCurrentDisplay() == DISPLAY_Play || getCurrentDisplay() == DISPLAY_Song)
            {
                clickOkPlay();
            }
            else
            {
                setCurrentDisplay(DISPLAY_MainMenu, 10000);
            }
        }
        else if(KbGetKey() == KEY_LEFT)
        {
            switchLeft();
        }
        else if(KbGetKey() == KEY_RIGHT)
        {
            switchItem();
        }
        else if(KbGetKey() == KEY_DOWN){
            setCurrentDisplay(DISPLAY_Volume, 5);
            volumeDown();
        }else if(KbGetKey() == KEY_UP) {
            setCurrentDisplay(DISPLAY_Volume, 5);
            volumeUp();
        }
        refreshScreen();
        WatchDogRestart();
        NutSleep(100);
    }
    return(0);
}