private void WebView_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { var urlQuery = e.Url.ParseQueryStringToNameValue(true); if (urlQuery.AllKeys.Contains("error")) { LoadingPanel.ResetLoading(); LoadingPanel.Show(); WebViewLayout.Hide(); ReturnToPanel(); Height = m_initialHeight; } else if (urlQuery.AllKeys.Contains("access_token")) { LoadingPanel.ResetLoading(); LoadingPanel.Show(); WebViewLayout.Hide(); FacebookApi.Token = new OAuthCryptoSet(urlQuery.Get("access_token")); FacebookApi.Code = urlQuery.Get("code"); Height = m_initialHeight; UserDataWorker.RunWorkerAsync(); } else { LoadingPanel.Hide(); WebViewLayout.Show(); WebViewLayout.BringToFront(); Height = (Int32)(WebView.Document.Body.ScrollRectangle.Height * 1.3) + WebViewNoticeLabel.Height; } }
private void AuthorizationVerifyWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Error == null) { if (e.Result == null) { throw new OAuthUnexpectedResponse(); } else { UserDataWorker.RunWorkerAsync(); } } else { throw e.Error; } }
/// <summary> /// Конструктор. Полностью инициализирует закрытые <see cref="Cells"/> ячейки и выполняет /// пре-инициализацю для <see cref="UserCells"/> /// </summary> public SudokuViewModel() { m_lock = new object(); Cells = new ObservableCollection <Cell>(); UserCells = new ObservableCollection <Cell>(); PreInitCells(Cells); PreInitCells(UserCells); InitCellsCollections(Cells); FillCells(); /// <summary> /// Необходимо для возможности доступа к являющимся предметом Binding <see cref="UserCells"/> /// из другого потока (в данном случае для инициализации и нежелания блокировать UI) /// </summary> BindingOperations.EnableCollectionSynchronization(UserCells, m_lock); timer = new System.Timers.Timer(1000); timer.Elapsed += Timer_Elapsed; userData = new UserDataWorker(); UserStatistics = userData.LoadStatistics(); Game = new Game(); }
public MoqExampleTest() { // Arrange userDataWorker = new UserDataWorker(); }