protected internal static NotifyInfo Load_unlocked(string fp) { NotifyInfo result; for (; ;) { try { System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(typeof(NotifyInfo)); using (System.IO.StreamReader sr = System.IO.File.OpenText(fp)) { result = (NotifyInfo)xs.Deserialize(sr); } result.FileExists = true; } catch (System.IO.FileNotFoundException) { result = new NotifyInfo(); } catch (System.IO.IOException) { System.Threading.Thread.Sleep(500); continue; } break; } if (null == result.Notify) { result.Notify = new List <NEntry>(); } return(result); }
private bool SaveNewNotifyInfo(NotifyInfo _info) { using (OracleConnection cn = OracleHelper.OpenConnection()) { OracleTransaction _txn = cn.BeginTransaction(); try { OracleCommand _cmd = new OracleCommand(SQL_SaveNewNotifyInfo, cn); _cmd.Parameters.Add(":FBDW", SinoUserCtx.CurUser.CurrentPost.PostDWDM); _cmd.Parameters.Add(":FBR", SinoUserCtx.CurUser.UserName); _cmd.Parameters.Add(":LXDH", _info.TelNum); _cmd.Parameters.Add(":DZYJ", _info.Email); _cmd.Parameters.Add(":XXBT", _info.Title); _cmd.Parameters.Add(":XXNR", _info.Context); _cmd.ExecuteNonQuery(); } catch (Exception e) { string _errmsg = string.Format("删除ID={1}的通知通告信息时出错,错误信息为:{0}!", e.Message, _info.ID); OralceLogWriter.WriteSystemLog(_errmsg, "ERROR"); _txn.Rollback(); return(false); } _txn.Commit(); cn.Close(); } return(true); }
public bool DeleteNotifyInfo(NotifyInfo CurrentInfo) { string _sql = " delete from XT_GGXX where ID=:ID AND FBDW=:FBDWDM "; using (OracleConnection cn = OracleHelper.OpenConnection()) { OracleTransaction _txn = cn.BeginTransaction(); try { OracleCommand _cmd = new OracleCommand(_sql, cn); _cmd.Parameters.Add(":ID", decimal.Parse(CurrentInfo.ID)); _cmd.Parameters.Add(":FBDWDM", SinoUserCtx.CurUser.CurrentPost.PostDWDM); _cmd.ExecuteNonQuery(); } catch (Exception e) { string _errmsg = string.Format("删除ID={1}的通知通告信息时出错,错误信息为:{0}!", e.Message, CurrentInfo.ID); OralceLogWriter.WriteSystemLog(_errmsg, "ERROR"); _txn.Rollback(); return(false); } _txn.Commit(); cn.Close(); } return(true); }
public static bool NotifyKill(long NotifyID) { System.Threading.Mutex mu = new System.Threading.Mutex(false, NotifyInfo.MUTEXNAME); try { mu.WaitOne(); } catch (System.Threading.AbandonedMutexException) { } try { NotifyInfo ninfo = NotifyInfo.Load_unlocked(); int index = ninfo.FindNEntryByID(NotifyID); if (-1 == index) { return(false); } ninfo.Notify.RemoveAt(index); ninfo.Save_unlocked(); return(true); } finally { mu.ReleaseMutex(); IDisposable dmu = mu; dmu.Dispose(); } }
public NotifyInfo GetNotifyInfo(string _msgid) { NotifyInfo _ret = null; StringBuilder _sb = new StringBuilder(); _sb.Append(" select ID,XXBT,XXNR,FBDW,(select ZZJGMC from QX2_ZZJG WHERE ZZJGDM = FBDW) FBDWMC,FBR,LXDH,DZYJ,FBSJ from XT_GGXX"); _sb.Append(" where id=:ID "); OracleParameter[] _param = { new OracleParameter(":ID", OracleDbType.Decimal) }; _param[0].Value = Decimal.Parse(_msgid); OracleDataReader dr = OracleHelper.ExecuteReader(OracleHelper.ConnectionStringProfile, CommandType.Text, _sb.ToString(), _param); while (dr.Read()) { _ret = new NotifyInfo(dr.IsDBNull(0) ? "0" : dr.GetDecimal(0).ToString(), dr.IsDBNull(1) ? "" : dr.GetString(1), dr.IsDBNull(2) ? "" : dr.GetString(2), dr.IsDBNull(3) ? "" : dr.GetString(3), dr.IsDBNull(4) ? "" : dr.GetString(4), "", dr.IsDBNull(5) ? "" : dr.GetString(5), dr.IsDBNull(6) ? "" : dr.GetString(6), dr.IsDBNull(7) ? "" : dr.GetString(7), dr.IsDBNull(8) ? DateTime.MinValue : dr.GetDateTime(8) ); } dr.Close(); return(_ret); }
/// <summary> /// 修改NotifyInfo /// </summary> /// <param name="notify"></param> /// <returns></returns> public static int UpdateNotify(NotifyInfo notify) { string sql = @"UPDATE [Notify] SET FromUserId=@FromUserId, ToUserId=@ToUserId, CreateTime=@CreateTime, IsDelete=@IsDelete, IsRead=@IsRead, IsSystem=@IsSystem, Content=@Content, Title=@Title WHERE Id=@Id"; var par = new DynamicParameters(); par.Add("@Id", notify.Id, DbType.Int64); par.Add("@FromUserId", notify.FromUserId, DbType.Int32); par.Add("@ToUserId", notify.ToUserId, DbType.Int32); par.Add("@CreateTime", notify.CreateTime, DbType.DateTime); par.Add("@IsDelete", notify.IsDelete, DbType.Boolean); par.Add("@IsRead", notify.IsRead, DbType.Boolean); par.Add("@IsSystem", notify.IsSystem, DbType.Boolean); par.Add("@Content", notify.Content, DbType.String); par.Add("@Title", notify.Title, DbType.String); return(DapWrapper.InnerExecuteSql(DbConfig.ArticleManagerConnString, sql, par)); }
public static void ClearNotify() { System.Threading.Mutex mu = new System.Threading.Mutex(false, NotifyInfo.MUTEXNAME); try { mu.WaitOne(); } catch (System.Threading.AbandonedMutexException) { } try { NotifyInfo ninfo = NotifyInfo.Load_unlocked(); if (ninfo.Notify.Count < 1) { return; } ninfo.Notify = new List <NotifyInfo.NEntry>(0); ninfo.Save_unlocked(); } finally { mu.ReleaseMutex(); IDisposable dmu = mu; dmu.Dispose(); } }
private void displayText(String data) { try { if (this.InvokeRequired) { object[] temp = { data }; this.Invoke(new displayMessageDlgt(displayText), temp); return; } else { txtNotifications.Text += data.Replace("\0", "") + "\r\n"; NotifyInfo ni = null; AlienUtils.ParseNotification(data, out ni); if (ni != null) { lblReaderName.Text = ni.ReaderName; } } } catch (Exception ex) { Debug.WriteLine("Exception in the DiscplayText(): " + ex.Message); } }
public void StateChanged(object sender, DDConnectionStateChangedEventArgs e) { NotifyInfo ni = null; switch (e.State) { case DDConnectionState.Connected: ni = new NotifyInfo(Properties.Resources.ico_online, Properties.Resources.status_online); break; case DDConnectionState.ConnectionLost: ni = new NotifyInfo(Properties.Resources.ico_offline, Properties.Resources.status_offline); break; case DDConnectionState.ConnectionTimedOut: ni = new NotifyInfo(Properties.Resources.ico_error, string.Format(Properties.Resources.status_error, e.Data)); break; case DDConnectionState.AuthenticationFailed: ni = new NotifyInfo(Properties.Resources.ico_authfailure, Properties.Resources.status_authfailure); break; case DDConnectionState.AuthenticationSucceeded: ni = new NotifyInfo(Properties.Resources.ico_online, Properties.Resources.status_authsuccess); break; } if (ni != null) { this.SetStatus(ni); } }
//闪烁监控改变颜色 private void timer_NotifySeriesLossEvent(object sender, EventArgs e) { DataGridViewRowCollection rows = this.dataGridView1.Rows; foreach (DataGridViewRow r in rows) { NotifyInfo info = r.DataBoundItem as NotifyInfo; if (info == null || info.SeriesLoss == "") { return; } double lossnum = 0.00; double.TryParse(info.SeriesLoss.Trim(), out lossnum); double notifyLossNum = 0.00; double.TryParse(this.textBox_SeriesLossNotify.Text, out notifyLossNum); //如果亏损次数小于设定的监控次数,默认都是白色底,然后直接返回,如果大于,再更改 if (lossnum < notifyLossNum) { r.DefaultCellStyle.BackColor = Color.White; continue; } if (r.DefaultCellStyle.BackColor == Color.Red) { r.DefaultCellStyle.BackColor = Color.White; } else { r.DefaultCellStyle.BackColor = Color.Red; } } }
public void set3rdNotifyInfo(Notify notify) { if (notify.Title == null || notify.Content == null) { throw new Exception("notify title or content cannot be null"); } NotifyInfo.Builder builder = NotifyInfo.CreateBuilder().SetTitle(notify.Title).SetContent(notify.Content); if (this.typeNotNull(notify.Type)) { builder.SetType(notify.Type); if (!string.IsNullOrEmpty(notify.Payload)) { builder.SetPayload(notify.Payload); } if (!string.IsNullOrEmpty(notify.Intent)) { if (notify.Intent.Length > GtConfig.getTransIntentLength()) { throw new Exception("intent size overlimit " + (object)GtConfig.getTransIntentLength()); } if (!this.reg.IsMatch(notify.Intent)) { throw new Exception("intent format error,should start with \"intent:#Intent;\",end with \";end\" "); } builder.SetIntent(notify.Intent); } if (!string.IsNullOrEmpty(notify.Url)) { builder.SetUrl(notify.Url); } } this.pushInfo.SetNotifyInfo(builder.Build()).SetValidNotify(true); }
/// <summary> /// 发送消息 /// </summary> /// <param name="code"></param> /// <param name="message"></param> public void SendMessage(NotifyInfo code, string message) { NotifyEventArgs e = new NotifyEventArgs(code, message); if (OnMsgNotifyEvent != null) { OnMsgNotifyEvent(this, e); } }
NotifyInfo GetInfo() { NotifyInfo info = new NotifyInfo(); info.NotifyType = (bool)_cbWarning.IsChecked ? NotifyType.Warning : NotifyType.Information; info.Message = _tbMessage.Text; info.Link = "查看详情"; info.LinkCallback = OnLink; info.DelaySeconds = (bool)_cbAutoClose.IsChecked ? 3 : 0; return(info); }
private void InitForm() { using (SinoSZClientBase.CommonService.CommonServiceClient _csc = new SinoSZClientBase.CommonService.CommonServiceClient()) { _info = _csc.GetNotifyInfo(MsgID); } if (_info != null) { ShowInofData(); } }
private void SetStatus(NotifyInfo notifyinfo) { if (_notifyicon.Visible == false) { _notifyicon.Visible = true; } _notifyicon.Icon = notifyinfo.Icon; var tooltip = (notifyinfo.Text ?? string.Empty); _notifyicon.Text = (tooltip.Length > 63) ? tooltip.Substring(0, 63) : tooltip; }
private void SendNotification(NotifyInfo ni) { var ce = ni.CommentEntry; var storageAccount = CloudStorageAccount.Parse(OgdiConfiguration.GetValue("DataConnectionString")); var queueStorage = storageAccount.CreateCloudQueueClient(); var queue = queueStorage.GetQueueReference("workercommands"); foreach (string subscriber in CommentRepository.GetSubscribers(ce.ParentName, ce.ParentContainer, ce.ParentType, ce.RowKey)) { string unsubscribeLink = string.Format("{0}://{1}:{2}/comments/unsubscribe/?id={3}&type={4}&user={5}", Request.UrlReferrer.Scheme, Request.UrlReferrer.Host, Request.UrlReferrer.Port, ce.RowKey, ce.ParentType, subscriber); string datasetName = ni.DatasetName; string userName = !string.IsNullOrEmpty(ni.CommentEntry.Author) ? ni.CommentEntry.Author : "Anonymous"; string link = ni.Link; string commentLink = ni.Link; string siteName = "OGDI site"; var body = new StringBuilder(); body.AppendFormat("{0} posted new comment to <a href=\"{1}\">{2}</a>", userName, link, datasetName); body.AppendLine("<br/><br/>"); body.AppendLine("<div style='font-family:Verdana;text-transform:uppercase;font-size:14pt;'><b>"); body.AppendLine(ni.CommentEntry.Subject); body.AppendLine("</div></b>"); body.AppendLine("<br/>"); body.AppendLine(ni.CommentEntry.Body); body.AppendLine("<br/><br/><br/>"); body.AppendLine("<div style='font-family:Verdana;font-size:7pt;'>"); body.AppendFormat("<a href=\"{0}\">Stop following</a>", unsubscribeLink); body.AppendLine("<br/><hr/>"); body.AppendFormat("You received this notification because you subscribed to comment updates on {0} on the {1}", datasetName, siteName); body.AppendLine("<div>"); var messageXml = new XDocument( new XElement("command", new XAttribute("commandname", "SendMail"), new XElement("EMailMessage", new XElement("To", subscriber), new XElement("Subject", "OGDI: " + datasetName), new XElement("Body", body.ToString()), new XElement("IsBodyHtml", "true") ))); var message = new CloudQueueMessage(messageXml.ToString()); queue.AddMessage(message); } }
public virtual void SetMessage(string message) { if (NotifyInfo != null) { NotifyInfo.SetInfo(message); } else { if ((message != null) && (Text != null)) { Text.text = message; } } }
public virtual async void Notify(NotifyInfo notifyInfo, BAsyncResult<Object> asyncResult) { Object __byps__ret = default(Object); Exception __byps__ex = null; bool __byps__callAsync = false; try { Notify(notifyInfo); } catch (NotImplementedException) { __byps__callAsync = true; } catch (Exception e) { __byps__ex = e; } if (__byps__callAsync) try { await NotifyAsync(notifyInfo); } catch (NotImplementedException) { __byps__ex = new BException(BExceptionC.UNSUPPORTED_METHOD, ""); } catch (Exception e) { __byps__ex = e; } asyncResult(__byps__ret, __byps__ex); }
static NotifyInfo.NEntry _AddNotify(long WaitOnJID, string JobInfo, string email, string UserAdded, string UserMessage) { NotifyInfo.NEntry ne = new NotifyInfo.NEntry(); ne.WaitOnJID = WaitOnJID; ne.WaitOnJobInfo = JobInfo; string HistoryRegex = null; if (JobInfo != null) { HistoryRegex = MySpace.DataMining.AELight.Surrogate.WildcardRegexSubstring(JobInfo); if (!JobInfo.StartsWith("*")) { HistoryRegex = @"\b" + HistoryRegex; } if (!JobInfo.EndsWith("*")) { HistoryRegex += @"\b"; } } ne.WaitOnHistoryRegex = HistoryRegex; ne.Email = email; ne.UserAdded = UserAdded; ne.UserMessage = UserMessage; System.Threading.Mutex mu = new System.Threading.Mutex(false, NotifyInfo.MUTEXNAME); try { mu.WaitOne(); } catch (System.Threading.AbandonedMutexException) { } try { NotifyInfo ninfo = NotifyInfo.Load_unlocked(); NotifyInfo.NEntry result = ninfo.AddNotify_unlocked(ne); ninfo.Save_unlocked(); return(result); } finally { mu.ReleaseMutex(); IDisposable dmu = mu; dmu.Dispose(); } }
/// <summary> /// 保存新数据 /// </summary> private bool SaveNewData() { NotifyInfo _newNotifyInfo = new NotifyInfo( "", this.te_xxbt.EditValue.ToString().Trim(), this.te_xxnr.EditValue.ToString().Trim(), "", "", "", "", (this.te_tel.EditValue == null) ? "" : this.te_tel.EditValue.ToString().Trim(), (this.te_email.EditValue == null) ? "" : this.te_email.EditValue.ToString().Trim(), DateTime.Now); using (SinoSZClientBase.CommonService.CommonServiceClient _csc = new SinoSZClientBase.CommonService.CommonServiceClient()) { return(_csc.SaveNotifyInfo(_newNotifyInfo)); } }
/// <summary> /// Set the specified style. /// </summary> /// <returns><c>true</c>, if style was set for children gameobjects, <c>false</c> otherwise.</returns> /// <param name="style">Style data.</param> public bool SetStyle(Style style) { style.Notify.Background.ApplyTo(transform.Find("Background")); style.Notify.Text.ApplyTo(Text); if (NotifyInfo != null) { NotifyInfo.SetStyle(style); } if (HideButton != null) { style.ButtonClose.Background.ApplyTo(HideButton); style.ButtonClose.Text.ApplyTo(HideButton.transform.Find("Text")); } return(true); }
public int SaveMessage(NotifyMessage m) { using var scope = ServiceProvider.CreateScope(); using var dbContext = scope.ServiceProvider.GetService <DbContextManager <NotifyDbContext> >().Get(dbid); using var tx = dbContext.Database.BeginTransaction(IsolationLevel.ReadCommitted); var notifyQueue = new NotifyQueue { NotifyId = 0, TenantId = m.Tenant, Sender = m.From, Reciever = m.To, Subject = m.Subject, ContentType = m.ContentType, Content = m.Content, SenderType = m.Sender, CreationDate = new DateTime(m.CreationDate), ReplyTo = m.ReplyTo, Attachments = m.EmbeddedAttachments.ToString(), AutoSubmitted = m.AutoSubmitted }; notifyQueue = dbContext.NotifyQueue.Add(notifyQueue).Entity; dbContext.SaveChanges(); var id = notifyQueue.NotifyId; var info = new NotifyInfo { NotifyId = id, State = 0, Attempts = 0, ModifyDate = DateTime.UtcNow, Priority = m.Priority }; dbContext.NotifyInfo.Add(info); dbContext.SaveChanges(); tx.Commit(); return(1); }
/// <summary> /// DataModel 转 ViewModel /// </summary> /// <param name="notify"></param> /// <returns></returns> public static NotifyVModel NotifyInfoToVModel(NotifyInfo notify) { if (notify == null) { return(new NotifyVModel()); } return(new NotifyVModel { Id = notify.Id, FromUserId = notify.FromUserId, ToUserId = notify.ToUserId, CreateTime = notify.CreateTime, IsDelete = notify.IsDelete, IsRead = notify.IsRead, IsSystem = notify.IsSystem, Content = notify.Content, Title = notify.Title }); }
private void NotifyAppendTextRich(string data) { if (this.InvokeRequired) { this.BeginInvoke(new Action <string>(NotifyAppendTextRich), data); } //肢解 List <string> strList = data.Split('-').ToList(); foreach (string s in strList) { s.Trim(); } NotifyInfo info = new NotifyInfo() { Time = strList[1] + "-" + strList[2], Ins = strList[3], SeriesLoss = strList[4] }; //找之前datagrid是否存在,如果不存在,直接添加,如果存在,删除,更新 NotifyInfo tp = null; foreach (NotifyInfo nf in m_notifyBindList) { if (nf.Ins.Trim().CompareTo(info.Ins.Trim()) == 0) { tp = nf; } } if (tp == null) { m_notifyBindList.Add(info); } else { m_notifyBindList.Remove(tp); m_notifyBindList.Add(info); } }
public void InitOldData(NotifyInfo _info) { SaveNew = false; this.Text = "修改通知通告"; _oldNotify = _info; this.te_fbdwmc.EditValue = SessionClass.CurrentSinoUser.CurrentPost.PostDWMC; this.te_fbdwmc.Properties.ReadOnly = true; this.te_fbsj.EditValue = DateTime.Now; this.te_fbsj.Properties.ReadOnly = true; this.te_fbr.EditValue = SessionClass.CurrentSinoUser.UserName; this.te_fbr.Properties.ReadOnly = true; this.te_xxbt.EditValue = _info.Title; this.te_xxnr.EditValue = _info.Context; this.te_tel.EditValue = _info.TelNum; this.te_email.EditValue = _info.Email; }
private static void WriteToConsole(NotifyInfo printerNotifyInfo) { Console.WriteLine($"Change: {printerNotifyInfo.Change}"); var printerNotifyData = printerNotifyInfo.Data.Where(data => data.Type == (int)NOTIFY_TYPE.PRINTER_NOTIFY_TYPE); foreach (var printerNotifyInfoData in printerNotifyData) { Console.WriteLine($"{(PRINTER_NOTIFY_FIELD) printerNotifyInfoData.Field} = {printerNotifyInfoData.Value}"); } var jobNotifyData = printerNotifyInfo.Data.Where(data => data.Type == (int)NOTIFY_TYPE.JOB_NOTIFY_TYPE); foreach (var pair in jobNotifyData) { Console.WriteLine($"{pair.Id}:{(JOB_NOTIFY_FIELD) pair.Field} = {pair.Value}"); } Console.WriteLine(); }
/// <summary> /// 添加NotifyInfo /// </summary> /// <param name="notify"></param> /// <returns></returns> public static long AddNotify(NotifyInfo notify) { string sql = @"INSERT INTO [Notify] ([FromUserId],[ToUserId],[CreateTime],[IsDelete],[IsRead],[IsSystem],[Content],[Title]) VALUES (@FromUserId,@ToUserId,@CreateTime,@IsDelete,@IsRead,@IsSystem,@Content,@Title) SELECT SCOPE_IDENTITY() " ; var par = new DynamicParameters(); par.Add("@FromUserId", notify.FromUserId, DbType.Int32); par.Add("@ToUserId", notify.ToUserId, DbType.Int32); par.Add("@CreateTime", notify.CreateTime, DbType.DateTime); par.Add("@IsDelete", notify.IsDelete, DbType.Boolean); par.Add("@IsRead", notify.IsRead, DbType.Boolean); par.Add("@IsSystem", notify.IsSystem, DbType.Boolean); par.Add("@Content", notify.Content, DbType.String); par.Add("@Title", notify.Title, DbType.String); return(DapWrapper.InnerQueryScalarSql <long>(DbConfig.ArticleManagerConnString, sql, par)); }
private Embed GetHeader(Post post, NotifyInfo notify, Group group) { var embed = new EmbedBuilder { ThumbnailUrl = group.Photo200.ToString(), Author = new EmbedAuthorBuilder { Name = group.Name, Url = _vk.Domain + notify.SourceDomain }, Timestamp = post.Date.Value, Title = "Link to post", Url = _vk.Domain + "wall" + post.OwnerId + "_" + post.Id }; embed.AddField(new EmbedFieldBuilder { IsInline = true, Name = "Likes", Value = post.Likes == null ? 0 : post.Likes.Count }); embed.AddField(new EmbedFieldBuilder { IsInline = true, Name = "Reposts", Value = post.Reposts == null ? 0 : post.Reposts.Count }); embed.AddField(new EmbedFieldBuilder { IsInline = true, Name = "Comments", Value = post.Comments == null ? 0 : post.Comments.Count }); embed.AddField(new EmbedFieldBuilder { IsInline = true, Name = "Views", Value = post.Views == null ? 0 : post.Views.Count }); return(embed.Build()); }
private void ShowMsg(string _msgid) { using (SinoSZClientBase.CommonService.CommonServiceClient _csc = new SinoSZClientBase.CommonService.CommonServiceClient()) { CurrentInfo = _csc.GetNotifyInfo(_msgid); } if (CurrentInfo != null) { this.te_xxbt.EditValue = CurrentInfo.Title; this.te_xxnr.EditValue = CurrentInfo.Context; this.te_fbdwmc.EditValue = CurrentInfo.FBdwmc; this.te_fbr.EditValue = CurrentInfo.FByhmc; this.te_fbsj.EditValue = CurrentInfo.SendTime; this.te_tel.EditValue = CurrentInfo.TelNum; this.te_email.EditValue = CurrentInfo.Email; } else { ClearMsg(); } }
public ActionResult Add(string name, string subject, string comment, string email, string type, bool notify, string datasetId, string datasetName, string parentType, string container, string captchaChallenge, string captchaResponse) { var validCaptcha = Recaptcha.Validate(captchaChallenge, captchaResponse, Request.UserHostAddress); if (!validCaptcha || string.IsNullOrEmpty(name) || string.IsNullOrEmpty(subject) || string.IsNullOrEmpty(comment) || string.IsNullOrEmpty(datasetId)) { return(EmptyHtml()); } var result = new Comment { Subject = subject, Body = comment, Posted = DateTime.Now, Email = email, Type = type, Status = "New", Notify = notify && !string.IsNullOrEmpty(email), ParentName = datasetId, ParentType = parentType, Author = name, ParentContainer = container, }; CommentRepository.AddComment(result); string linkToParent = Request.UrlReferrer.AbsoluteUri; var ni = new NotifyInfo { CommentEntry = result, Link = linkToParent, DatasetName = datasetName, }; Action <NotifyInfo> notification = SendNotification; notification.BeginInvoke(ni, null, null); return(View("Comment", result)); }
public NotifyItem(NotifyInfo p_info) { InitializeComponent(); _info = p_info; _grid.Background = _info.NotifyType == NotifyType.Information ? Res.BlackBrush : Res.RedBrush; _grid.PointerEntered += OnPointerEntered; _grid.PointerPressed += OnPointerPressed; _grid.PointerReleased += OnPointerReleased; _grid.PointerExited += OnPointerExited; _tb.Text = _info.Message; _info.Close = CloseInternal; if (!string.IsNullOrEmpty(_info.Link)) { Button btn = new Button { Content = _info.Link, Style = Res.浅色按钮, HorizontalAlignment = HorizontalAlignment.Right, Margin = new Thickness(0, 10, 0, 0) }; if (_info.LinkCallback != null) { btn.Click += (s, e) => _info.LinkCallback(_info); } _sp.Children.Add(btn); } if (_info.DelaySeconds > 0) { StartAutoClose(); } // 动画,uno暂时未实现 TransitionCollection tc = new TransitionCollection(); tc.Add(new EdgeUIThemeTransition { Edge = Kit.IsPhoneUI ? EdgeTransitionLocation.Top : EdgeTransitionLocation.Right }); _grid.Transitions = tc; }
public ActionResult Add(string name, string subject, string comment, string email, string type, bool notify, string datasetId, string datasetName, string parentType, string container, string captchaChallenge, string captchaResponse) { var validCaptcha = Recaptcha.Validate(captchaChallenge, captchaResponse, Request.UserHostAddress); if (!validCaptcha || string.IsNullOrEmpty(name) || string.IsNullOrEmpty(subject) || string.IsNullOrEmpty(comment) || string.IsNullOrEmpty(datasetId)) return EmptyHtml(); var result = new Comment { Subject = subject, Body = comment, Posted = DateTime.Now, Email = email, Type = type, Status = "New", Notify = notify && !string.IsNullOrEmpty(email), ParentName = datasetId, ParentType = parentType, Author = name, ParentContainer = container, }; CommentRepository.AddComment(result); string linkToParent = Request.UrlReferrer.AbsoluteUri; var ni = new NotifyInfo { CommentEntry = result, Link = linkToParent, DatasetName = datasetName, }; Action<NotifyInfo> notification = SendNotification; notification.BeginInvoke(ni, null, null); return View("Comment", result); }
public virtual void Notify(NotifyInfo notifyInfo, BAsyncResult<Object> asyncResult) { BRequest_FileSystemNotify_notify req = new BRequest_FileSystemNotify_notify(); req.notifyInfoValue = notifyInfo; transport.sendMethod(req, asyncResult); }
private void SendNotification(NotifyInfo ni) { }
protected internal static NotifyInfo Load_unlocked(string fp) { NotifyInfo result; for (; ; ) { try { System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(typeof(NotifyInfo)); using (System.IO.StreamReader sr = System.IO.File.OpenText(fp)) { result = (NotifyInfo)xs.Deserialize(sr); } result.FileExists = true; } catch (System.IO.FileNotFoundException) { result = new NotifyInfo(); } catch (System.IO.IOException) { System.Threading.Thread.Sleep(500); continue; } break; } if (null == result.Notify) { result.Notify = new List<NEntry>(); } return result; }
public virtual void Notify(NotifyInfo notifyInfo) { BSyncResult<Object> asyncResult = new BSyncResult<Object>(); Notify(notifyInfo, BAsyncResultHelper.ToDelegate<Object>(asyncResult)); asyncResult.GetResult(); }
/// <summary> /// Notify the browser about an event. /// </summary> public virtual Task NotifyAsync(NotifyInfo notifyInfo){ return BTaskConstants<Object>.NotImplemented; }
public virtual void Notify(NotifyInfo notifyInfo) { throw new NotImplementedException(); }
// checkpoint byps.gen.cs.GenRemoteStub:133 public async Task NotifyAsync(NotifyInfo notifyInfo){ BRequest_FileSystemNotify_notify req = new BRequest_FileSystemNotify_notify(); req.notifyInfoValue = notifyInfo; Task<Object> task = Task<Object>.Factory.FromAsync(transport.BeginSend<Object>, transport.EndSend<Object>, req, null); await task; }