예제 #1
0
void Server_Salvage_OnEndTask_EnumServers (HWND hDlg, LPIDENT lpi, LPTASKPACKET ptp)
{
   // We'll only fill the Servers list once, and that during initialization.
   // When the filling completes, find out what server is currently selected
   // (it should already be the one the user chose earlier), and fill the
   // aggregates list for it. We won't enable anything yet.
   //
   LPIDENT lpiServer;
   if ((lpiServer = (LPIDENT)CB_GetSelectedData (GetDlgItem (hDlg, IDC_SERVER))) != NULL)
      {
      LPAGG_ENUM_TO_COMBOBOX_PACKET lpp = New (AGG_ENUM_TO_COMBOBOX_PACKET);
      memset (lpp, 0x00, sizeof(AGG_ENUM_TO_COMBOBOX_PACKET));
      lpp->hCombo = GetDlgItem (hDlg, IDC_AGGREGATE);
      lpp->lpiServer = lpiServer;
      lpp->lpiSelect = (lpi && (!lpi->fIsCell()) && (!lpi->fIsServer()) && (lpiServer == lpi->GetServer())) ? (lpi->GetAggregate()) : NULL;
      StartTask (taskAGG_ENUM_TO_COMBOBOX, hDlg, lpp);
      }
}
예제 #2
0
void DispatchNotification_MainThread (NOTIFYEVENT evt, PNOTIFYPARAMS pParams)
{
   LPIDENT lpiEvt = pParams->lpi1;

   // There are several notifications which are sent when beginning or ending
   // lengthy operations.  These "actions" each get a window indicating
   // progress, and get added to our ongoing list of actions-in-progress.
   //
   ActionNotification_MainThread (evt, pParams);

   // The real reason for this routine is as a dispatcher for the AFSClass's
   // notifications: various windows throughout the app register themselves
   // with this dispatcher, and thereby get a message whenever a particular
   // event of interest to that window happens.  Just what notifications
   // are "of interest" is specified by the window when it registers with
   // this dispatcher.
   //
   for (size_t iDispatch = 0; iDispatch < nDispatchList; ++iDispatch)
      {
      if (!aDispatchList[ iDispatch ].hWnd)
         continue;

      BOOL fDispatch = FALSE;

      // WHEN_CELL_OPENED + NULL      -> notify if any new cell is opened
      // WHEN_OBJECT_CHANGES + NULL   -> notify if anything at all changes
      // WHEN_OBJECT_CHANGES + lpi    -> notify if this object changes
      // WHEN_SVCS(etc)_CHANGE + NULL -> notify if any service at all changes
      // WHEN_SVCS(etc)_CHANGE + lpi  -> notify if any svc on this svr changes

      switch (aDispatchList[ iDispatch ].when)
         {
         case WHEN_CELL_OPENED:
            if (evt == evtCreate && lpiEvt->fIsCell())
               fDispatch = TRUE;
            break;

         case WHEN_OBJECT_CHANGES:
            if ( (aDispatchList[ iDispatch ].lpiObject == lpiEvt) ||
                 (aDispatchList[ iDispatch ].lpiObject == NULL) )
               {
               if (evt != evtCreate)
                  fDispatch = TRUE;
               }
            break;

         case WHEN_SVRS_CHANGE:
            switch (evt)
               {
               case evtInvalidate:
               case evtRefreshServersBegin:
               case evtRefreshServersEnd:
                  if ( (lpiEvt && lpiEvt->fIsCell()) ||
                       (aDispatchList[ iDispatch ].lpiObject == lpiEvt) ||
                       (aDispatchList[ iDispatch ].lpiObject == NULL) )
                     {
                     if (lpiEvt && lpiEvt->fIsCell())
                        fDispatch = TRUE;
                     }
                  break;

               case evtCreate:
               case evtDestroy:
               case evtRefreshStatusBegin:
               case evtRefreshStatusEnd:
               case evtAlertsChanged:
                  if (lpiEvt && lpiEvt->fIsServer())
                     {
                     if (aDispatchList[ iDispatch ].lpiObject == NULL)
                        fDispatch = TRUE;
                     else
                        {
                        LPIDENT lpiEvtCell = lpiEvt->GetCell();

                        if (aDispatchList[ iDispatch ].lpiObject == lpiEvtCell)
                           fDispatch = TRUE;
                        }
                     }
                  break;
               }
            break;

         case WHEN_SETS_CHANGE:
            switch (evt)
               {
               case evtInvalidate:
               case evtRefreshFilesetsBegin:
               case evtRefreshFilesetsEnd:
                  {
                  LPIDENT lpiEvtSvr = NULL;
                  if (lpiEvt && !lpiEvt->fIsCell())
                     lpiEvtSvr = lpiEvt->GetServer();

                  if ( (lpiEvt && lpiEvt->fIsCell()) ||
                       (aDispatchList[ iDispatch ].lpiObject == lpiEvt)    ||
                       (aDispatchList[ iDispatch ].lpiObject == lpiEvtSvr) ||
                       (aDispatchList[ iDispatch ].lpiObject == NULL) )
                     {
                     if (lpiEvt && (lpiEvt->fIsCell() || lpiEvt->fIsServer() || lpiEvt->fIsAggregate()))
                        fDispatch = TRUE;
                     }
                  }
                  break;

               case evtCreate:
               case evtDestroy:
               case evtRefreshStatusBegin:
               case evtRefreshStatusEnd:
               case evtAlertsChanged:
                  if (lpiEvt && lpiEvt->fIsFileset())
                     {
                     if (aDispatchList[ iDispatch ].lpiObject == NULL)
                        fDispatch = TRUE;
                     else
                        {
                        LPIDENT lpiEvtAgg = lpiEvt->GetAggregate();
                        LPIDENT lpiEvtSvr = lpiEvt->GetServer();

                        if (aDispatchList[ iDispatch ].lpiObject == lpiEvtAgg)
                           fDispatch = TRUE;
                        if (aDispatchList[ iDispatch ].lpiObject == lpiEvtSvr)
                           fDispatch = TRUE;
                        }
                     }
                  break;
               }
            break;

         case WHEN_AGGS_CHANGE:
            switch (evt)
               {
               case evtRefreshAggregatesBegin:
               case evtRefreshAggregatesEnd:
                  if ( (lpiEvt && lpiEvt->fIsCell()) ||
                       (aDispatchList[ iDispatch ].lpiObject == lpiEvt) ||
                       (aDispatchList[ iDispatch ].lpiObject == NULL) )
                     {
                     if (lpiEvt && (lpiEvt->fIsCell() || lpiEvt->fIsServer()))
                        fDispatch = TRUE;
                     }
                  break;

               case evtCreate:
               case evtDestroy:
               case evtRefreshStatusBegin:
               case evtRefreshStatusEnd:
               case evtAlertsChanged:
                  if (lpiEvt && lpiEvt->fIsAggregate())
                     {
                     if (aDispatchList[ iDispatch ].lpiObject == NULL)
                        fDispatch = TRUE;
                     else
                        {
                        LPIDENT lpiEvtSvr = lpiEvt->GetServer();

                        if (aDispatchList[ iDispatch ].lpiObject == lpiEvtSvr)
                           fDispatch = TRUE;
                        }
                     }
                  break;
               }
            break;

         case WHEN_SVCS_CHANGE:
            switch (evt)
               {
               case evtRefreshServicesBegin:
               case evtRefreshServicesEnd:
                  if ( (lpiEvt && lpiEvt->fIsCell()) ||
                       (aDispatchList[ iDispatch ].lpiObject == lpiEvt) ||
                       (aDispatchList[ iDispatch ].lpiObject == NULL) )
                     {
                     if (lpiEvt && (lpiEvt->fIsCell() || lpiEvt->fIsServer()))
                        fDispatch = TRUE;
                     }
                  break;

               case evtCreate:
               case evtDestroy:
               case evtRefreshStatusBegin:
               case evtRefreshStatusEnd:
               case evtAlertsChanged:
                  if (lpiEvt && lpiEvt->fIsService())
                     {
                     if (aDispatchList[ iDispatch ].lpiObject == NULL)
                        fDispatch = TRUE;
                     else
                        {
                        LPIDENT lpiEvtSvr = lpiEvt->GetServer();

                        if (aDispatchList[ iDispatch ].lpiObject == lpiEvtSvr)
                           fDispatch = TRUE;
                        }
                     }
                  break;
               }
            break;
         }

      if (fDispatch)
         {
         LPNOTIFYSTRUCT lpns = New (NOTIFYSTRUCT);
         lpns->hwndTarget = aDispatchList[ iDispatch ].hWnd;
         lpns->evt = evt;
         memcpy (&lpns->Params, pParams, sizeof(NOTIFYPARAMS));
         lpns->Params.lpUser = aDispatchList[ iDispatch ].lpUser;

         PostMessage (aDispatchList[ iDispatch ].hWnd,
                      WM_NOTIFY_FROM_DISPATCH,
                      (WPARAM)0,
                      (LPARAM)lpns);
         }
      }
}
예제 #3
0
void Server_Salvage_OnServer (HWND hDlg, LPIDENT lpi)
{
   LPIDENT lpiServer;
   if ((lpiServer = (LPIDENT)CB_GetSelectedData (GetDlgItem (hDlg, IDC_SERVER))) != NULL)
      {
      LPAGG_ENUM_TO_COMBOBOX_PACKET lpp = New (AGG_ENUM_TO_COMBOBOX_PACKET);
      memset (lpp, 0x00, sizeof(AGG_ENUM_TO_COMBOBOX_PACKET));
      lpp->hCombo = GetDlgItem (hDlg, IDC_AGGREGATE);
      lpp->lpiServer = lpiServer;
      lpp->lpiSelect = (lpi && (!lpi->fIsCell()) && (!lpi->fIsServer()) && (lpiServer == lpi->GetServer())) ? (lpi->GetAggregate()) : NULL;
      StartTask (taskAGG_ENUM_TO_COMBOBOX, hDlg, lpp);
      }
}