Skip to content

Commit f05b799

Browse files
author
Linnea May
committed
formatting and remove dummy call to learningmodelbuilder
1 parent eb0fed9 commit f05b799

File tree

6 files changed

+32
-53
lines changed

6 files changed

+32
-53
lines changed

Samples/WinMLSamplesGallery/WinMLSamplesGallery/Samples/EncryptedModel/EncryptedModel.xaml.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@ public EncryptedModel()
3232
this.InitializeComponent();
3333
initialized_ = true;
3434

35-
// TODO: Currently the WinMLSamplesGalleryNative component will load
36-
// the wrong version of the Microsoft.AI.MachineLearning.dll.
37-
// To work around this, we make a dummy call to the builder to
38-
// ensure that the dll is loaded.
39-
var builder = Microsoft.AI.MachineLearning.Experimental.LearningModelBuilder.Create(11);
40-
4135
// Initialize the sample with the decrypted model
4236
DecryptAndEvauluate();
4337
}

Samples/WinMLSamplesGallery/WinMLSamplesGallery/Samples/StreamEffect/StreamEffect.xaml.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,9 @@ public sealed partial class StreamEffect : Page
3030
public StreamEffect()
3131
{
3232
this.InitializeComponent();
33-
// TODO: Currently the WinMLSamplesGalleryNative component will load
34-
// the wrong version of the Microsoft.AI.MachineLearning.dll.
35-
// To work around this, we make a dummy call to the builder to
36-
// ensure that the dll is loaded.
37-
var builder = Microsoft.AI.MachineLearning.Experimental.LearningModelBuilder.Create(11);
3833
demoHwnd = (IntPtr)WinMLSamplesGalleryNative.StreamEffect.CreateInferenceWindow();
3934

4035
currentHwnd = GetForegroundWindow();
41-
//var modelName = "mosaic.onnx";
4236
modelPath = Path.Join(Windows.ApplicationModel.Package.Current.InstalledLocation.Path, "Models");
4337

4438
}
@@ -78,8 +72,6 @@ async private void ToggleInference(object sender, RoutedEventArgs e)
7872

7973
}
8074
}
81-
82-
8375
}
8476

8577
}

Samples/WinMLSamplesGallery/WinMLSamplesGalleryNative/External/CSampleQueue.h

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ class CSampleQueue: public IUnknown
1212
public:
1313
class ILockedSample;
1414

15-
static HRESULT Create(
16-
CSampleQueue** ppQueue
17-
);
15+
static HRESULT Create(CSampleQueue** ppQueue);
1816

1917
#pragma region IUnknown
2018
// IUnknown Implementations
@@ -26,26 +24,23 @@ class CSampleQueue: public IUnknown
2624
ULONG __stdcall Release();
2725
#pragma endregion IUnknown
2826

29-
// ILockedSampleCallback Implementation
30-
31-
HRESULT AddSample( // Add a sample to the back of the queue
32-
IMFSample* pSample
33-
);
34-
HRESULT GetNextSample( // Remove a sample from the front of the queue
35-
IMFSample** pSample
36-
);
37-
HRESULT RemoveAllSamples();
38-
HRESULT MarkerNextSample(
39-
const ULONG_PTR pulID
40-
);
41-
bool IsQueueEmpty();
42-
43-
ULONG GetLength();
27+
// ILockedSampleCallback Implementation
28+
HRESULT AddSample( // Add a sample to the back of the queue
29+
IMFSample* pSample
30+
);
31+
HRESULT GetNextSample( // Remove a sample from the front of the queue
32+
IMFSample** pSample
33+
);
34+
HRESULT RemoveAllSamples();
35+
HRESULT MarkerNextSample(const ULONG_PTR pulID);
36+
bool IsQueueEmpty();
37+
38+
ULONG GetLength();
4439
protected:
45-
class CNode;
40+
class CNode;
4641

47-
CSampleQueue();
48-
~CSampleQueue();
42+
CSampleQueue();
43+
~CSampleQueue();
4944

5045
volatile ULONG m_ulRef;
5146
CNode* m_pHead;
@@ -60,8 +55,6 @@ class CSampleQueue: public IUnknown
6055
class CSampleQueue::ILockedSample
6156
{
6257
public:
63-
virtual HRESULT GetSample(
64-
IMFSample** ppSample
65-
) = 0;
66-
virtual HRESULT Unlock() = 0;
58+
virtual HRESULT GetSample(IMFSample** ppSample) = 0;
59+
virtual HRESULT Unlock() = 0;
6760
};

