Inheritance: MonoBehaviour
コード例 #1
0
        public string getReplayNotificationMessage(NotificationEntry el)
        {
            NotificationMessage msg = new NotificationMessage("Unity", el.agentId, "Contents Not set", DateTime.Now.ToString(), el.notificationId);
            string message          = MsgSerialization.serializationPlainXml(msg);

            return(message);
        }
コード例 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,SensorID,NotificationType,Message,TimeStamp")] NotificationEntry notificationEntry)
        {
            if (id != notificationEntry.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(notificationEntry);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!NotificationEntryExists(notificationEntry.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(notificationEntry));
        }
コード例 #3
0
        public Boolean isPropertyNotification(NotificationEntry entry)
        {
            GameObject targetGameObject = getGameObjectByName(entry.objectName);

            Component[] cs = (Component[])targetGameObject.GetComponents(typeof(Component));

            Debug.Log("Check in isPropertyNotification for propety notification");
            if (entry.fieldName.Equals("position"))             //TODO: to review this and make it work with  all king of properties
            {
                /*
                 *              XmlNode[] node = (XmlNode[])entry.fieldValue;
                 *              Vector3 vect = ConvertType.vector3FromXmlNode (node, MqttSetting.GAMA_POINT);
                 *
                 *              Vector3 propValue = (Vector3)targetGameObject.transform.position;
                 *              Debug.Log ("Return - > "+CompareVector3 (entry.fieldOperator, vect, propValue)+ "v1 = "+vect+ " v2 = " +propValue);
                 *              return CompareVector3 (entry.fieldOperator, vect, propValue);
                 */
            }

            // Do not delete

            /*
             *      foreach (Component c in cs) {
             *              Debug.Log ("+++ >> name: " + c.name + " type: " + c.GetType () + " basetype: " + c.GetType ().BaseType);
             *              PropertyInfo propertyInfo = c.GetType ().GetProperty (entry.fieldName);
             *
             *              PropertyInfo[] propertyI = c.GetType ().GetProperties ();
             *
             *              foreach (PropertyInfo p in propertyI) {
             *                      Debug.Log ("+++ Property name is : " + p.Name);
             *
             *              }
             *              if (propertyInfo != null) {
             *                      System.Object obj = (System.Object)c;
             *                      Debug.Log ("Name +++++++++++  >>>> " + propertyInfo.Name);
             *                      if (propertyInfo.PropertyType.Equals (typeof(Vector3))) {
             *
             *                              XmlNode[] node = (XmlNode[])entry.fieldValue;
             *
             *                              Vector3 vect = ConvertType.vector3FromXmlNode (node, MqttSetting.GAMA_POINT);
             *
             *                              Debug.Log ("Check for -++++++++++++++++>   " + vect);
             *
             *                              Vector3 propValue = (Vector3)propertyInfo.GetValue (obj, new object[] { 0 });
             *
             *                              return CompareVector3 (entry.fieldOperator, vect, propValue);
             *                      } else {
             *
             *                              //propetyValue = Convert.ChangeType (entry.fieldValue, propertyInfo.PropertyType);
             *
             *                      }
             *
             *              } else {
             *                      //Debug.Log ("------->>   Sorry. Property doesn't exist : "+property +" and component is "+ c.name);
             *              }
             *      }
             */
            return(false);
        }
コード例 #4
0
        public void ProcessTopic(object obj)
        {
            SetAllProperties(obj);

            NotificationEntry notif = new NotificationEntry(topicMessage.notificationId, topicMessage.objectName, topicMessage.fieldType, topicMessage.fieldName, topicMessage.fieldValue, topicMessage.fieldOperator, topicMessage.sender);

            NotificationRegistry.addToList(notif);
        }
コード例 #5
0
ファイル: Notification.cs プロジェクト: WuLiYoung/yangyang.wu
        public int AddObserver(string name, NotificationEntry entry, object sender)
        {
            List_NotifiEntry list;

            list.name  = name;
            list.obj   = sender;
            list.entry = entry;
            m_ListRegisterNotification.Add(list);
            return(0);
        }
コード例 #6
0
        public async Task <IActionResult> Create([Bind("ID,SensorID,NotificationType,Message,TimeStamp")] NotificationEntry notificationEntry)
        {
            if (ModelState.IsValid)
            {
                _context.Add(notificationEntry);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(notificationEntry));
        }
コード例 #7
0
        static void Trigger_internal(Playable playable, PlayableOutput output, ref NotificationEntry e)
        {
            var notify = TimelineUtil.Interface?.notify;

            if (notify != null)
            {
                notify(playable, e.payload);
                e.notificationFired = true;
            }
            //output.PushNotification(playable, e.payload);
            //e.notificationFired = true;
        }
コード例 #8
0
        static bool CanRestoreNotification(NotificationEntry e, FrameData info, double currentTime, double previousTime)
        {
            if (e.triggerOnce)
            {
                return(false);
            }
            if (info.timeLooped)
            {
                return(true);
            }

            //case 1111595: restore the notification if the time is manually set before it
            return(previousTime > currentTime && currentTime <= e.time);
        }
コード例 #9
0
        public Notification(NotificationEntry notificationEntry, Func <NotificationAction, INotificationAction> actionFactory)
        {
            _notificationEntry = notificationEntry;
            _actionFactory     = actionFactory;

            foreach (var notificationTrigger in notificationEntry.Triggers)
            {
                _triggers.Add(new Trigger(notificationTrigger));
            }
            foreach (var notificationAction in _notificationEntry.Actions)
            {
                var action = _actionFactory(notificationAction);
                _actions.Add(action);
            }
        }
コード例 #10
0
        public override void ShowNotification(string title, string text)
        {
            // HACK to make notifiaction in foreground
            // TODO - find better way
            Canvas.enabled                  = false;
            Canvas.enabled                  = true;
            NotificationManager.title       = title;
            NotificationManager.description = text;
            NotificationManager.UpdateUI();
            NotificationManager.OpenNotification();
            LogEntries.Add(new LogEntry("Notification", title, text));
            NotificationEntry notificationEntry = Instantiate(NotificationEntryPrefab, NotificationMenuContent.transform).GetComponent <NotificationEntry>();

            notificationEntry.transform.SetAsFirstSibling();
            notificationEntry.Title.text       = title;
            notificationEntry.Description.text = text;
            notificationEntry.Timestamp.text   = DateTime.Now.ToString();
        }
コード例 #11
0
        public NotificationViewModel(NotificationEntry notificationEntry, NotificationSettingsViewModel parent)
        {
            _notificationEntry = notificationEntry;
            _parent            = parent;
            Triggers           = new ReactiveCollection <TriggerViewModel>();

            foreach (var trigger in notificationEntry.Triggers)
            {
                Triggers.Add(new TriggerViewModel(trigger));
            }

            Actions = new ReactiveCollection <ActionViewModel>();
            foreach (var notificationAction in notificationEntry.Actions)
            {
                Actions.Add(new ActionViewModel(notificationAction));
            }

            AddNewTriggerCommand = new ReactiveCommand();
            AddNewTriggerCommand.Subscribe(_ =>
            {
                Triggers.Add(new TriggerViewModel(new NotificationTrigger()));
                SelectedTrigger = Triggers.Last();
                _parent.ToggleEditCommand.Execute(Triggers.Last());
            });


            AddNewActionCommand = new ReactiveCommand();
            AddNewActionCommand.Subscribe(_ =>
            {
                Actions.Add(new ActionViewModel(new FlashTaskBarNotificationAction()));
                SelectedAction = Actions.Last();
                _parent.ToggleEditCommand.Execute(Actions.Last());
            });

            DeleteItemCommand = new ReactiveCommand();
            DeleteItemCommand.OfType <TriggerViewModel>().Subscribe(t => Triggers.Remove(t));
            DeleteItemCommand.OfType <ActionViewModel>().Subscribe(a => Actions.Remove(a));
        }
コード例 #12
0
        public async Task <bool> InsertNotification(int sensorId, int notificationType, string message, string hash)
        {
            if (!hash.Equals(SecurityHelper.SecurityHash))
            {
                return(false);
            }

            var not = new NotificationEntry();

            not.SensorID         = sensorId;
            not.NotificationType = (NotificationType)notificationType;
            not.Message          = message;
            not.TimeStamp        = DateTime.Now;

            _context.NotificationEntry.Add(not);
            await _context.SaveChangesAsync();

            var body    = String.Format("Message: {0}", not.Message);
            var subject = String.Format("Notification: {0} Sensor: {1}", not.NotificationType, not.SensorID);

            MailHelper.SendMail(subject, body);
            return(true);
        }
コード例 #13
0
        static ConfigNotifications()
        {
            NotificationEntry entry = new NotificationEntry();

            entry.Id                    = "BossSummonTimerNotification";
            entry.Title                 = ConfigLoca.NOTIFICATIONS_PROMPT_PLAY;
            entry.Description           = ConfigLoca.NOTIFICATIONS_BOSS_SUMMON_TIMER;
            entry.BadgeNumber           = 1;
            BossSummonTimerNotification = entry;
            entry             = new NotificationEntry();
            entry.Id          = "CoinsCollectedTimerNotification";
            entry.Title       = ConfigLoca.NOTIFICATIONS_PROMPT_PLAY;
            entry.Description = ConfigLoca.NOTIFICATIONS_COINS_COLLECTED_TIMER;
            entry.BadgeNumber = 1;
            CoinCollectedTimerNotification = entry;
            entry                           = new NotificationEntry();
            entry.Id                        = "RetentionD1Notification";
            entry.Title                     = ConfigLoca.NOTIFICATIONS_PROMPT_PLAY;
            entry.Description               = ConfigLoca.NOTIFICATIONS_RETENTION_D1;
            entry.TimeOffsetTicks           = TimeUtil.DaysToTicks(1);
            entry.BadgeNumber               = 2;
            RetentionD1Notification         = entry;
            entry                           = new NotificationEntry();
            entry.Id                        = "RetentionD7Notification";
            entry.Title                     = ConfigLoca.NOTIFICATIONS_PROMPT_PLAY;
            entry.Description               = ConfigLoca.NOTIFICATIONS_RETENTION_D7;
            entry.TimeOffsetTicks           = TimeUtil.DaysToTicks(7);
            entry.BadgeNumber               = 3;
            RetentionD7Notification         = entry;
            entry                           = new NotificationEntry();
            entry.Id                        = "NewMissionAvailableNotification";
            entry.Title                     = ConfigLoca.NOTIFICATIONS_PROMPT_PLAY;
            entry.Description               = ConfigLoca.NOTIFICATIONS_NEW_BOUNTY;
            entry.BadgeNumber               = 1;
            NewMissionAvailableNotification = entry;
        }
コード例 #14
0
        public Boolean IsFieldNotification(NotificationEntry entry)
        {
            GameObject targetGameObject = GameObject.Find(entry.objectName);

            scripts = targetGameObject.GetComponents <MonoBehaviour>();
            // Debug.Log ("-------------->>>> The Operator" + scripts[0].GetType ());
            FieldInfo[] fieldInfoGet = targetGameObject.GetComponent(scripts[0].GetType()).GetType().GetFields();

            foreach (FieldInfo fi in fieldInfoGet)
            {
                if (fi.Name.Equals(entry.fieldName))
                {
                    UnityEngine.Component ob = (UnityEngine.Component)targetGameObject.GetComponent(scripts[0].GetType());
                    object target            = fi.GetValue(ob);

                    Debug.Log("-------------->>>> The field name: " + entry.fieldName);
                    //Debug.Log ("-------------->>>> The field type: " + entry.fieldType);
                    //Debug.Log ("-------------->>>> The Operator: " + entry.fieldOperator);
                    //Debug.Log ("-------------->>>> The current field value: " + fi.GetValue (ob));
                    //Debug.Log ("-------------->>>> The field introduced value: " + entry.fieldValue);

                    XmlNode[] node = (XmlNode[])entry.fieldValue;
                    foreach (XmlNode n in node)
                    {
                        if (n is XmlText)
                        {
                            switch (fi.FieldType.ToString())
                            {
                            case IDataType.UNITY_INT:
                                return(Compare <System.Int32>(entry.fieldOperator, (System.Int32)
                                                              Convert.ChangeType(fi.GetValue(ob), fi.FieldType),
                                                              (System.Int32)Convert.ChangeType(n.Value, fi.FieldType)));

                            case IDataType.UNITY_DOUBLE:
                                return(Compare <System.Double>(entry.fieldOperator, (System.Double)
                                                               Convert.ChangeType(fi.GetValue(ob), fi.FieldType),
                                                               (System.Double)Convert.ChangeType(n.Value, fi.FieldType)));

                            case IDataType.UNITY_BOOLEAN:
                                return(Compare <System.Boolean>(entry.fieldOperator, (System.Boolean)
                                                                Convert.ChangeType(fi.GetValue(ob), fi.FieldType),
                                                                (System.Boolean)Convert.ChangeType(n.Value, fi.FieldType)));

                            case IDataType.UNITY_STRING:
                                return(Compare <System.String>(entry.fieldOperator, (System.String)
                                                               Convert.ChangeType(fi.GetValue(ob), fi.FieldType),
                                                               (System.String)Convert.ChangeType(n.Value, fi.FieldType)));

                            case IDataType.UNITY_CHAR:
                                return(Compare <System.Char>(entry.fieldOperator, (System.Char)
                                                             Convert.ChangeType(fi.GetValue(ob), fi.FieldType),
                                                             (System.Char)Convert.ChangeType(n.Value, fi.FieldType)));

                            default:

                                break;
                            }
                        }
                    }
                }
            }
            return(false);
        }
コード例 #15
0
	protected override void OnInit (EventArgs e)
	{
		base.OnInit (e);

		foreach (WebControl tb in new WebControl [] { txtName, cmbIdentity, cmbMode, cmbNotificationType }) {
			tb.Attributes.Add ("onfocus", "javascript: document.getElementById ('lblHelp').innerHTML = '" + tb.ToolTip.Replace ("'", "\\'").Replace ("\n", "<br/>").Replace ("\r", "<br />") + "';");
		}

		var notifications = new List<NotificationEntry> ();

		using (var db = new DB ())
		using (var cmd = db.CreateCommand (@"
			SELECT notification.id, notification.name,
				COALESCE(irc.name, email.name, gh.name) AS identname,
				COALESCE(
					CASE WHEN irc.id IS NULL THEN NULL ELSE 'IRC' END,
					CASE WHEN email.id IS NULL THEN NULL ELSE 'Email' END,
					CASE WHEN gh.id IS NULL THEN NULL ELSE 'GitHub' END
				) AS identtype,
				notification.mode,
				notification.type
			FROM notification
			LEFT OUTER JOIN ircidentity AS irc ON irc.id = notification.ircidentity_id
			LEFT OUTER JOIN emailidentity AS email ON email.id = notification.emailidentity_id
			LEFT OUTER JOIN githubidentity AS gh ON gh.id = notification.githubidentity_id
			ORDER BY notification.name;

			SELECT 'IRC: ' || name AS name, 'IRC,' || id AS id
			FROM ircidentity
			UNION ALL
			SELECT 'Email: ' || name AS name, 'Email,' || id AS id
			FROM emailidentity
			UNION ALL
			SELECT 'GitHub: ' || name AS name, 'GitHub,' || id AS id
			FROM githubidentity

			ORDER BY name;
		"))
		using (var reader = cmd.ExecuteReader ()) {
			while (reader.Read ()) {
				var entry = new NotificationEntry ();
				entry.id = reader.GetInt32 (0);
				entry.name = reader.GetString (1);
				entry.identName = reader.GetString (2);
				entry.identType = reader.GetString (3);
				entry.mode = ((DBNotificationMode)reader.GetInt32 (4)).ToString ();
				entry.type = ((DBNotificationType)reader.GetInt32 (5)).ToString ();

				notifications.Add (entry);
			}

			reader.NextResult ();

			while (reader.Read ()) {
				cmbIdentity.Items.Add (new ListItem (reader.GetString (0), reader.GetString (1)));
			}
		}

		notificationsRepeater.DataSource = notifications;
		notificationsRepeater.DataBind ();
	}
コード例 #16
0
 static void Trigger_internal(Playable playable, PlayableOutput output, ref NotificationEntry e)
 {
     output.PushNotification(playable, e.payload);
     e.notificationFired = true;
 }
コード例 #17
0
 static void Restore_internal(ref NotificationEntry e)
 {
     e.notificationFired = false;
 }
コード例 #18
0
ファイル: Notification.cs プロジェクト: WuLiYoung/yangyang.wu
 public List_NotifiEntry(string name, NotificationEntry entry, object sender)
 {
     this.name  = name;
     this.entry = entry;
     this.obj   = sender;
 }
コード例 #19
0
ファイル: Notification.cs プロジェクト: WuLiYoung/yangyang.wu
 public List_NotifiEntry(string name, NotificationEntry entry)
 {
     this.name  = name;
     this.entry = entry;
     this.obj   = null;
 }
コード例 #20
0
 public void AddObserver(NotificationEntry nf)
 {
     notificationentrys.Add(nf);
 }
コード例 #21
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        foreach (WebControl tb in new WebControl [] { txtName, cmbIdentity, cmbMode, cmbNotificationType })
        {
            tb.Attributes.Add("onfocus", "javascript: document.getElementById ('lblHelp').innerHTML = '" + tb.ToolTip.Replace("'", "\\'").Replace("\n", "<br/>").Replace("\r", "<br />") + "';");
        }

        var notifications = new List <NotificationEntry> ();

        using (var db = new DB())
            using (var cmd = db.CreateCommand(@"
			SELECT notification.id, notification.name,
				COALESCE(irc.name, email.name, gh.name) AS identname,
				COALESCE(
					CASE WHEN irc.id IS NULL THEN NULL ELSE 'IRC' END,
					CASE WHEN email.id IS NULL THEN NULL ELSE 'Email' END,
					CASE WHEN gh.id IS NULL THEN NULL ELSE 'GitHub' END
				) AS identtype,
				notification.mode,
				notification.type
			FROM notification
			LEFT OUTER JOIN ircidentity AS irc ON irc.id = notification.ircidentity_id
			LEFT OUTER JOIN emailidentity AS email ON email.id = notification.emailidentity_id
			LEFT OUTER JOIN githubidentity AS gh ON gh.id = notification.githubidentity_id
			ORDER BY notification.name;

			SELECT 'IRC: ' || name AS name, 'IRC,' || id AS id
			FROM ircidentity
			UNION ALL
			SELECT 'Email: ' || name AS name, 'Email,' || id AS id
			FROM emailidentity
			UNION ALL
			SELECT 'GitHub: ' || name AS name, 'GitHub,' || id AS id
			FROM githubidentity

			ORDER BY name;
		"        ))
                using (var reader = cmd.ExecuteReader()) {
                    while (reader.Read())
                    {
                        var entry = new NotificationEntry();
                        entry.id        = reader.GetInt32(0);
                        entry.name      = reader.GetString(1);
                        entry.identName = reader.GetString(2);
                        entry.identType = reader.GetString(3);
                        entry.mode      = ((DBNotificationMode)reader.GetInt32(4)).ToString();
                        entry.type      = ((DBNotificationType)reader.GetInt32(5)).ToString();

                        notifications.Add(entry);
                    }

                    reader.NextResult();

                    while (reader.Read())
                    {
                        cmbIdentity.Items.Add(new ListItem(reader.GetString(0), reader.GetString(1)));
                    }
                }

        notificationsRepeater.DataSource = notifications;
        notificationsRepeater.DataBind();
    }
コード例 #22
0
ファイル: Notification.cs プロジェクト: WuLiYoung/yangyang.wu
 public int AddObserver(string name, NotificationEntry entry)
 {
     return(AddObserver(name, entry, null));
 }