private async Task SendAppMessages(ClaimsPrincipal principal, List <Message> msgs) { using (var session = AppQueue.BeginSession()) { foreach (var message in msgs) { _logger.Debug($"AppMsg[{GetHashCode()}]: {message.Body}"); } await session.EnqueueAsync(principal, msgs); await session.SaveChanges(); } }
private async Task SendAppMessage(ClaimsPrincipal claimsPrincipal, Message message) { using (var session = AppQueue.BeginSession()) { if (claimsPrincipal == null) { await session.EnqueueAsync(message); } else { await session.EnqueueAsync(claimsPrincipal, message); } _logger.Info($"AppMsg[{GetHashCode()}]: {message.Body}"); await session.SaveChanges(); } }
private async Task SendAppMessages(ClaimsPrincipal principal, IReadOnlyCollection <Message> msgs) { if (msgs.Count == 0) { return; } using (var session = AppQueue.BeginSession()) { foreach (var message in msgs) { _logger.Debug($"AppMsg[{GetHashCode()}]: {message.Body}"); } await session.EnqueueAsync(principal, msgs); await session.SaveChanges(); } }
private void WinFormsClient_Load(object sender, EventArgs e) { SyncSupplierQueue = new TaskQueue<ProductItem, SimpleResult>(cts.Token); InteceptQueue = new AppQueue<InterceptInfo>(cts.Token); CloseTradeQueue = new AppQueue<long>(cts.Token); WaitUpWaitDownlist = new AppQueue<ProductItem[]>(cts.Token); InstallCert(); wbLoginMode.UserCancelLogin += () => { this.Close(); }; wbTaoChongZhiMode.AskLogin += () => { this.InvokeAction(this.ShowLoginWindow, wb); }; var files = Directory.EnumerateFiles(Application.StartupPath, "*.bin"); if (files.Any()) { var selectAccountForm = new SelectAccountForm(); foreach (var fName in files) { var uName = Path.GetFileNameWithoutExtension(fName); if (!string.IsNullOrEmpty(uName)) { var button = new Button() { Size = new Size(140, 30), Text = uName, }; button.Click += OnSelectAccountButtonClick; selectAccountForm.AccountButtons.Add(button); } } if (selectAccountForm.AccountButtons.Count > 1) selectAccountForm.ShowDialog(); } wbLoginMode.Enter(wb); var x = new TaoLoginForm(wbLoginMode).ShowDialog(); if (x != DialogResult.OK) { Environment.Exit(0); } LoadMenuItemSetting(); this.dataGridViewItem.ContextMenuStrip = contextMenuStrip1; this.OnLoginSuccess(); tabPage2.Controls.Add(wb); WBHelper.InitWBHelper(wbArrayWrapper, "http://chongzhi.taobao.com/index.do?method=index"); }