Samples/WinMLSamplesGallery/WinMLSamplesGalleryNative/Resource.rc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ END
6060

6161
IDR_MENU1 MENU
6262
BEGIN
63-
POPUP "Capture"
63+
POPUP "Start"
6464
BEGIN
65-
MENUITEM "Choose Device", ID_CAPTURE_CHOOSEDEVICE
66-
MENUITEM "Start Preview", ID_CAPTURE_PREVIEW
65+
MENUITEM "Choose Device", ID_START_CHOOSEDEVICE
66+
MENUITEM "Start Preview", ID_START_PREVIEW
6767
END
6868
END
6969

Samples/WinMLSamplesGallery/WinMLSamplesGalleryNative/StreamEffect.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,11 @@ namespace MainWindow
174174
previewing = g_engine->IsPreviewing();
175175
if (previewing)
176176
{
177-
_SetStatusText(L"Loading...");
178-
EnableMenuItem(GetMenu(hwnd), ID_CAPTURE_PREVIEW, MF_DISABLED);
177+
EnableMenuItem(GetMenu(hwnd), ID_START_PREVIEW, MF_DISABLED);
179178
}
180179
else
181180
{
182-
SetMenuItemText(GetMenu(hwnd), ID_CAPTURE_PREVIEW, L"Start Preview");
181+
SetMenuItemText(GetMenu(hwnd), ID_START_PREVIEW, L"Start Preview");
183182
}
184183
}
185184
else if (g_engine->IsPreviewing())
@@ -188,6 +187,7 @@ namespace MainWindow
188187
}
189188
else
190189
{
190+
191191
_SetStatusText(L"Please select a device or start preview (using the default device).");
192192
}
193193
}
@@ -326,23 +326,26 @@ namespace MainWindow
326326
ShowError(hwnd, IDS_ERR_CAPTURE, hr);
327327
}
328328
UpdateUI(hwnd);
329+
_SetStatusText(L"Loading...");
330+
329331
}
330332

331333
void OnCommand(HWND hwnd, int id, HWND /*hwndCtl*/, UINT /*codeNotify*/)
332334
{
333335
switch (id)
334336
{
335-
case ID_CAPTURE_CHOOSEDEVICE:
337+
case ID_START_CHOOSEDEVICE:
336338
OnChooseDevice(hwnd);
337339
break;
338340

339-
case ID_CAPTURE_PREVIEW:
341+
case ID_START_PREVIEW:
340342
if (g_engine->IsPreviewing())
341343
{
342344
OnStopPreview(hwnd);
343345
}
344346
else
345347
{
348+
_SetStatusText(L"Loading...");
346349
OnStartPreview(hwnd);
347350
}
348351
break;
@@ -358,10 +361,7 @@ namespace MainWindow
358361
HANDLE_MSG(hwnd, WM_PAINT, OnPaint);
359362
HANDLE_MSG(hwnd, WM_SIZE, OnSize);
360363
HANDLE_MSG(hwnd, WM_DESTROY, OnDestroy);
361-
//HANDLE_MSG(hwnd, WM_CLOSE, OnClose);
362364
HANDLE_MSG(hwnd, WM_COMMAND, OnCommand);
363-
/*case WM_CLOSE:
364-
DestroyWindow(hwnd);*/
365365
case WM_ERASEBKGND:
366366
return 1;
367367

Samples/WinMLSamplesGallery/WinMLSamplesGalleryNative/resource.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
#define IDS_ERR_CAPTURE 109
1515
#define IDC_DEVICE_LIST 1004
1616
#define IDC_STATUS_BAR 1005
17-
#define ID_CAPTURE_CHOOSEDEVICE 40001
18-
#define ID_CAPTURE_STARTPREVIEW 40002
19-
#define ID_CAPTURE_PREVIEW 40003
17+
#define ID_START_CHOOSEDEVICE 40001
18+
#define ID_START_STARTPREVIEW 40002
19+
#define ID_START_PREVIEW 40003
2020
#define IDD_CHOOSE_DEVICE 40003
2121

2222
// Next default values for new objects

0 commit comments

Comments
 (0)