Skip to content

Commit

Permalink
Added : trigger autoinject option from tray context menu
Browse files Browse the repository at this point in the history
  • Loading branch information
eliboa committed Jul 24, 2018
1 parent 7b9b222 commit 763ddd3
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 1 deletion.
7 changes: 7 additions & 0 deletions TegraRcmGUI/TegraRcm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ void TegraRcm::ShowContextMenu(HWND hWnd)
HMENU hMenu = CreatePopupMenu();
if (hMenu)
{

CString autoinjectLb;
if (AUTOINJECT_CURR) autoinjectLb = _T("Auto inject (On)");
else autoinjectLb = _T("Auto inject (Off)");
InsertMenu(hMenu, -1, MF_BYPOSITION, SWM_AUTOINJECT, autoinjectLb);

if (m_RC == 0)
{

Expand Down Expand Up @@ -219,6 +225,7 @@ void TegraRcm::ShowContextMenu(HWND hWnd)
mii.dwTypeData = _T("Favorites");

CString csPathf, csFilename, payload;

m_Ctrltb1->GetDlgItem(PAYLOAD_PATH)->GetWindowTextW(csPathf);
int nIndex = csPathf.ReverseFind(_T('\\'));
if (nIndex > 0)
Expand Down
Binary file modified TegraRcmGUI/TegraRcmGUI.rc
Binary file not shown.
27 changes: 27 additions & 0 deletions TegraRcmGUI/TegraRcmGUIDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ BEGIN_MESSAGE_MAP(CTegraRcmGUIDlg, CDialog)
ON_COMMAND(SWM_FAV08, InjectFav08Command)
ON_COMMAND(SWM_FAV09, InjectFav09Command)
ON_COMMAND(SWM_FAV10, InjectFav10Command)
ON_COMMAND(SWM_AUTOINJECT, AutoInjectCommand)
END_MESSAGE_MAP()

//
Expand Down Expand Up @@ -365,6 +366,32 @@ void CTegraRcmGUIDlg::InjectFavCommand(int i)
}
}

void CTegraRcmGUIDlg::AutoInjectCommand()
{
if (m_TegraRcm != NULL)
{
DialogTab03 *pt = (DialogTab03*)m_TegraRcm->m_Ctrltb3;
if (m_TegraRcm->AUTOINJECT_CURR)
{
m_TegraRcm->AUTOINJECT_CURR = FALSE;
m_TegraRcm->SetPreset("AUTO_INJECT", "FALSE");
m_TegraRcm->DELAY_AUTOINJECT = FALSE;
CButton *m_ctlCheck = (CButton*)pt->GetDlgItem(AUTO_INJECT);
m_ctlCheck->SetCheck(BST_UNCHECKED);
}
else
{
m_TegraRcm->AUTOINJECT_CURR = TRUE;
m_TegraRcm->SetPreset("AUTO_INJECT", "TRUE");
m_TegraRcm->DELAY_AUTOINJECT = TRUE;
CButton *m_ctlCheck = (CButton*)pt->GetDlgItem(AUTO_INJECT);
m_ctlCheck->SetCheck(BST_CHECKED);
}
AfxGetMainWnd()->UpdateWindow();
pt->OnClickedAutoInject();
}
}


void CTegraRcmGUIDlg::StartTimer()
{
Expand Down
3 changes: 2 additions & 1 deletion TegraRcmGUI/TegraRcmGUIDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "TegraRcm.h"
#include "DialogTab01.h"
#include "DialogTab02.h"

#include "DialogTab03.h"


#pragma comment (lib, "setupapi.lib")
Expand Down Expand Up @@ -118,6 +118,7 @@ class CTegraRcmGUIDlg :
void InjectFav08Command();
void InjectFav09Command();
void InjectFav10Command();
void AutoInjectCommand();

CTegraRcmGUIDlg *m_pMainWnd = this;
private:
Expand Down
Binary file modified TegraRcmGUI/resource.h
Binary file not shown.

0 comments on commit 763ddd3

Please sign in to comment.