#ifndef UNICODE
#define UNICODE
#endif
#include <windows.h>
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int nCmdShow)
{
// Register the window class.
const wchar_t CLASS_NAME[] = L"Sample Window Class";
WNDCLASS wc = { };
wc.lpfnWndProc = WindowProc;
wc.hInstance = hInstance;
wc.lpszClassName = CLASS_NAME;
RegisterClass(&wc);
// Create the window.
HWND hwnd = CreateWindowEx(
0, // Optional window styles.
CLASS_NAME, // Window class
L"Learn to Program Windows", // Window text
WS_OVERLAPPEDWINDOW, // Window style
// Size and position
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL, // Parent window
NULL, // Menu
hInstance, // Instance handle
NULL // Additional application data
);
if (hwnd == NULL)
{
return 0;
}
ShowWindow(hwnd, nCmdShow);
// Run the message loop.
<b> MSG msg = { };
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}</b>
return 0;
}
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
FillRect(hdc, &ps.rcPaint, (HBRUSH) (COLOR_WINDOW+1));
EndPaint(hwnd, &ps);
}
return 0;
}
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
[HttpPost]
[ProducesResponseType(StatusCodes.Status201Created)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> Post(TelemetryModel model)
{
if (!ModelState.IsValid) return BadRequest();
var now = DateTime.UtcNow;
model.Login = FixLoginNames(model.Login);
model.CourseId = model.CourseId.ToLowerInvariant();
Debug.WriteLine($"Model valid: {model}");
var m = await _ctx.Telemetry.OrderByDescending(x => x.End)
.FirstOrDefaultAsync(x => x.Login == model.Login &&
x.CourseId == model.CourseId &&
x.PageNumber == model.PageNumber);
try
{
var id = 0L;
model.Start = now;
var endTime = now.AddSeconds(Interval + 1);
if (model.Topics != null) await ParseTopics(model, now);
if (m == null)
{
Debug.WriteLine($"Model null: {model}");
model.End = endTime;
await _ctx.AddAsync(model);
await _ctx.SaveChangesAsync();
id = model.Id;
}
// Проверяем что это одна и та-же сессия
else if (m?.End != null && m.End > now)
{
Debug.WriteLine($"Continue: {model}");
m.End = endTime;
m.Duration = GetDuration(m);
_ctx.Telemetry.Update(m);
await _ctx.SaveChangesAsync();
id = m.Id;
}
else
{
model.End = endTime;
model.Duration = GetDuration(model);
Debug.WriteLine($"New session: {model}");
await _ctx.AddAsync(model);
await _ctx.SaveChangesAsync();
id = model.Id;
}
var url = Url.Action("Get", new { id });
return Created(url, new { id, url });
}
catch (Exception ex)
{
Logger.LogError(ex.Message);
return this.Problem(ex.Message, null, 500);
}
}
This little event caused a lot of controversy within the community.
This feature used to be called the Design View and it's been removed from SPD2013
There's a ton of stuff in the forums about it but here's the summary from MS as to why it was removed.
blogs.office.com/b/sharepoint/archive/2012/10/10/c...
A related post from one of the MSFT's regarding the new design engine and external Editors can be seen here.
blogs.technet.com/b/speschka/archive/2012/07/27/us...
Я в общем то не против питона, но для веба есть много более вкусных и не экзотичных решений