void OnTriggerEnter2D(Collider2D o) { if (o.tag == "Player") { NotificationObject.ChangeText(text); } }
public void CallOperationUpdateArgument() { var o1 = new NotificationObject<string>() { Value1 = "Test", Value2 = "Te", }; var op = new CallOperation<bool>(new OperationContext(), Expression.Call( Expression.MakeMemberAccess( Expression.Constant(o1), typeof(NotificationObject<string>).GetProperty("Value1")), typeof(string).GetMethod("StartsWith", new Type[] { typeof(string) }), Expression.MakeMemberAccess( Expression.Constant(o1), typeof(NotificationObject<string>).GetProperty("Value2")))); Assert.IsTrue(op.Value); o1.Value2 = "st"; Assert.IsFalse(op.Value); o1.Value2 = "Te"; Assert.IsTrue(op.Value); }
public void SendNotification(NotificationObject notificationObject) { foreach (var blockingQueue in notificationQueues.Values) { blockingQueue.Put(notificationObject); } }
private void ExecuteShowCupView() { var cupId = AppSettingsHelper.GetValue("CupId", 1); _cupView.SetCupIdAndStartRefreshData(cupId); SelectedView = _cupView; }
public void Start() { notifierObjMap = new Dictionary <NotificationType, List <NotificationObject> > (); NotificationObject[] notifierObjects = (NotificationObject[])FindObjectsOfType(typeof(NotificationObject)); Debug.Log("Notifier objects found in scene: " + notifierObjects.Length); for (int i = 0; i < notifierObjects.Length; i++) { NotificationObject n = notifierObjects [i]; List <NotificationType> types = n.getNotificationTypes(); for (int j = 0; j < types.Count; j++) { NotificationType currType = types [j]; if (!notifierObjMap.ContainsKey(currType)) { notifierObjMap [currType] = new List <NotificationObject> (); } notifierObjMap [currType].Add(n); } } if (NetworkInterface.GetIsNetworkAvailable()) { thread = new Thread(new ThreadStart(ConnectPhone)); thread.Start(); } //ConnectPhone (); }
void _Initialize() { _NowSQID = new NotificationObject <SQID>(SQID.新規開始); _NextSQID = new NotificationObject <SQID>(SQID.新規開始); //WaitTaskTID.Clear(); MessageList.Clear(); }
void OnTriggerExit2D(Collider2D o) { if (o.tag == "Player" && NotificationObject.currentText == text) { NotificationObject.ChangeText(""); } }
public void OnTriggerExit2D(Collider2D c) { if (c.tag == "Player") { entered = false; NotificationObject.Close(); } }
public void OnTriggerEnter2D(Collider2D c) { if (c.tag == "Player") { entered = true; NotificationObject.ChangeText(text); } }
public SettingNavigationUserControl([Import(ComponentContract.Setting.ViewModelName, typeof(NotificationObject))] NotificationObject viewModel, [Import(typeof(ILogger))] ILogger logger) { Logger = logger; Logger.LogSource = ComponentContract.Setting.LogSource; InitializeComponent(); this.DataContext = viewModel; }
public void DeleteNotiObjectById(int nObjectId) { NotificationObject nChange = notificationObjectRepository.FindById(nObjectId); if (nChange != null) { notificationObjectRepository.Delete(nChange); } }
public void SpawnModel() { NotificationObject notificationObject = gameObject.GetComponent <NotificationObject> (); if (notificationObject != null) { notificationObject.SpawnObject(modelObj, true, false); } }
/// <summary> /// Create element from existing element and view model /// </summary> /// <param name="element"></param> /// <param name="vm"></param> /// <returns></returns> public static FrameworkElement CreateElement(FrameworkElement element, NotificationObject vm) { if (null != element) { element.DataContext = vm; } return(element); }
/// <summary>状态修改事件</summary> /// <param name="entityType">实体类型Id</param> /// <param name="type">状态类型</param> /// <param name="data">对应实体</param> void IEntityEventProxy.OnStatusChanged(int entityType, EntitySubsist type, NotificationObject data) { var msg = $@" {StationProgram.Config.StationName} {data.GetType().FullName} {type} {(data == null ? "{}" : JsonConvert.SerializeObject(data))}"; Task.Factory.StartNew(Request, msg); }
/// <summary> /// 构造 /// </summary> /// <param name="data">数据</param> /// <param name="lockObj">锁定对象</param> private EditScope(NotificationObject data, object lockObj) { _data = data; _preIsEditing = data.IsEditing; _lockObj = lockObj ?? new object(); if (!_preIsEditing) { _data.BeginEdit(); } }
/// <summary> /// Create element from resource xaml file and view model /// </summary> /// <param name="xamlFile"></param> /// <param name="vm"></param> /// <returns></returns> public static FrameworkElement CreateElementFromXmal(string xamlFile, NotificationObject vm) { FrameworkElement element; using (FileStream fs = new FileStream(xamlFile, FileMode.Open)) { element = (FrameworkElement)XamlReader.Load(fs); } return(CreateElement(element, vm)); }
public long UpdateNotification(NotificationObject notification) { try { return(_notificationManager.UpdateNotification(notification)); } catch (Exception ex) { ErrorLogger.LoggError(ex.StackTrace, ex.Source, ex.Message); return(0); } }
private void Entity_PropertyChanged(TreeItem item, NotificationObject arg, string name) { var entity = (EntityConfig)arg; switch (name) { case null: case nameof(EntityConfig.NoDataBase): item.SoruceTypeIcon = Application.Current.Resources[entity.NoDataBase ? "tree_Type" : "tree_Child4"] as BitmapImage; break; } }
public void Test_read() { var src = new NotificationObject<string>() { Value1 = "Test", }; var op = new MemberAccessOperation<string>(new OperationContext(), Expression.MakeMemberAccess( Expression.Constant(src), typeof(NotificationObject<string>).GetProperty("Value1"))); Assert.AreEqual("Test", op.Value); }
private void listView1_SelectedIndexChanged(object sender, EventArgs e) { if (listView1.SelectedItems.Count > 0) { NotificationObject @object = NotificationLists[listView1.SelectedItems[0].Index]; msgTitle.Text = @object.Title; msgTime.Text = @object.CreatedAt.ToString("yyyy-MM-dd HH:mm:ss"); msgType.Text = @object.Type.ToString(); msgSendID.Text = @object.Sender; msgRecvID.Text = @object.GetStringRecivers(); msgContent.Text = @object.Content; } }
public void NewNotification(NotificationObject notificationObject = null) { foreach (var stat in playerStatus) { if (stat.Value < 1) { GameOver(); PlayGame = false; Debug.Log("GameOver"); return; } } if (daysCount > 7) { WinMatch(); PlayGame = false; return; } if (PlayGame) { if (CheckStatusOfGame()) { countToWinGame++; } if (countToWinGame <= 5) { DaysManager(); if (!notificationObject) { var notification = listNotifications.GetNotification(isDating, isWorking, isStudying); Debug.Log(notification.titleNotification); var go = Instantiate(notification.notificationPrefab, notificationParent); var prefab = go.GetComponent <NotificationPrefab>(); prefab.Init(notification, CallEnumerator, NewSpecificNotification); } else { var go = Instantiate(notificationObject.notificationPrefab, notificationParent); var prefab = go.GetComponent <NotificationPrefab>(); prefab.Init(notificationObject, CallEnumerator, NewSpecificNotification); } } else { WinMatch(); } } }
/// <summary> /// Converts to string. /// </summary> /// <param name="value">NotificationObject object.</param> /// <returns>Coresponding string value.</returns> public static string GetString(NotificationObject value) { switch (value) { case NotificationObject.Data: return DataString; case NotificationObject.DataRelation: return DataRelationString; default: return MeString; } }
public static NotificationObject CloneSdkObject(NotificationObject ToClone) { var soap = new BinaryFormatter(); var mem = new MemoryStream(); NotificationObject output = null; using (mem) { soap.Serialize(mem, ToClone); mem.Position = 0; output = (NotificationObject)soap.Deserialize(mem); } return(output); }
/// <summary> /// Adds a notification to the area /// </summary> /// <param name="text">The text of the n otification</param> /// <param name="textColor">thhe colour</param> /// <param name="timeToRemove">Time that the notificaion will live</param> /// <param name="speed">speed that the notification will fade away</param> public void DisplayNotification(string text, Color color, float timeUntilDestroy, NotificationObject.FadeSpeed speed = NotificationObject.FadeSpeed.Normal) { GameObject newNotification = GameObject.Instantiate(m_NotificationObjectPrefab, m_notificationLayout.transform); NotificationObject script = newNotification.GetComponent <NotificationObject>(); if (script) { script.DisplayNotification(text, color, timeUntilDestroy, speed); } else { Destroy(newNotification); } }
/// <summary> /// 通用 /// </summary> /// <param name="deviceId"></param> /// <param name="data"></param> /// <returns></returns> public async Task SendToDevice(int deviceId, NotificationObject data) { try { var deviceNotification = new DeviceNotification { DeviceId = deviceId, Notification = data }; await SendToDevice(deviceNotification); } catch (Exception ex) { _logger.LogWarning($"SendToDevicen2错误:{deviceId},{ JsonHelper.ToJson( data )}, {ex}."); } }
/// <summary> /// Converts to string. /// </summary> /// <param name="value">NotificationObject object.</param> /// <returns>Coresponding string value.</returns> public static string GetString(NotificationObject value) { switch (value) { case NotificationObject.Data: return(DataString); case NotificationObject.DataRelation: return(DataRelationString); default: return(MeString); } }
private void Initialize(NotificationsAdapterViewHolder holder, NotificationObject notify) { try { switch (notify.Type) { case "memory": Glide.With(ActivityContext).Load(Resource.Mipmap.icon).Apply(new RequestOptions().CircleCrop()).Into(holder.ImageUser); holder.UserNameNotfy.Text = AppSettings.ApplicationName; break; default: { GlideImageLoader.LoadImage(ActivityContext, notify.Notifier?.Avatar, holder.ImageUser, ImageStyle.CircleCrop, ImagePlaceholders.Drawable); var name = WoWonderTools.GetNameFinal(notify.Notifier); string tempString = notify.Type == "share_post" || notify.Type == "shared_your_post" ? name + " " + ActivityContext.GetText(Resource.String.Lbl_sharedYourPost) : name + " " + notify.TypeText; try { SpannableString spanString = new SpannableString(tempString); spanString.SetSpan(new StyleSpan(TypefaceStyle.Bold), 0, name.Length, 0); holder.UserNameNotfy.SetText(spanString, TextView.BufferType.Spannable); } catch { holder.UserNameNotfy.Text = tempString; } break; } } holder.TextNotfy.Text = Methods.Time.TimeAgo(Convert.ToInt32(notify.Time), false); AddIconFonts(holder, notify.Type, notify.Icon); var drawable = TextDrawable.InvokeBuilder().BeginConfig().FontSize(30).EndConfig().BuildRound("", Color.ParseColor(GetColorFonts(notify.Type, notify.Icon))); holder.Image.SetImageDrawable(drawable); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public static Exception Send(string token, NotificationObject notification) { var data = new { to = token, data = new { //title = notification.Title, body = notification, } }; var serializer = new JavaScriptSerializer(); var json = serializer.Serialize(data); Byte[] byteArray = Encoding.UTF8.GetBytes(json); try { WebRequest tRequest = WebRequest.Create("https://fcm.googleapis.com/fcm/send"); tRequest.Method = "post"; tRequest.ContentType = "application/json"; tRequest.Headers.Add($"Authorization: key={ServerAPIKey}"); tRequest.Headers.Add($"Sender: id={SenderID}"); tRequest.ContentLength = byteArray.Length; Stream stream = tRequest.GetRequestStream(); stream.Write(byteArray, 0, byteArray.Length); stream.Close(); WebResponse response = tRequest.GetResponse(); stream = response.GetResponseStream(); StreamReader reader = new StreamReader(stream); string responseFromServer = reader.ReadToEnd(); reader.Close(); stream.Close(); response.Close(); return(null); } catch (Exception ex) { return(ex); } }
public void MemberInitOperationRead() { var src = new NotificationObject<string>() { Value1 = "Test", }; var op = new MemberInitOperation<NotificationObject<string>>(new OperationContext(), Expression.MemberInit( Expression.New(typeof(NotificationObject<string>)), Expression.Bind(typeof(NotificationObject<string>).GetProperty("Value2"), Expression.MakeMemberAccess( Expression.Constant(src), typeof(NotificationObject<string>).GetProperty("Value1"))))); Assert.AreEqual("Test", op.Value.Value2); }
private IEnumerator WaitNewNotification(NotificationObject notificationObject = null) { yield return(new WaitForSeconds(timeToNextNotification)); smartphoneAnim.SetTrigger("Notification"); yield return(new WaitForSeconds(1.0f)); if (!notificationObject) { NewNotification(); } else { NewNotification(notificationObject); } }
private void InvokeEvent(NotificationObject not) { switch (not.Type) { case NotificationType.DuelRequest: OnDuelNotification(not.UserId, not.UserNickname); break; case NotificationType.FriendRequest: OnFriendNotification(not.UserId, not.UserNickname); break; case NotificationType.TradeRequest: OnTradeNotification(not.UserId, not.UserNickname); break; } }
public override JObject Payload( ) { Dictionary <string, object> aps = new Dictionary <string, object>( ); Dictionary <string, object> apsDetails = new Dictionary <string, object>( ); apsDetails.Add("content-available", 1); aps.Add("aps", apsDetails); aps.Add("acmkind", NotificationObject.GetType().Name); aps.Add("acmcloudid", NotificationObject.CloudIdentifier()); aps.Add("acmtype", NotificationType); //return JObject.Parse(JsonConvert.SerializeObject(aps)); return(JObject.FromObject(aps)); }
private string SendEmailNotification(string tokenforCall, string comment, string subject) { var client = new RestClient("https://api-dev.sanlam.co.za/gti/communication-gateway/v1/message"); var request = new RestRequest(Method.POST); request.AddHeader("cache-control", "no-cache"); request.AddHeader("authorization", "Bearer " + tokenforCall); NotificationObject notificationObject = new NotificationObject(); List <MessageItem> messageItems = new List <MessageItem>(); List <string> recipients = new List <string>(); MessageItem messageItem = new MessageItem(); MessagePayload messagePayload = new MessagePayload(); messageItem.channel = "email"; recipients.Add("*****@*****.**"); recipients.Add("*****@*****.**"); messageItem.destination = recipients; messageItem.clientMessageId = "0000"; messagePayload.payload_type = "text"; messagePayload.subject = subject; messagePayload.content = comment; messageItem.message = messagePayload; messageItems.Add(messageItem); notificationObject.messages = messageItems; request.AddParameter("application/json; charset=utf-8", JsonConvert.SerializeObject(notificationObject), ParameterType.RequestBody); IRestResponse response = client.Execute(request); if (response.Content.ToLower().Contains("validation error")) { return("valadationfail"); } else { return("notification sent."); } }
/// <summary> /// Convert a Avalondock ContentId into a viewmodel instance /// that represents a document or tool window. The re-load of /// this component is cancelled if the Id cannot be resolved. /// /// The result is (viewmodel Id or Cancel) is returned in <paramref name="args"/>. /// </summary> /// <param name="sender"></param> /// <param name="args"></param> private void UpdateLayout(object sender, LayoutSerializationCallbackEventArgs args) { var resolver = this.DataContext as Edi.Interfaces.IViewModelResolver; if (resolver == null) { return; } // Get a matching viewmodel for that view via DataContext property of this view NotificationObject content_view_model = resolver.ContentViewModelFromID(args.Model.ContentId); if (content_view_model == null) { args.Cancel = true; } // found a match - return it args.Content = content_view_model; }
public static NotificationObject CloneSdkObject(NotificationObject ToClone) { var soap = new BinaryFormatter(); var mem = new MemoryStream(); NotificationObject output = null; using (mem) { soap.Serialize(mem, ToClone); mem.Position = 0; output = (NotificationObject)soap.Deserialize(mem); } return output; }
public void SaveXML(string file) { var objects = new NotificationObject[] { CollectionAreaTexture, CollectionColorArea }; var serializer = new SoapFormatter(); var ms = new MemoryStream(); using (ms) { serializer.Serialize(ms, objects); using (var stream = new FileStream(file, FileMode.Create)) { ms.WriteTo(stream); } } }