Beispiel #1
0
/* Save preferences, close forms, close app database */
static void StopApplication(void)
{
        SavePrefs();
        EQDrain();
        FrmSaveAllForms();
        FrmCloseAllForms();
}
Beispiel #2
0
/* Save preferences, close forms, close app database */
static void StopApplication(void)
{
    PrefSetAppPreferences('StWt', 0, stopWatchPrefVersionNum,
            &stopWatchPrefs, sizeof(stopWatchPreferenceType), true);
    FrmSaveAllForms();
    FrmCloseAllForms();
}
Beispiel #3
0
void StopApplication(void)
{
    if (EditAutoDraw == EditAutoDraw) {} 
           GM_OnTerminate(NULL);
	FrmSaveAllForms();
	FrmCloseAllForms();
}
Beispiel #4
0
/* Save preferences, close forms, close app database */
static void StopApplication(void)
{
  SaveCubes();
  FrmSaveAllForms();
  FrmCloseAllForms();
}
Beispiel #5
0
/***********************************************************************
 * main function
 ***********************************************************************/
UInt32
PilotMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags)
{
  UInt16 error = RomVersionCompatible (MINVERSION, launchFlags);
  if (error) return (error);

  /***
  * NORMAL STARTUP
  ****/
  if ( cmd == sysAppLaunchCmdNormalLaunch ) {
    error = StartApplication ();
    if (error) {
      // PalmOS before 3.5 will continuously relaunch this app unless we switch to
      // another safe one.
      if (error != dmErrCorruptDatabase) {
        FrmCustomAlert(ALERT_debug, "Please reports this bug! Give your Palm device and PalmOS version, this BadBug(TM) should not happen.", "", "");
      }
      StopApplication();
      AppLaunchWithCommand(sysFileCDefaultApp, sysAppLaunchCmdNormalLaunch, NULL);
      return error;
    }

    FrmGotoForm(FORM_main);

    AppEventLoop ();
    StopApplication ();

    /***
     * FIND
     ****/
    /*
      } else if (cmd == sysAppLaunchCmdSaveData) {
      FrmSaveAllForms();
      } else if (cmd == sysAppLaunchCmdFind) {
      PalmGlobalFind((FindParamsPtr)cmdPBP);
    */

    /***
     * GoTo
     ****/
    /*
      } else if (cmd == sysAppLaunchCmdGoTo) {
      Boolean launched = launchFlags & sysAppLaunchFlagNewGlobals;
	
      if (launched) {
      error = StartApplication();
      if (! error) {
      GoToItem((GoToParamsPtr)cmdPBP, launched);
      AppEventLoop();
      StopApplication();
      }
      } else {
      GoToItem((GoToParamsPtr)cmdPBP, launched);
      }
    */

    /***
     * BEAMING
     ****/
  } else if (cmd == sysAppLaunchCmdSyncNotify) {
    // Register with the Exchange Manager
    ExgRegisterData(APP_CREATOR, exgRegExtensionID, "umx");
  } else if (cmd == sysAppLaunchCmdExgAskUser) {
    // Always assume "Yes" as answer to the accept dialog since we display our
    // own on which the user can cancel the data
    ExgAskParamType *exgAskParam = (ExgAskParamType *)cmdPBP;
    exgAskParam->result=exgAskOk;
  } else if (cmd == sysAppLaunchCmdExgReceiveData) {
    DmOpenRef cats=NULL, dogs=NULL;
    // Is app active?
    if (launchFlags & sysAppLaunchFlagSubCall) {
      // Quit Forms
      FrmSaveAllForms();

      cats = DatabaseGetRefN(DB_MAIN);
      dogs = DatabaseGetRefN(DB_DATA);
      error = BeamReceive(cats, dogs, (ExgSocketPtr) cmdPBP);
      CacheReset();
      FrmGotoForm(FORM_main);

    } else {
      // Another app was running when we were called
      cats = DmOpenDatabaseByTypeCreator(DATABASE_TYPE, APP_CREATOR, dmModeReadWrite);
      dogs = DmOpenDatabaseByTypeCreator(DATABASE_DATA_TYPE, APP_CREATOR, dmModeReadWrite);
      if (! (cats && dogs)) {
        FrmAlert(ALERT_beamdbfail);
      } else {
        error=BeamReceive(cats, dogs, (ExgSocketPtr)cmdPBP);
      }
      if (cats)  DmCloseDatabase(cats);
      if (dogs)  DmCloseDatabase(dogs);
    }

    /***
     * ALARM
     ****/
  } else if (cmd == sysAppLaunchCmdAlarmTriggered) {
    // Is app active?
    if (launchFlags & sysAppLaunchFlagSubCall) {
      AlarmTriggered(DatabaseGetRefN(DB_MAIN), (SysAlarmTriggeredParamType *)cmdPBP);
    } else {
      DmOpenRef cats = DmOpenDatabaseByTypeCreator(DATABASE_TYPE, APP_CREATOR, dmModeReadWrite);
      AlarmTriggered(cats, (SysAlarmTriggeredParamType *)cmdPBP);
      DmCloseDatabase(cats);
    }

    /***
     * ATTENTION
     ****/
  } else if (cmd == sysAppLaunchCmdAttention) {
    // Is app active?
    if (launchFlags & sysAppLaunchFlagSubCall) {
      AttentionBottleNeckProc(DatabaseGetRefN(DB_MAIN), (AttnLaunchCodeArgsType *)cmdPBP);
    } else {
      // Another app was running when we were called
      DmOpenRef cats = DmOpenDatabaseByTypeCreator(DATABASE_TYPE, APP_CREATOR, dmModeReadWrite);
      AttentionBottleNeckProc(cats, (AttnLaunchCodeArgsType *)cmdPBP);
      DmCloseDatabase(cats);
    }

    /***
     * ATTENTION GOTO
     ****/
  } else if (cmd == appLaunchCmdAlarmEventGoto) {
    error = StartApplication ();
    if (error) {
      // PalmOS before 3.5 will continuously relaunch this app unless we switch to
      // another safe one.
      if (error != dmErrCorruptDatabase) {
        FrmCustomAlert(ALERT_debug, "Please reports this bug! Give your Palm device and PalmOS version, this BadBug(TM) should not happen.", "", "");
      }
      StopApplication();
      AppLaunchWithCommand(sysFileCDefaultApp, sysAppLaunchCmdNormalLaunch, NULL);
      return error;
    }

    ExamSetGoto(*(UInt32 *)cmdPBP);
    FrmGotoForm(FORM_exams);

    AppEventLoop ();
    StopApplication ();


  /***
  * TIME CHANGE
  ****/
  // Launch code sent when the system time is changed.
  } else if (cmd == sysAppLaunchCmdTimeChange) {
    // reset the trigger for the next alarm to fire
    if (launchFlags & sysAppLaunchFlagSubCall) {
      AlarmReset(DatabaseGetRefN(DB_MAIN));
      // Remove any "future" alarms from the attention manager queue
      // (ie alarms that will trigger after the new time setting)
      //AlarmUpdatePosted(DeviceTimeChanged);
    } else {
      // Another app was running when we were called
      DmOpenRef cats = DmOpenDatabaseByTypeCreator(DATABASE_TYPE, APP_CREATOR, dmModeReadWrite);
      if (cats != 0) {
        AlarmReset(cats);
        //AlarmUpdatePosted(DeviceTimeChanged);
        DmCloseDatabase(cats);
      }
    }
    
  
  /***
  * RESET
  ****/
  // This action code is sent after the system is reset.
  } else if (cmd == sysAppLaunchCmdSystemReset) {
    if (! ((SysAppLaunchCmdSystemResetType*)cmdPBP)->hardReset) {
      if (launchFlags & sysAppLaunchFlagSubCall) {
        AlarmReset(DatabaseGetRefN(DB_MAIN));
      } else {
        // Another app was running when we were called
        DmOpenRef cats = DmOpenDatabaseByTypeCreator(DATABASE_TYPE, APP_CREATOR, dmModeReadWrite);
        if (cats != 0) {
          AlarmReset(cats);
          DmCloseDatabase(cats);
        }
      }
    }

  }

  return 0;
}